cloudstack-nagios 0.17.6 → 0.17.7
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/cloudstack-nagios/commands/system_vm.rb +17 -3
- data/lib/cloudstack-nagios/templates/cloudstack_router_services.cfg.erb +15 -0
- data/lib/cloudstack-nagios/templates/icinga2/cloudstack_router_services.cfg.erb +22 -1
- data/lib/cloudstack-nagios/version.rb +1 -1
- metadata +2 -2
data/Gemfile.lock
CHANGED
@@ -24,15 +24,29 @@ class SystemVm < CloudstackNagios::Base
|
|
24
24
|
end
|
25
25
|
|
26
26
|
desc "cpu", "check memory on host"
|
27
|
+
option :mode,
|
28
|
+
desc: "average mode gives the average value over all CPU's and max the highest usage of any CPU",
|
29
|
+
:enum => %w(average max),
|
30
|
+
aliases: '-m',
|
31
|
+
default: 'average'
|
27
32
|
def cpu
|
28
33
|
begin
|
29
34
|
host = systemvm_host
|
30
35
|
mpstat_output = ""
|
31
36
|
on host do |h|
|
32
|
-
mpstat_output = capture(:mpstat)
|
37
|
+
mpstat_output = capture(:mpstat, '-P ALL', '2', '2')
|
33
38
|
end
|
34
|
-
values
|
35
|
-
|
39
|
+
# max takes the min idle value, removes zero values before
|
40
|
+
value = if options[:mode] == "max"
|
41
|
+
values = mpstat_output.each_line.to_a.slice(3..-1).map do |line, index|
|
42
|
+
line.scan(/\d+\.\d+/)[-1].to_f
|
43
|
+
end
|
44
|
+
values.delete(0.0)
|
45
|
+
values.min
|
46
|
+
else
|
47
|
+
mpstat_output.scan(/\d+\.\d+/)[-1].to_f
|
48
|
+
end
|
49
|
+
usage = 100 - value
|
36
50
|
data = check_data(100, usage, options[:warning], options[:critical])
|
37
51
|
puts "CPU #{RETURN_CODES[data[0]]} - usage = #{data[1]}% | usage=#{data[1]}%"
|
38
52
|
exit data[0]
|
@@ -11,6 +11,12 @@ define command {
|
|
11
11
|
register 1
|
12
12
|
}
|
13
13
|
|
14
|
+
define command {
|
15
|
+
command_name cs-nagios_check-cpu-max
|
16
|
+
command_line <%= bin_path -%>cs-nagios check router cpu -H $HOSTADDRESS$ --mode max -w $ARG1$ -c $ARG2$ --ssh-key <%= ssh_key %> --ssh-port <%= ssh_port %> --config <%= config_file %>
|
17
|
+
register 1
|
18
|
+
}
|
19
|
+
|
14
20
|
define command {
|
15
21
|
command_name cs-nagios_check-network
|
16
22
|
command_line <%= bin_path -%>cs-nagios check router network -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ --if-speed <%= if_speed %> --ssh-key <%= ssh_key %> --ssh-port <%= ssh_port %> --config <%= config_file %>
|
@@ -65,6 +71,15 @@ define service {
|
|
65
71
|
register 1
|
66
72
|
}
|
67
73
|
|
74
|
+
define service {
|
75
|
+
hostgroup_name CloudstackRouter
|
76
|
+
service_description Cloudstack Virtual Router Max CPU
|
77
|
+
display_name Cloudstack Virtual Router Max CPU
|
78
|
+
use Generic-Service,service-pnp
|
79
|
+
check_command cs-nagios_check-cpu-max!80!90
|
80
|
+
register 1
|
81
|
+
}
|
82
|
+
|
68
83
|
define service {
|
69
84
|
hostgroup_name CloudstackRouter
|
70
85
|
service_description Cloudstack Virtual Router Network
|
@@ -15,7 +15,7 @@ object CheckCommand "cs-nagios_check-memory" {
|
|
15
15
|
|
16
16
|
object CheckCommand "cs-nagios_check-cpu" {
|
17
17
|
import "plugin-check-command"
|
18
|
-
command = [ "<%= bin_path -%>cs-nagios", "check", "router", "cpu" ]
|
18
|
+
command = [ "<%= bin_path -%>cs-nagios", "check", "router", "cpu" ]
|
19
19
|
|
20
20
|
arguments = {
|
21
21
|
"-H" = "$address$"
|
@@ -27,6 +27,21 @@ object CheckCommand "cs-nagios_check-cpu" {
|
|
27
27
|
}
|
28
28
|
}
|
29
29
|
|
30
|
+
object CheckCommand "cs-nagios_check-cpu-max" {
|
31
|
+
import "plugin-check-command"
|
32
|
+
command = [ "<%= bin_path -%>cs-nagios", "check", "router", "cpu" ]
|
33
|
+
|
34
|
+
arguments = {
|
35
|
+
"-H" = "$address$"
|
36
|
+
"-m" = "max"
|
37
|
+
"-w" = "80"
|
38
|
+
"-c" = "90"
|
39
|
+
"--ssh_key" = "<%= ssh_key %>"
|
40
|
+
"--ssh-port" = "<%= ssh_port %>"
|
41
|
+
"--config" = "<%= config_file %>"
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
30
45
|
object CheckCommand "cs-nagios_check-network" {
|
31
46
|
import "plugin-check-command"
|
32
47
|
command = [ "<%= bin_path -%>cs-nagios", "check", "router", "network" ]
|
@@ -111,6 +126,12 @@ apply Service "Cloudstack Virtual Router CPU" {
|
|
111
126
|
assign where "CloudstackRouter" in host.groups
|
112
127
|
}
|
113
128
|
|
129
|
+
apply Service "Cloudstack Virtual Router Max CPU" {
|
130
|
+
import "generic-service-pnp"
|
131
|
+
check_command = "cs-nagios_check-cpu-max"
|
132
|
+
assign where "CloudstackRouter" in host.groups
|
133
|
+
}
|
134
|
+
|
114
135
|
apply Service "Cloudstack Virtual Router Network" {
|
115
136
|
import "generic-service-pnp"
|
116
137
|
check_command = "cs-nagios_check-network"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudstack-nagios
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.17.
|
4
|
+
version: 0.17.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2015-01-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rdoc
|