[packages/nagios-plugin-check_vserver_count] nagios plugin to check running vserver count
glen
glen at pld-linux.org
Sat Sep 29 11:28:43 CEST 2012
commit b0b448171b890dcfcb3bc96730cdb5b8faa6a5c8
Author: Elan Ruusamäe <glen at delfi.ee>
Date: Sat Sep 29 12:28:17 2012 +0300
nagios plugin to check running vserver count
check_vserver_count.cfg | 34 ++++++++++++++++++++++++++
check_vserver_count.sh | 12 ++++++++++
nagios-plugin-check_vserver_count.spec | 44 ++++++++++++++++++++++++++++++++++
3 files changed, 90 insertions(+)
---
diff --git a/nagios-plugin-check_vserver_count.spec b/nagios-plugin-check_vserver_count.spec
new file mode 100644
index 0000000..b4f71a6
--- /dev/null
+++ b/nagios-plugin-check_vserver_count.spec
@@ -0,0 +1,44 @@
+# $Revision: 1.17 $, $Date: 2011/12/22 13:16:57 $
+%define plugin check_vserver_count
+Summary: Nagios plugin to check vserver count
+Name: nagios-plugin-%{plugin}
+Version: 0.1
+Release: 1
+License: GPL v2
+Group: Networking
+Source0: %{plugin}.sh
+Source1: %{plugin}.cfg
+Requires: nagios-common
+BuildArch: noarch
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%define _sysconfdir /etc/nagios/plugins
+%define plugindir %{_prefix}/lib/nagios/plugins
+
+%description
+Nagios plugin to check vserver count. registered via startup mark and
+actually running count.
+
+%prep
+%setup -qcT
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{plugindir}}
+install -p %{SOURCE0} $RPM_BUILD_ROOT%{plugindir}/%{plugin}
+cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/%{plugin}.cfg
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{plugin}.cfg
+%attr(755,root,root) %{plugindir}/%{plugin}
+
+%define date %(echo `LC_ALL="C" date +"%a %b %d %Y"`)
+%changelog
+* %{date} PLD Team <feedback at pld-linux.org>
+All persons listed below can be reached at <cvs_login>@pld-linux.org
+
+$Log: nagios-plugin.spec,v $
diff --git a/check_vserver_count.cfg b/check_vserver_count.cfg
new file mode 100644
index 0000000..68b9bdc
--- /dev/null
+++ b/check_vserver_count.cfg
@@ -0,0 +1,34 @@
+# Usage:
+# check_vserver_count
+define command {
+ command_name check_vserver_count
+ command_line /usr/lib/nagios/plugins/check_vserver_count $ARG1$
+}
+
+# service template
+define service {
+ use generic-service
+ name vserver-count
+ service_description vserver-count
+ register 0
+
+ normal_check_interval 30
+ retry_check_interval 5
+ notification_interval 3600
+
+ check_command check_vserver_count
+}
+
+# sample check
+#define service {
+# use vserver-count
+# host_name localhost
+#}
+#
+# sample check via nrpe
+#define service {
+# use vserver-count
+# hostgroups linux-servers
+# host_name localhost
+# check_command check_nrpe!-c check_vserver_count
+#}
diff --git a/check_vserver_count.sh b/check_vserver_count.sh
new file mode 100755
index 0000000..fc67661
--- /dev/null
+++ b/check_vserver_count.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+shouldrun=$(grep . /etc/vservers/*/apps/init/mark |wc -l)
+running=$(awk '/Active/{ print $2 }' /proc/virtual/status)
+
+if [ $shouldrun = $running ]
+then
+ echo "OK: running $running out of $shouldrun vservers"
+ exit 0
+else
+ echo "CRITICAL: running $running out of $shouldrun vservers"
+ exit 2
+fi
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/nagios-plugin-check_vserver_count.git/commitdiff/b0b448171b890dcfcb3bc96730cdb5b8faa6a5c8
More information about the pld-cvs-commit
mailing list