mission_control-servers 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5eef0e07ac8fee585155c704088b7cbfcbf9736440ee11af15bd780ce5077664
4
- data.tar.gz: f219f8ee1ddcfbed49ee3f80c0493bab20d433173a4863e6fba4abbca367e713
3
+ metadata.gz: bc4409da6282e65c894099e85c2386922bf4720cf2501c7f303ae4ab53feec1b
4
+ data.tar.gz: ba445e16464f045a01623072ab1e67343757d14604ad67f9e199863969984f4f
5
5
  SHA512:
6
- metadata.gz: 062a231db01dff3d63e7b342dabb170184ec5c9ac0421f3f86f3c9981250c54ccd2a7746854abdc6697c2f1241b8eda3d198c68fe8a158f47a8674e5a31bc6cb
7
- data.tar.gz: 060a236e9e8d5651175f328c790fc38fc02689ae01ad7cfb353fd7e589ba9fe35252e54335073dfc4366779f1668e1a446da36a37b862b44cbca5a415606350c
6
+ metadata.gz: 9b7e78d6f062679dff60f16360af3aee1edfde5c696dcd3189c39e029039be81916b5856538cdc1af0a9f62f2b928df1ede6b5c06af79a55438739102740687d
7
+ data.tar.gz: c6596961ef8050eaa270ca7b052c5a588ef2438a9958096ea65ac64bf03f5647a8946031b11c603daba4c21ac3d83667d1f2913ada6f12a68c079e2d1f9539df
@@ -41,43 +41,43 @@ module MissionControl::Servers
41
41
  fi
42
42
 
43
43
  cat <<'EOF' > metrics.sh
44
- #!/bin/bash
44
+ #!/bin/bash
45
45
 
46
- DEBUG=0
47
- if [[ "$1" == "--debug" ]]; then
48
- DEBUG=1
49
- fi
46
+ DEBUG=0
47
+ if [[ "$1" == "--debug" ]]; then
48
+ DEBUG=1
49
+ fi
50
50
 
51
- debug() {
52
- if [[ $DEBUG -eq 1 ]]; then
53
- echo "Debug: $1"
54
- fi
55
- }
51
+ debug() {
52
+ if [[ $DEBUG -eq 1 ]]; then
53
+ echo "Debug: $1"
54
+ fi
55
+ }
56
56
 
57
- endpoint="#{project_ingress_url(@project.token)}"
58
- cpu_usage=$(vmstat 1 5 | awk 'NR==4 {print 100 - $15}')
59
- mem_used=$(free -m | awk '/^Mem:/ {print $3}')
60
- mem_free=$(free -m | awk '/^Mem:/ {print $7}')
61
- disk_free=$(df -h | awk '$NF=="/"{print $4}')
62
- hostname=$(hostname)
57
+ endpoint="#{project_ingress_url(@project.token)}"
58
+ cpu_usage=$(vmstat 1 5 | awk 'NR==4 {print 100 - $15}')
59
+ mem_used=$(free -m | awk '/^Mem:/ {print $3}')
60
+ mem_free=$(free -m | awk '/^Mem:/ {print $7}')
61
+ disk_free=$(df -h | awk '$NF=="/"{print $4}')
62
+ hostname=$(hostname)
63
63
 
64
- # Debug outputs
65
- debug "CPU Usage: $cpu_usage"
66
- debug "Memory Used: $mem_used MB"
67
- debug "Memory Free: $mem_free MB"
68
- debug "Disk Free: $disk_free"
69
- debug "Hostname: $hostname"
64
+ # Debug outputs
65
+ debug "CPU Usage: $cpu_usage"
66
+ debug "Memory Used: $mem_used MB"
67
+ debug "Memory Free: $mem_free MB"
68
+ debug "Disk Free: $disk_free"
69
+ debug "Hostname: $hostname"
70
70
 
71
- data=$(printf "service[cpu]=%s&service[mem_used]=%s&service[mem_free]=%s&service[disk_free]=%s&service[hostname]=%s" \
72
- "$cpu_usage" "$mem_used" "$mem_free" "$disk_free" "$hostname")
71
+ data=$(printf "service[cpu]=%s&service[mem_used]=%s&service[mem_free]=%s&service[disk_free]=%s&service[hostname]=%s" \
72
+ "$cpu_usage" "$mem_used" "$mem_free" "$disk_free" "$hostname")
73
73
 
74
- debug "Data being sent: $data"
74
+ debug "Data being sent: $data"
75
75
 
76
- if [[ $DEBUG -eq 1 ]]; then
77
- curl -v -X POST "$endpoint" -d "$data"
78
- else
79
- curl -X POST "$endpoint" -d "$data"
80
- fi
76
+ if [[ $DEBUG -eq 1 ]]; then
77
+ curl -v -X POST "$endpoint" -d "$data"
78
+ else
79
+ curl -X POST "$endpoint" -d "$data"
80
+ fi
81
81
  EOF
82
82
 
83
83
  chmod +x metrics.sh
@@ -85,7 +85,7 @@ module MissionControl::Servers
85
85
  cron_job="* * * * * $(pwd)/metrics.sh"
86
86
  (crontab -l 2>/dev/null | grep -v -F "$cron_job"; echo "$cron_job") | crontab -
87
87
  echo "Sending first request to the server..."
88
- $(pwd)/metrics.sh
88
+ bash $(pwd)/metrics.sh
89
89
  echo
90
90
  echo "████████████████████████████████████████████████████████████████████████████"
91
91
  echo "█ █"
@@ -1,5 +1,5 @@
1
1
  module MissionControl
2
2
  module Servers
3
- VERSION = "0.2.5"
3
+ VERSION = "0.2.6"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mission_control-servers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Kimura