diff --git a/roles/nagios_client/files/scripts/check_testcloud b/roles/nagios_client/files/scripts/check_testcloud new file mode 100644 index 0000000000..eb8c7aab3b --- /dev/null +++ b/roles/nagios_client/files/scripts/check_testcloud @@ -0,0 +1,19 @@ +#!/bin/bash + +RUNNING_VMS=`testcloud instance list | grep -i 'running' | wc -l` +CRITICAL=20 +WARNING=15 + + +if [ $RUNNING_VMS -gt $CRITICAL ] +then + echo "Testcloud: CRITICAL Number of VMs running: $RUNNING_VMS" + exit 2 +elif [ $RUNNING_VMS -gt $WARNING ] +then + echo "Testcloud: WARNING Number of VMs running: $RUNNING_VMS" + exit 1 +else + echo "Testcloud: OK Number of VMs running: $RUNNING_VMS" + exit 0 +fi diff --git a/roles/nagios_client/tasks/main.yml b/roles/nagios_client/tasks/main.yml index a45c231499..fb172929c9 100644 --- a/roles/nagios_client/tasks/main.yml +++ b/roles/nagios_client/tasks/main.yml @@ -54,6 +54,7 @@ - check_memcache_connect - check_readonly_fs - check_lock_file_age + - check_testcloud when: not inventory_hostname.startswith('noc') tags: - nagios_client @@ -121,6 +122,7 @@ - check_koschei_resolver_proc.cfg - check_koschei_scheduler_proc.cfg - check_koschei_watcher_proc.cfg + - check_testcloud.cfg notify: - restart nrpe tags: diff --git a/roles/nagios_client/templates/check_testcloud.cfg.j2 b/roles/nagios_client/templates/check_testcloud.cfg.j2 new file mode 100644 index 0000000000..25a314f2b1 --- /dev/null +++ b/roles/nagios_client/templates/check_testcloud.cfg.j2 @@ -0,0 +1 @@ +command[check_testcloud]={{ libdir }}/nagios/plugins/check_testcloud