sensu-plugins-cpu-usage 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +3 -0
- data/bin/check-cpu-usage.rb +10 -4
- data/lib/sensu-plugins-cpu-usage/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c01cf9f6f2145599e43be96ebb701239ed00894b
|
4
|
+
data.tar.gz: a061aa19b4d7f6c3f2ff59d8cd9a50581db0cff8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c59c23f8776673405e8357e2b84355d1a498c1752e244d80940b629ab9db10545195734d1796eb48bc37186be93508fd0dc4546644f80c0bd9c951513fda8c6
|
7
|
+
data.tar.gz: bac4c77e6217086a4623c861bc826fdd54222e55dbf814cf6c385901ed68bb9d76be12952fa0625b6288dd26c99854ce3adab0a164930aea4b181668fec35709
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -22,6 +22,7 @@ Usage: check-cpu-usage.rb (options)
|
|
22
22
|
--crit-steal <USAGE> Critical if USAGE exceeds the current system steal usage
|
23
23
|
--crit-system <USAGE> Critical if USAGE exceeds the current system system usage
|
24
24
|
--crit-user <USAGE> Critical if USAGE exceeds the current system user usage
|
25
|
+
--handlers <HANDLERS> Comma separated list of handlers
|
25
26
|
-i <user,nice,system,idle,iowait,irq,softirq,steal,guest,guest_nice>,
|
26
27
|
--ignore-metric Comma separated list of metrics to ignore
|
27
28
|
-m <user,nice,system,idle,iowait,irq,softirq,steal,guest,guest_nice>,
|
@@ -42,5 +43,7 @@ Usage: check-cpu-usage.rb (options)
|
|
42
43
|
|
43
44
|
By default, all metrics are taken into consideration when calculating the overall cpu usage.
|
44
45
|
|
46
|
+
Use the --handlers command line option to specify which handlers you want to use for the generated events.
|
47
|
+
|
45
48
|
## Author
|
46
49
|
Matteo Cerutti - <matteo.cerutti@hotmail.co.uk>
|
data/bin/check-cpu-usage.rb
CHANGED
@@ -47,6 +47,12 @@ class CheckCpuUsage < Sensu::Plugin::Check::CLI
|
|
47
47
|
:default => 1,
|
48
48
|
:proc => proc(&:to_i)
|
49
49
|
|
50
|
+
option :handlers,
|
51
|
+
:description => "Comma separated list of handlers",
|
52
|
+
:long => "--handlers <HANDLER>",
|
53
|
+
:proc => proc { |s| s.split(',') },
|
54
|
+
:default => []
|
55
|
+
|
50
56
|
option :warn,
|
51
57
|
:description => "Warn if USAGE exceeds the overall system cpu usage (default: 80)",
|
52
58
|
:short => "-w <USAGE>",
|
@@ -82,22 +88,22 @@ class CheckCpuUsage < Sensu::Plugin::Check::CLI
|
|
82
88
|
end
|
83
89
|
|
84
90
|
def send_ok(check_name, msg)
|
85
|
-
event = {"name" => check_name, "status" => 0, "output" => "OK: #{msg}", "
|
91
|
+
event = {"name" => check_name, "status" => 0, "output" => "#{self.class.name} OK: #{msg}", "handlers" => config[:handlers]}
|
86
92
|
send_client_socket(event.to_json)
|
87
93
|
end
|
88
94
|
|
89
95
|
def send_warning(check_name, msg)
|
90
|
-
event = {"name" => check_name, "status" => 1, "output" => "WARNING: #{msg}", "
|
96
|
+
event = {"name" => check_name, "status" => 1, "output" => "#{self.class.name} WARNING: #{msg}", "handlers" => config[:handlers]}
|
91
97
|
send_client_socket(event.to_json)
|
92
98
|
end
|
93
99
|
|
94
100
|
def send_critical(check_name, msg)
|
95
|
-
event = {"name" => check_name, "status" => 2, "output" => "CRITICAL: #{msg}", "
|
101
|
+
event = {"name" => check_name, "status" => 2, "output" => "#{self.class.name} CRITICAL: #{msg}", "handlers" => config[:handlers]}
|
96
102
|
send_client_socket(event.to_json)
|
97
103
|
end
|
98
104
|
|
99
105
|
def send_unknown(check_name, msg)
|
100
|
-
event = {"name" => check_name, "status" => 3, "output" => "UNKNOWN: #{msg}", "
|
106
|
+
event = {"name" => check_name, "status" => 3, "output" => "#{self.class.name} UNKNOWN: #{msg}", "handlers" => config[:handlers]}
|
101
107
|
send_client_socket(event.to_json)
|
102
108
|
end
|
103
109
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-cpu-usage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matteo Cerutti
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|