cloudstack-nagios 0.12.3 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +6 -6
- data/README.md +2 -2
- data/lib/cloudstack-nagios/commands/router.rb +10 -7
- data/lib/cloudstack-nagios/files/create_cs_router_config.sh +56 -0
- data/lib/cloudstack-nagios/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd79f250d420ee0506a8efdafd3b92f79070ef7d
|
4
|
+
data.tar.gz: 0419a67d851a0b97d598bdf6968713f1a157dd8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f6f08315d50ef0559d759b1a2b83f3c250f5bd457036d91caa76c2b0032fbb8e142c6f849090c1679b019c210b168d3fc4a7ff70f7b914e6613f0569b980070
|
7
|
+
data.tar.gz: b13037841df8235e9970102d3f2fc3692e54a80d8d9a30700405be68f65d52c7894ac895537c5e0bb5dcfd7ea4fe1927f59d4792f110e1771482148476847375
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cloudstack-nagios (0.
|
4
|
+
cloudstack-nagios (0.13.0)
|
5
5
|
cloudstack_client (~> 0.5, >= 0.5.0)
|
6
6
|
erubis (~> 2.7.0)
|
7
7
|
highline (~> 1.6.20)
|
@@ -11,14 +11,14 @@ PATH
|
|
11
11
|
GEM
|
12
12
|
remote: https://rubygems.org/
|
13
13
|
specs:
|
14
|
-
cloudstack_client (0.6.
|
14
|
+
cloudstack_client (0.6.4)
|
15
15
|
erubis (2.7.0)
|
16
16
|
highline (1.6.21)
|
17
17
|
json (1.8.1)
|
18
|
-
net-scp (1.2.
|
18
|
+
net-scp (1.2.1)
|
19
19
|
net-ssh (>= 2.6.5)
|
20
|
-
net-ssh (2.
|
21
|
-
rake (10.3.
|
20
|
+
net-ssh (2.9.1)
|
21
|
+
rake (10.3.2)
|
22
22
|
rdoc (4.1.1)
|
23
23
|
json (~> 1.4)
|
24
24
|
sshkit (1.3.0)
|
@@ -28,7 +28,7 @@ GEM
|
|
28
28
|
term-ansicolor (1.3.0)
|
29
29
|
tins (~> 1.0)
|
30
30
|
thor (0.19.1)
|
31
|
-
tins (1.1
|
31
|
+
tins (1.3.1)
|
32
32
|
|
33
33
|
PLATFORMS
|
34
34
|
ruby
|
data/README.md
CHANGED
@@ -12,7 +12,7 @@ The following checks are supported:
|
|
12
12
|
|
13
13
|
* Cloudstack Root Admin keys have to be used.
|
14
14
|
* In order to connect to system VMs the private ssh key found on the Cloudstack management server under /var/lib/cloud/management/.ssh/id_rsa are required.
|
15
|
-
* The system vms must be reachable over SSH (default port 3922) from the nagios server executing the checks (check with 'ssh -i /var/lib/cloud/management/.ssh/id_rsa -p 3922 <router_mgmt_ip>').
|
15
|
+
* The system vms must be reachable on the Cloudstack Management Network over SSH (default port 3922) from the nagios server executing the checks (check with 'ssh -i /var/lib/cloud/management/.ssh/id_rsa -p 3922 <router_mgmt_ip>').
|
16
16
|
|
17
17
|
## Installation
|
18
18
|
|
@@ -152,4 +152,4 @@ $ cs-nagios check async_jobs
|
|
152
152
|
|
153
153
|
## License
|
154
154
|
|
155
|
-
Released under the MIT License. See the [LICENSE](https://bitbucket.org/swisstxt/cloudstack-cli/raw/master/LICENSE.txt) file for further details.
|
155
|
+
Released under the MIT License. See the [LICENSE](https://bitbucket.org/swisstxt/cloudstack-cli/raw/master/LICENSE.txt) file for further details.
|
@@ -32,7 +32,7 @@ class Router < CloudstackNagios::Base
|
|
32
32
|
mpstat_output = capture(:mpstat)
|
33
33
|
end
|
34
34
|
values = mpstat_output.scan(/\d+\.\d+/)
|
35
|
-
usage = 100 - values[-1].to_f
|
35
|
+
usage = 100 - values[-1].to_f
|
36
36
|
data = check_data(100, usage, options[:warning], options[:critical])
|
37
37
|
puts "CPU #{RETURN_CODES[data[0]]} - usage = #{data[1]}% | usage=#{data[1]}%"
|
38
38
|
exit data[0]
|
@@ -45,17 +45,20 @@ class Router < CloudstackNagios::Base
|
|
45
45
|
def rootfs_rw
|
46
46
|
begin
|
47
47
|
host = systemvm_host
|
48
|
-
|
48
|
+
test_file = '/rootdiskcheck.txt'
|
49
|
+
rootfs_rw = false
|
49
50
|
on host do |h|
|
50
|
-
|
51
|
+
rootfs_rw = execute(:touch, test_file)
|
52
|
+
execute(:rm, '-f', test_file)
|
51
53
|
end
|
52
|
-
|
53
|
-
|
54
|
-
puts "ROOTFS_RW #{rootfs_rw ? 'OK - rootfs writeable' : 'CRITICAL - rootfs NOT writeable'}"
|
55
|
-
exit status
|
54
|
+
rescue SSHKit::Command::Failed
|
55
|
+
rootfs_rw = false
|
56
56
|
rescue => e
|
57
57
|
exit_with_failure(e)
|
58
58
|
end
|
59
|
+
status = rootfs_rw ? 0 : 2
|
60
|
+
puts "ROOTFS_RW #{rootfs_rw ? 'OK - rootfs writeable' : 'CRITICAL - rootfs NOT writeable'}"
|
61
|
+
exit status
|
59
62
|
end
|
60
63
|
|
61
64
|
desc "disk_usage", "check the disk space usage of the root volume"
|
@@ -0,0 +1,56 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
# Create Icinga Configuration upon CS router changes
|
3
|
+
# Add this script in crontab
|
4
|
+
|
5
|
+
date=`date +%Y%m%d%H%M`
|
6
|
+
|
7
|
+
config_path=/var/icinga/.cloudstack-nagios.yml
|
8
|
+
bin_path=/usr/local/bin/
|
9
|
+
icinga_dir=/etc/icinga/dynamic_hosts
|
10
|
+
ssh_key=/var/icinga/cloud/management/.ssh/id_rsa
|
11
|
+
|
12
|
+
#Create Icinga Cloudstack Configuration
|
13
|
+
echo "generate hostgroups"
|
14
|
+
/usr/local/bin/cs-nagios nagios_config generate hostgroups --config $config_path --ssh-key $ssh_key --bin_path $bin_path | grep -v Date > /var/icinga/core/dynamic_hosts/cloudstack_hostgroups.cfg
|
15
|
+
echo "generate router_hosts"
|
16
|
+
/usr/local/bin/cs-nagios nagios_config generate router_hosts --config $config_path --ssh-key $ssh_key --bin_path $bin_path | grep -v Date > /var/icinga/core/dynamic_hosts/cloudstack_router_hosts.cfg
|
17
|
+
echo "generate router_services"
|
18
|
+
/usr/local/bin/cs-nagios nagios_config generate router_services --config $config_path --ssh-key $ssh_key --bin_path $bin_path --if-speed 1000000000 | grep -v Date > /var/icinga/core/dynamic_hosts/cloudstack_router_services.cfg
|
19
|
+
echo "generate zone_hosts"
|
20
|
+
/usr/local/bin/cs-nagios nagios_config generate zone_hosts --config $config_path --ssh-key $ssh_key --bin-path $bin_path | grep -v Date > /var/icinga/core/dynamic_hosts/cloudstack_zone_hosts.cfg
|
21
|
+
echo "generate storage_pools"
|
22
|
+
/usr/local/bin/cs-nagios nagios_config generate storage_pools --config $config_path --ssh-key $ssh_key --bin_path $bin_path --over_provisioning 2.0 | grep -v Date > /var/icinga/core/dynamic_hosts/cloudstack_storage_pools.cfg
|
23
|
+
echo "generate capacities"
|
24
|
+
/usr/local/bin/cs-nagios nagios_config generate capacities --config $config_path --ssh-key $ssh_key --bin_path $bin_path | grep -v Date > /var/icinga/core/dynamic_hosts/cloudstack_capacity.cfg
|
25
|
+
echo "generate async_jobs"
|
26
|
+
/usr/local/bin/cs-nagios nagios_config generate async_jobs --config $config_path --ssh-key $ssh_key --bin_path $bin_path | grep -v Date > /var/icinga/core/dynamic_hosts/cloudstack_async_jobs.cfg
|
27
|
+
|
28
|
+
|
29
|
+
#Check if gengerated configuration is valid
|
30
|
+
/usr/bin/icinga -vp /var/icinga/core/icingalocaltest.cfg > /dev/null 2>&1
|
31
|
+
|
32
|
+
if [ $? -eq 0 ]
|
33
|
+
then
|
34
|
+
### check if services have changed
|
35
|
+
diff -r /var/icinga/core/dynamic_hosts /etc/icinga/dynamic_hosts > /dev/null 2>&1
|
36
|
+
### if config is changed copy files
|
37
|
+
if [ $? -eq 1 ]
|
38
|
+
then
|
39
|
+
echo "Config Changed, updating now"
|
40
|
+
cp -rp /etc/icinga/dynamic_hosts /etc/icinga/dynamic_hosts.$date
|
41
|
+
rm -rf /etc/icinga/dynamic_hosts/*
|
42
|
+
cp -rp /var/icinga/core/dynamic_hosts /etc/icinga/
|
43
|
+
/usr/bin/icinga -vp /etc/icinga/icinga.cfg > /dev/null 2>&1
|
44
|
+
if [ $? -eq 0 ]; then
|
45
|
+
echo "Config reloaded, please reload icinga (script ready for auto reload)"
|
46
|
+
/etc/init.d/icinga reload
|
47
|
+
else
|
48
|
+
echo "Problem with Global Nagios Configuration, try /usr/bin/icinga -vp /etc/icinga/icinga.cfg"
|
49
|
+
fi
|
50
|
+
else
|
51
|
+
echo "Cloudstack Icinga Configuration not changed, nothing to do"
|
52
|
+
fi
|
53
|
+
|
54
|
+
else
|
55
|
+
echo "Problem with new Cloudstack Icinga Checks, try /usr/bin/icinga -vp /var/icinga/core/icingalocaltest.cfg"
|
56
|
+
fi
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudstack-nagios
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nik Wolfgramm
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdoc
|
@@ -138,6 +138,7 @@ files:
|
|
138
138
|
- lib/cloudstack-nagios/commands/nagios_config.rb
|
139
139
|
- lib/cloudstack-nagios/commands/router.rb
|
140
140
|
- lib/cloudstack-nagios/commands/snmpd_config.rb
|
141
|
+
- lib/cloudstack-nagios/files/create_cs_router_config.sh
|
141
142
|
- lib/cloudstack-nagios/files/snmpd.conf
|
142
143
|
- lib/cloudstack-nagios/helper.rb
|
143
144
|
- lib/cloudstack-nagios/templates/cloudstack_async_jobs.cfg.erb
|