From 37d504a0397e78deb2b7ed54a7cda44dfb56d536 Mon Sep 17 00:00:00 2001 From: Tomas Edwardsson Date: Wed, 2 Apr 2014 15:34:07 +0000 Subject: [PATCH 01/23] Added okc-get_network_stat --- .../nagios-okplugin-get_network_stat.spec | 43 ++++++++++++ okc-get_network_stat/okc-get_network_stat | 65 +++++++++++++++++++ 2 files changed, 108 insertions(+) create mode 100644 okc-get_network_stat/nagios-okplugin-get_network_stat.spec create mode 100644 okc-get_network_stat/okc-get_network_stat diff --git a/okc-get_network_stat/nagios-okplugin-get_network_stat.spec b/okc-get_network_stat/nagios-okplugin-get_network_stat.spec new file mode 100644 index 0000000..e36d1ec --- /dev/null +++ b/okc-get_network_stat/nagios-okplugin-get_network_stat.spec @@ -0,0 +1,43 @@ +%define debug_package %{nil} + +Summary: A Nagios plugin to get network statistics over NRPE +Name: nagios-okplugin-get_network_stat +Version: 1.0.0 +Release: 1%{?dist} +License: GPLv2+ +Group: Applications/System +URL: https://github.com/opinkerfi/nagios-plugins/okc-get_network_stat +Source0: https://github.com/opinkerfi/nagios-plugins/okc-get_network_stat/%{name}-%{version}.tar.gz +Requires: nagios-plugins-nrpe +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +Packager: Tomas Edwardsson +BuildArch: noarch + + + +%description +A Nagios plugin to get network statistics over NRPE + + +%prep +%setup -q + +%build + + +%install +rm -rf %{buildroot} +install -D -p -m 0755 okc-get_network_stat %{buildroot}%{_libdir}/nagios/plugins/okc-get_network_stat + +%clean +rm -rf %{buildroot} + +%files +%defattr(-,root,root,-) +#%doc README LICENSE +#%{_libdir}/nagios/plugins/* +%{_libdir}/nagios/plugins/okc-get_network_stat + +%changelog +* Wed Apr 2 2014 Tomas Edwardsson 1.0.0-1 +- Initial release diff --git a/okc-get_network_stat/okc-get_network_stat b/okc-get_network_stat/okc-get_network_stat new file mode 100644 index 0000000..05cc498 --- /dev/null +++ b/okc-get_network_stat/okc-get_network_stat @@ -0,0 +1,65 @@ +#!/usr/bin/python + +from pynag.Plugins import PluginHelper, ok, warning, critical, unknown +from pynag.Utils import runCommand +import re + +helper = PluginHelper() + +helper.parser.add_option("-H", help="Host to connect to", dest="host", default='localhost') + +helper.parse_arguments() + +if helper.options.host == "localhost": + command="cat /proc/net/dev|sed 's/ */ /g'" +else: + command="/usr/lib64/nagios/plugins/check_nrpe -H '%s' -c get_network_interfaces" % helper.options.host + +return_code, stdout, stderr = runCommand(command) + +try: + receive, transmit = stdout.split("\n")[1].split("|")[1:] + receive = receive.split() + transmit = transmit.split() + + interfaces = [] + + for int_line in stdout.split("\n")[2:]: + int_line = int_line.strip() + if not int_line: + continue + + int_arr = re.split("[: ]+", int_line.strip()) + + interface = int_arr.pop(0) + + if interface == "lo" or interface.startswith('sit'): + continue + + interfaces.append(interface) + for i in range(0, len(receive)): + helper.add_metric( + label="%s_rx_%s" % (interface, receive[i]), + value=int_arr.pop(0), + uom="c") + for i in range(0, len(transmit)): + helper.add_metric( + label="%s_tx_%s" % (interface, transmit[i]), + value=int_arr.pop(0), + uom="c") + + helper.add_summary("Network interfaces %s" % ", ".join(interfaces)) + + # Here all metrics will be checked against thresholds that are either + # built-in or added via --threshold from the command-line + helper.check_all_metrics() + + # Print out plugin information and exit nagios-style + helper.exit(ok) +except Exception, error: + helper.status(unknown) + helper.add_summary(stdout + stderr) + helper.exit(unknown) + +# vim: sts=4 expandtab autoindent + From 7d9ba339bcb2c0f8436ec6ececb85cc8be031849 Mon Sep 17 00:00:00 2001 From: Tomas Edwardsson Date: Wed, 2 Apr 2014 15:34:19 +0000 Subject: [PATCH 02/23] Automatic commit of package [nagios-okplugin-get_network_stat] release [1.0.1-1]. --- okc-get_network_stat/nagios-okplugin-get_network_stat.spec | 5 ++++- rel-eng/packages/nagios-okplugin-get_network_stat | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 rel-eng/packages/nagios-okplugin-get_network_stat diff --git a/okc-get_network_stat/nagios-okplugin-get_network_stat.spec b/okc-get_network_stat/nagios-okplugin-get_network_stat.spec index e36d1ec..a0ccbf6 100644 --- a/okc-get_network_stat/nagios-okplugin-get_network_stat.spec +++ b/okc-get_network_stat/nagios-okplugin-get_network_stat.spec @@ -2,7 +2,7 @@ Summary: A Nagios plugin to get network statistics over NRPE Name: nagios-okplugin-get_network_stat -Version: 1.0.0 +Version: 1.0.1 Release: 1%{?dist} License: GPLv2+ Group: Applications/System @@ -39,5 +39,8 @@ rm -rf %{buildroot} %{_libdir}/nagios/plugins/okc-get_network_stat %changelog +* Wed Apr 02 2014 Tomas Edwardsson 1.0.1-1 +- new package built with tito + * Wed Apr 2 2014 Tomas Edwardsson 1.0.0-1 - Initial release diff --git a/rel-eng/packages/nagios-okplugin-get_network_stat b/rel-eng/packages/nagios-okplugin-get_network_stat new file mode 100644 index 0000000..7361333 --- /dev/null +++ b/rel-eng/packages/nagios-okplugin-get_network_stat @@ -0,0 +1 @@ +1.0.1-1 okc-get_network_stat/ From e5498e1554a1b4929bfdcf95c0f8862bab083269 Mon Sep 17 00:00:00 2001 From: Tomas Edwardsson Date: Wed, 2 Apr 2014 15:57:58 +0000 Subject: [PATCH 03/23] okc-get_network_stat, Bad nrpe command name --- okc-get_network_stat/okc-get_network_stat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/okc-get_network_stat/okc-get_network_stat b/okc-get_network_stat/okc-get_network_stat index 05cc498..c2297dd 100644 --- a/okc-get_network_stat/okc-get_network_stat +++ b/okc-get_network_stat/okc-get_network_stat @@ -13,7 +13,7 @@ helper.parse_arguments() if helper.options.host == "localhost": command="cat /proc/net/dev|sed 's/ */ /g'" else: - command="/usr/lib64/nagios/plugins/check_nrpe -H '%s' -c get_network_interfaces" % helper.options.host + command="/usr/lib64/nagios/plugins/check_nrpe -H '%s' -c get_network_interfaces_stat" % helper.options.host return_code, stdout, stderr = runCommand(command) From e5772ab33607a69bdffd4cb5e249908b60bbe066 Mon Sep 17 00:00:00 2001 From: Tomas Edwardsson Date: Fri, 4 Apr 2014 13:07:33 +0000 Subject: [PATCH 04/23] check_time - Added requirement for bc --- check_time/nagios-okplugin-check_time.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/check_time/nagios-okplugin-check_time.spec b/check_time/nagios-okplugin-check_time.spec index 6ff0e86..8725a32 100644 --- a/check_time/nagios-okplugin-check_time.spec +++ b/check_time/nagios-okplugin-check_time.spec @@ -9,6 +9,7 @@ Group: Applications/System URL: http://opensource.is/trac/wiki/check_time Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_time/releases/nagios-okplugin-check_time-%{version}.tar.gz Requires: nagios-nrpe +Requires: bc BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Packager: Pall Sigurdsson From 5f604b852fa99dd7301606b06d38421e7f4abea1 Mon Sep 17 00:00:00 2001 From: Tomas Edwardsson Date: Fri, 4 Apr 2014 13:10:38 +0000 Subject: [PATCH 05/23] Automatic commit of package [nagios-okplugin-check_time] release [1.0.3-1]. --- check_time/nagios-okplugin-check_time.spec | 5 ++++- rel-eng/packages/nagios-okplugin-check_time | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/check_time/nagios-okplugin-check_time.spec b/check_time/nagios-okplugin-check_time.spec index 8725a32..a7bcb87 100644 --- a/check_time/nagios-okplugin-check_time.spec +++ b/check_time/nagios-okplugin-check_time.spec @@ -2,7 +2,7 @@ Summary: A Nagios plugin to compare time on remote host with localhost Name: nagios-okplugin-check_time -Version: 1.0.2 +Version: 1.0.3 Release: 1%{?dist} License: GPLv2+ Group: Applications/System @@ -41,6 +41,9 @@ rm -rf %{buildroot} /etc/nrpe.d/check_time.cfg %changelog +* Fri Apr 04 2014 Tomas Edwardsson 1.0.3-1 +- check_time - Added requirement for bc (tommi@tommi.org) + * Tue Mar 25 2014 Tomas Edwardsson 1.0.2-1 - Bump version diff --git a/rel-eng/packages/nagios-okplugin-check_time b/rel-eng/packages/nagios-okplugin-check_time index 244cc02..c870b52 100644 --- a/rel-eng/packages/nagios-okplugin-check_time +++ b/rel-eng/packages/nagios-okplugin-check_time @@ -1 +1 @@ -1.0.2-1 check_time/ +1.0.3-1 check_time/ From 2049fbd692405974da8922ff33291fd44ef4241b Mon Sep 17 00:00:00 2001 From: Tomas Edwardsson Date: Fri, 4 Apr 2014 15:19:32 +0000 Subject: [PATCH 06/23] Automatic commit of package [nagios-okplugin-ipa] release [0.0.4-1]. --- check_ipa/nagios-okplugin-ipa.spec | 8 +++++++- rel-eng/packages/nagios-okplugin-ipa | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/check_ipa/nagios-okplugin-ipa.spec b/check_ipa/nagios-okplugin-ipa.spec index 17bc04a..cd69952 100644 --- a/check_ipa/nagios-okplugin-ipa.spec +++ b/check_ipa/nagios-okplugin-ipa.spec @@ -3,7 +3,7 @@ Summary: A Nagios plugin to check IPA server status Name: nagios-okplugin-%{plugin} -Version: 0.0.3 +Version: 0.0.4 Release: 1%{?dist} License: GPLv2+ Group: Applications/System @@ -42,6 +42,12 @@ rm -rf %{buildroot} %config(noreplace) %{_sysconfdir}/nrpe.d/check_ipa.cfg %changelog +* Fri Apr 04 2014 Tomas Edwardsson 0.0.4-1 +- Renamed to markdown (tommi@tommi.org) +- Added examples and documentation (tommi@tommi.org) +- Missing colon (tommi@tommi.org) +- Added missing OK when things worked out (tommi@tommi.org) + * Thu Apr 25 2013 Tomas Edwardsson 0.0.3-1 - Preliminary testing done, released - Various errors in syntax fixed (tommi@tommi.org) diff --git a/rel-eng/packages/nagios-okplugin-ipa b/rel-eng/packages/nagios-okplugin-ipa index 62fda9d..ab9b41f 100644 --- a/rel-eng/packages/nagios-okplugin-ipa +++ b/rel-eng/packages/nagios-okplugin-ipa @@ -1 +1 @@ -0.0.3-1 check_ipa/ +0.0.4-1 check_ipa/ From b481aadbd54334ba1f8f6bb793326e0101fa10dd Mon Sep 17 00:00:00 2001 From: Tomas Edwardsson Date: Sun, 13 Apr 2014 18:26:25 +0000 Subject: [PATCH 07/23] Automatic commit of package [nagios-okplugin-check_uptime] release [1.0.3-1]. --- check_uptime/nagios-okplugin-check_uptime.spec | 5 ++++- rel-eng/packages/nagios-okplugin-check_uptime | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/check_uptime/nagios-okplugin-check_uptime.spec b/check_uptime/nagios-okplugin-check_uptime.spec index 6d1df2c..e325e80 100644 --- a/check_uptime/nagios-okplugin-check_uptime.spec +++ b/check_uptime/nagios-okplugin-check_uptime.spec @@ -2,7 +2,7 @@ Summary: A Nagios plugin to check uptime of a remote host via NRPE Name: nagios-okplugin-check_uptime -Version: 1.0.2 +Version: 1.0.3 Release: 1%{?dist} License: GPLv2+ Group: Applications/System @@ -41,6 +41,9 @@ rm -rf %{buildroot} /etc/nrpe.d/check_uptime.cfg %changelog +* Sun Apr 13 2014 Tomas Edwardsson 1.0.3-1 +- Update tag + * Mon Dec 30 2013 Tomas Edwardsson 1.0.2-1 - Updated tag for build with newer tito diff --git a/rel-eng/packages/nagios-okplugin-check_uptime b/rel-eng/packages/nagios-okplugin-check_uptime index c87ad69..81b5895 100644 --- a/rel-eng/packages/nagios-okplugin-check_uptime +++ b/rel-eng/packages/nagios-okplugin-check_uptime @@ -1 +1 @@ -1.0.2-1 check_uptime/ +1.0.3-1 check_uptime/ From c414e17b30f9d1fe1e21a158fd676732eb219e2f Mon Sep 17 00:00:00 2001 From: Tomas Edwardsson Date: Sun, 13 Apr 2014 18:31:36 +0000 Subject: [PATCH 08/23] Added prodcution builder for fc20 --- rel-eng/releasers.conf | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/rel-eng/releasers.conf b/rel-eng/releasers.conf index 979fa02..98dddf4 100644 --- a/rel-eng/releasers.conf +++ b/rel-eng/releasers.conf @@ -1,11 +1,3 @@ -# Fedora FC20 -[test-fc20-x86_64] -releaser = tito.release.YumRepoReleaser -builder = tito.builder.MockBuilder -builder.mock = fedora-20-x86_64 -builder.test = 1 -rsync = tito@opensource.is:/var/www/sites/opensource.ok.is/repo/testing/fedora20/x86_64/ - # RHEL 6 Production [production-el6-x86_64] releaser = tito.release.YumRepoReleaser @@ -73,6 +65,23 @@ builder.test = 1 rsync = tito@opensource.is:/var/www/sites/opensource.ok.is/repo/testing/rhel6/i386/ +# Fedora FC20 +[production-fc20-x86_64] +releaser = tito.release.YumRepoReleaser +builder = tito.builder.MockBuilder +builder.mock = fedora-20-x86_64 +rsync = tito@opensource.is:/var/www/sites/opensource.ok.is/repo/fedora20/x86_64/ + +# Fedora FC20 +[test-fc20-x86_64] +releaser = tito.release.YumRepoReleaser +builder = tito.builder.MockBuilder +builder.mock = fedora-20-x86_64 +builder.test = 1 +rsync = tito@opensource.is:/var/www/sites/opensource.ok.is/repo/testing/fedora20/x86_64/ + + + # sources [production-tarballs] From a743def0c8dec80f2095e3d7001139a95d58b2a0 Mon Sep 17 00:00:00 2001 From: Tomas Edwardsson Date: Thu, 15 May 2014 11:09:52 +0000 Subject: [PATCH 09/23] hpacucli Missing !requiretty for sudo --- check_hpacucli/sudoers.d/check_hpacucli | 1 + 1 file changed, 1 insertion(+) diff --git a/check_hpacucli/sudoers.d/check_hpacucli b/check_hpacucli/sudoers.d/check_hpacucli index f966ff6..ca60b9e 100644 --- a/check_hpacucli/sudoers.d/check_hpacucli +++ b/check_hpacucli/sudoers.d/check_hpacucli @@ -1 +1,2 @@ +Defaults:nrpe !requiretty nrpe ALL=(ALL) NOPASSWD: /usr/lib64/nagios/plugins/check_hpacucli.py From 790619d8202d16181e204d4f661a211ee283f6b6 Mon Sep 17 00:00:00 2001 From: Tomas Edwardsson Date: Thu, 15 May 2014 11:13:53 +0000 Subject: [PATCH 10/23] Automatic commit of package [nagios-okplugin-check_hpasm] release [4.1.3-1]. --- check_hpasm/nagios-okplugin-check_hpasm.spec | 5 ++++- rel-eng/packages/nagios-okplugin-check_hpasm | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 rel-eng/packages/nagios-okplugin-check_hpasm diff --git a/check_hpasm/nagios-okplugin-check_hpasm.spec b/check_hpasm/nagios-okplugin-check_hpasm.spec index 0afde62..7dfc47c 100644 --- a/check_hpasm/nagios-okplugin-check_hpasm.spec +++ b/check_hpasm/nagios-okplugin-check_hpasm.spec @@ -2,7 +2,7 @@ Summary: A Nagios plugin to check HP Hardware Status Name: nagios-okplugin-check_hpasm -Version: 4.1.2 +Version: 4.1.3 Release: 1%{?dist} License: GPLv2+ Group: Applications/System @@ -45,5 +45,8 @@ rm -rf %{buildroot} /etc/nrpe.d/check_hpasm.cfg %changelog +* Thu May 15 2014 Tomas Edwardsson 4.1.3-1 +- new package built with tito + * Tue Jun 4 2013 Pall Sigurdsson 4.1.2-1 - Initial packaging diff --git a/rel-eng/packages/nagios-okplugin-check_hpasm b/rel-eng/packages/nagios-okplugin-check_hpasm new file mode 100644 index 0000000..bbe4412 --- /dev/null +++ b/rel-eng/packages/nagios-okplugin-check_hpasm @@ -0,0 +1 @@ +4.1.3-1 check_hpasm/ From 9862b3c0d9c3df55bbf4ae18ab66bc7ba6a94ea2 Mon Sep 17 00:00:00 2001 From: Tomas Edwardsson Date: Thu, 15 May 2014 11:22:13 +0000 Subject: [PATCH 11/23] hpasm invalid nrpe check command name --- check_hpasm/nrpe.d/check_hpasm.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_hpasm/nrpe.d/check_hpasm.cfg b/check_hpasm/nrpe.d/check_hpasm.cfg index ce32dc9..2bf4390 100644 --- a/check_hpasm/nrpe.d/check_hpasm.cfg +++ b/check_hpasm/nrpe.d/check_hpasm.cfg @@ -1,3 +1,3 @@ -command[check_updates]=sudo /usr/lib/nagios/plugins/check_hpasm +command[check_hpasm]=sudo /usr/lib/nagios/plugins/check_hpasm From d3f75ec93a49ded293daa5b6584fa4fe16e7ec87 Mon Sep 17 00:00:00 2001 From: Tomas Edwardsson Date: Thu, 15 May 2014 11:23:11 +0000 Subject: [PATCH 12/23] Changed release priority for rhel6 test build --- rel-eng/releasers.conf | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/rel-eng/releasers.conf b/rel-eng/releasers.conf index 98dddf4..d13a0bb 100644 --- a/rel-eng/releasers.conf +++ b/rel-eng/releasers.conf @@ -29,6 +29,21 @@ builder.mock = epel-5-i386 createrepo_command = createrepo -s sha1 . rsync = tito@opensource.is:/var/www/sites/opensource.ok.is/repo/rhel5/i386/ +# RHEL 6 Test +[test-el6-x86_64] +releaser = tito.release.YumRepoReleaser +builder = tito.builder.MockBuilder +builder.mock = epel-6-x86_64 +builder.test = 1 +rsync = tito@opensource.is:/var/www/sites/opensource.ok.is/repo/testing/rhel6/x86_64/ + +[test-el6-i386] +releaser = tito.release.YumRepoReleaser +builder = tito.builder.MockBuilder +builder.mock = epel-6-i386 +builder.test = 1 +rsync = tito@opensource.is:/var/www/sites/opensource.ok.is/repo/testing/rhel6/i386/ + # RHEL 5 Testing [test-el5-x86_64] @@ -49,21 +64,6 @@ createrepo_command = createrepo -s sha1 . rsync = tito@opensource.is:/var/www/sites/opensource.ok.is/repo/testing/rhel5/i386/ -# RHEL 6 Test -[test-el6-x86_64] -releaser = tito.release.YumRepoReleaser -builder = tito.builder.MockBuilder -builder.mock = epel-6-x86_64 -builder.test = 1 -rsync = tito@opensource.is:/var/www/sites/opensource.ok.is/repo/testing/rhel6/x86_64/ - -[test-el6-i386] -releaser = tito.release.YumRepoReleaser -builder = tito.builder.MockBuilder -builder.mock = epel-6-i386 -builder.test = 1 -rsync = tito@opensource.is:/var/www/sites/opensource.ok.is/repo/testing/rhel6/i386/ - # Fedora FC20 [production-fc20-x86_64] From c22b89893d15e9b60141ea16c68d36734029e934 Mon Sep 17 00:00:00 2001 From: Tomas Edwardsson Date: Thu, 15 May 2014 11:24:48 +0000 Subject: [PATCH 13/23] hpacucli Bad permissions on sudoers file --- check_hpacucli/nagios-okplugin-check_hpacucli.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_hpacucli/nagios-okplugin-check_hpacucli.spec b/check_hpacucli/nagios-okplugin-check_hpacucli.spec index d1e5811..aec41ac 100644 --- a/check_hpacucli/nagios-okplugin-check_hpacucli.spec +++ b/check_hpacucli/nagios-okplugin-check_hpacucli.spec @@ -28,7 +28,7 @@ perl -pi -e "s|/usr/lib64|%{_libdir}|g" sudoers.d/* rm -rf %{buildroot} install -D -p -m 0755 check_hpacucli.py %{buildroot}%{_libdir}/nagios/plugins/check_hpacucli.py install -D -p -m 0755 nrpe.d/check_hpacucli.cfg %{buildroot}/etc/nrpe.d/check_hpacucli.cfg -install -D -p -m 0755 sudoers.d/check_hpacucli %{buildroot}/etc/sudoers.d/check_hpacucli +install -D -p -m 0440 sudoers.d/check_hpacucli %{buildroot}/etc/sudoers.d/check_hpacucli %clean rm -rf %{buildroot} From f186de558536f4064403c4db1353f8d1c5d5c489 Mon Sep 17 00:00:00 2001 From: Tomas Edwardsson Date: Mon, 9 Jun 2014 22:42:22 +0000 Subject: [PATCH 14/23] Disable embedded perl --- check_apcext.pl/check_apcext.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/check_apcext.pl/check_apcext.pl b/check_apcext.pl/check_apcext.pl index e2e943c..612fded 100755 --- a/check_apcext.pl/check_apcext.pl +++ b/check_apcext.pl/check_apcext.pl @@ -1,4 +1,5 @@ #!/usr/bin/perl +# nagios: -epn # # check_apcext.pl - APC Extra gear monitoring plugin for Nagios # 05.02.07 Paul Venezia From 03f73898427769c49adc7ab900bac0f2f153ae07 Mon Sep 17 00:00:00 2001 From: Tomas Edwardsson Date: Mon, 9 Jun 2014 22:45:32 +0000 Subject: [PATCH 15/23] Automatic commit of package [nagios-okplugin-apc] release [2.1.2-1]. --- check_apcext.pl/nagios-okplugin-apc.spec | 5 ++++- rel-eng/packages/nagios-okplugin-apc | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/check_apcext.pl/nagios-okplugin-apc.spec b/check_apcext.pl/nagios-okplugin-apc.spec index 96335a0..089abe6 100644 --- a/check_apcext.pl/nagios-okplugin-apc.spec +++ b/check_apcext.pl/nagios-okplugin-apc.spec @@ -2,7 +2,7 @@ Summary: A Nagios plugin to check APC devices Name: nagios-okplugin-apc -Version: 2.1.1 +Version: 2.1.2 Release: 1%{?dist} License: GPLv2+ Group: Applications/System @@ -38,6 +38,9 @@ rm -rf %{buildroot} %{_libdir}/nagios/plugins/* %changelog +* Mon Jun 09 2014 Tomas Edwardsson 2.1.2-1 +- Disable embedded perl (tommi@tommi.org) + * Thu Mar 20 2014 Tomas Edwardsson 2.1.1-1 - Merge github.com:opinkerfi/misc (palli@opensource.is) - Use the right value for the job nbmstemp (tommi@tommi.org) diff --git a/rel-eng/packages/nagios-okplugin-apc b/rel-eng/packages/nagios-okplugin-apc index ae9b72b..7b73130 100644 --- a/rel-eng/packages/nagios-okplugin-apc +++ b/rel-eng/packages/nagios-okplugin-apc @@ -1 +1 @@ -2.1.1-1 check_apcext.pl/ +2.1.2-1 check_apcext.pl/ From cbcaa149977d71ef5e46795e754b94e9dd7db74c Mon Sep 17 00:00:00 2001 From: Tomas Edwardsson Date: Sat, 21 Jun 2014 16:51:15 +0000 Subject: [PATCH 16/23] Add metrics without updates for known types Closes #13 --- check_package_updates/check_package_updates | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/check_package_updates/check_package_updates b/check_package_updates/check_package_updates index cd6851a..83cbd9c 100644 --- a/check_package_updates/check_package_updates +++ b/check_package_updates/check_package_updates @@ -45,6 +45,11 @@ def main(): for pkg in pkg_updates[update_type]: p.add_long_output(" %s" % pkg) + for m in known_types: + m = m.lower() + if not p.get_metric(m): + p.add_metric(m, 0) + p.check_all_metrics() p.exit() From 1420e93c5c93c7b9da6f9202d7a7a72239ecde3b Mon Sep 17 00:00:00 2001 From: Tomas Edwardsson Date: Thu, 26 Jun 2014 13:04:50 +0000 Subject: [PATCH 17/23] Added lvm mirror checks --- check_lvm_mirror/check_lvm_mirror.py | 125 +++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 check_lvm_mirror/check_lvm_mirror.py diff --git a/check_lvm_mirror/check_lvm_mirror.py b/check_lvm_mirror/check_lvm_mirror.py new file mode 100644 index 0000000..776b5dd --- /dev/null +++ b/check_lvm_mirror/check_lvm_mirror.py @@ -0,0 +1,125 @@ +#!/usr/bin/python + +from pynag.Plugins import simple as Plugin, WARNING, CRITICAL, UNKNOWN, OK +from subprocess import Popen, PIPE +import os + +class PluginException(Exception): + pass + +def main(): + global plugin + + plugin = Plugin(must_threshold=False) + plugin.add_arg("l", "logical-volume", + "Comma seperated list of VG/LV, eg vg00/data,vg00/snap", + required=False) + plugin.add_arg("V", "volume-group", + "Comma seperated list of VG, eg vg00,vg01", + required=False) + plugin.add_arg("a", "check-all", "Check all LVs", required=False, + action="store_true") + plugin.activate() print lvs_output + + lvs = plugin["logical-volume"] and plugin["logical-volume"].split( + ",") or [] + vgs = plugin["volume-group"] and plugin["volume-group"].split(",") or [] + + if not lvs and not vgs and not plugin['check-all']: + plugin.parser.error( + "Either logical-volume or volume-group must be specified") + elif plugin['check-all'] and ( lvs or vgs ): + plugin.parser.error( + "Mixing check-all and logical-volume or volume-group does not make sense") + + check_mirror(lvs, vgs, plugin['check-all'], plugin['host']) + + (code, message) = (plugin.check_messages(joinallstr="\n")) + plugin.nagios_exit(code, message) + +def get_lv_list(hostname=None): + # Change lang setting for string consitency + env = os.environ.copy() + env['LC_ALL'] = 'C' + + # Remote execution + if hostname: + cmd = ['check_nrpe', '-H', hostname, '-c', 'get_lvm_mirrors'] + # Local + else: + cmd = ["lvs", "--separator", ";", "-o", + "vg_name,lv_name,lv_attr,copy_percent"] + # Execute lvs + ret = None + lvs_output = None + try: + lvs = Popen(cmd, stdout=PIPE, shell=False, env=env) + ret = lvs.wait() + lvs_output = lvs.stdout.readlines() + except Exception as error: + raise PluginException("Unable to execute lvs: %s" % error) + + if ret != 0: + raise PluginException("Bad return code from lvs command %i" % ret) + + logical_volume = parse_lvs(lvs_output) + +def parse_lvs(lvs_output): + all_lvs = [] + all_vgs = [] + + linenumber = 0 + for l in lvs_output: + linenumber += 1 + try: + vg_name, lv_name, lv_attr, copy_percent = l.strip().split(";") + except ValueError as error: + plugin.add_message(UNKNOWN, + "Unable to parse lvs line %i: %s\n%s" % ( + linenumber, error, l)) + continue + all_lvs.append("%s/%s" % (vg_name, lv_name)) + if vg_name not in all_vgs: + all_vgs.append(vg_name) + + if check_all or "%s/%s" % ( + vg_name, lv_name) in lv_list or vg_name in vg_list: + if lv_attr[0] != "m" and lv_attr[0] != "M": + plugin.add_message(CRITICAL, + "LV %s/%s not mirrored" % (vg_name, lv_name)) + elif lv_attr[2] != "a": + plugin.add_message(CRITICAL, + "LV %s/%s not active" % (vg_name, lv_name)) + elif lv_attr[5] != "o": + plugin.add_message(CRITICAL, + "LV %s/%s not open" % (vg_name, lv_name)) + elif float(copy_percent or 0) < 100: + plugin.add_message(WARNING, "LV %s/%s Copy Percent %s" % ( + vg_name, lv_name, copy_percent)) + else: + plugin.add_message(OK, "LV %s/%s functioning" % (vg_name, lv_name)) + +def check_mirror(lv_list, vg_list, check_all, hostname): + # Ensure the right locale for text parsing + """ + + :rtype : None + """ + + + # Loop through lvs output + + # Find lvs that were specified in cmd line but were not found via lvs + for v in vg_list: + if v not in all_vgs: + plugin.add_message(CRITICAL, "VG %s not found" % (v)) + + # Find lvs that were specified in cmd line but were not found via lvs + for l in lv_list: + if l not in all_lvs: + plugin.add_message(CRITICAL, "LV %s not found" % (l)) + +if __name__ == "__main__": + main() + + From 9060a171f082a3d689749074e203e87add371bb8 Mon Sep 17 00:00:00 2001 From: Tomas Edwardsson Date: Thu, 26 Jun 2014 13:06:45 +0000 Subject: [PATCH 18/23] Revert to working copy. --- check_lvm_mirror/check_lvm_mirror.py | 34 +++++++++++----------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/check_lvm_mirror/check_lvm_mirror.py b/check_lvm_mirror/check_lvm_mirror.py index 776b5dd..41d3632 100644 --- a/check_lvm_mirror/check_lvm_mirror.py +++ b/check_lvm_mirror/check_lvm_mirror.py @@ -4,8 +4,6 @@ from pynag.Plugins import simple as Plugin, WARNING, CRITICAL, UNKNOWN, OK from subprocess import Popen, PIPE import os -class PluginException(Exception): - pass def main(): global plugin @@ -19,7 +17,7 @@ def main(): required=False) plugin.add_arg("a", "check-all", "Check all LVs", required=False, action="store_true") - plugin.activate() print lvs_output + plugin.activate() lvs = plugin["logical-volume"] and plugin["logical-volume"].split( ",") or [] @@ -37,7 +35,13 @@ def main(): (code, message) = (plugin.check_messages(joinallstr="\n")) plugin.nagios_exit(code, message) -def get_lv_list(hostname=None): + +def check_mirror(lv_list, vg_list, check_all, hostname): + # Ensure the right locale for text parsing + """ + + :rtype : None + """ # Change lang setting for string consitency env = os.environ.copy() env['LC_ALL'] = 'C' @@ -56,18 +60,16 @@ def get_lv_list(hostname=None): lvs = Popen(cmd, stdout=PIPE, shell=False, env=env) ret = lvs.wait() lvs_output = lvs.stdout.readlines() - except Exception as error: - raise PluginException("Unable to execute lvs: %s" % error) + except Exception, e: + plugin.nagios_exit(UNKNOWN, "Unable to execute lvs: %s" % (e)) if ret != 0: - raise PluginException("Bad return code from lvs command %i" % ret) - - logical_volume = parse_lvs(lvs_output) - -def parse_lvs(lvs_output): + plugin.nagios_exit(CRITICAL, + "lvs execution failed, return code %i" % (ret)) all_lvs = [] all_vgs = [] + # Loop through lvs output linenumber = 0 for l in lvs_output: linenumber += 1 @@ -99,16 +101,6 @@ def parse_lvs(lvs_output): else: plugin.add_message(OK, "LV %s/%s functioning" % (vg_name, lv_name)) -def check_mirror(lv_list, vg_list, check_all, hostname): - # Ensure the right locale for text parsing - """ - - :rtype : None - """ - - - # Loop through lvs output - # Find lvs that were specified in cmd line but were not found via lvs for v in vg_list: if v not in all_vgs: From bf0edd899b9e25b6a50ac40e11e0c2a42a2b00c8 Mon Sep 17 00:00:00 2001 From: Tomas Edwardsson Date: Thu, 28 Aug 2014 11:33:30 +0000 Subject: [PATCH 19/23] Regex filtering broke disk checks --- check_disks.pl/check_disks.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/check_disks.pl/check_disks.pl b/check_disks.pl/check_disks.pl index 2c1494a..a86805a 100755 --- a/check_disks.pl/check_disks.pl +++ b/check_disks.pl/check_disks.pl @@ -251,10 +251,10 @@ if ($ret > 1) { # foreach my $l (@output) { + next if ($l =~ m/$opt_R/); + next if ($l !~ m/$opt_r/); + next if ($l =~ m/$exclude_re/); if($l =~ /(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\%\s+([\/\w\d\.-]+)$/) { - next if ($l =~ m/$opt_R/); - next if ($l !~ m/$opt_r/); - next if ($l =~ m/$exclude_re/); my ($s,$u,$f,$pu,$d) = ($1,$2,$3,$4,$5); $alldisks{$d}->{pused} = $pu; $alldisks{$d}->{pfree} = 100-$pu; @@ -268,10 +268,10 @@ foreach my $l (@output) { # This is the output of df.exe on Windows #C:\ 9097126 6094081 3003045 67% argon-c (ntfs) else { - if ($l =~ /(\w)\:\\\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\%\s+(.*)$/) { next if ($l =~ m/$opt_R/); next if ($l !~ m/$opt_r/); next if ($l =~ m/$exclude_re/); + if ($l =~ /(\w)\:\\\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\%\s+(.*)$/) { my ($d,$s,$u,$f,$pu) = ("/$1",$2,$3,$4,$5); $alldisks{$d}->{pused} = $pu; $alldisks{$d}->{pfree} = 100-$pu; From 7ab36cbc6631140eb71c1ddbc8beae155e81b290 Mon Sep 17 00:00:00 2001 From: Tomas Edwardsson Date: Wed, 3 Sep 2014 07:57:38 +0000 Subject: [PATCH 20/23] Added rhel7 releaser --- rel-eng/releasers.conf | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/rel-eng/releasers.conf b/rel-eng/releasers.conf index d13a0bb..ad62be7 100644 --- a/rel-eng/releasers.conf +++ b/rel-eng/releasers.conf @@ -1,3 +1,19 @@ +# RHEL 7 Production +[production-el7-x86_64] +releaser = tito.release.YumRepoReleaser +builder = tito.builder.MockBuilder +builder.mock = epel-7-x86_64 +rsync = tito@opensource.is:/var/www/sites/opensource.ok.is/repo/rhel7/x86_64/ + +# RHEL 7 Test +[test-el7-x86_64] +releaser = tito.release.YumRepoReleaser +builder = tito.builder.MockBuilder +builder.mock = epel-7-x86_64 +builder.test = 1 +rsync = tito@opensource.is:/var/www/sites/opensource.ok.is/repo/testing/rhel7/x86_64/ + + # RHEL 6 Production [production-el6-x86_64] releaser = tito.release.YumRepoReleaser From f23ac92b641b242550117d0ca66538c86560a280 Mon Sep 17 00:00:00 2001 From: Tomas Edwardsson Date: Fri, 3 Oct 2014 10:27:52 +0000 Subject: [PATCH 21/23] Automatic commit of package [nagios-okplugin-check_hpasm] release [4.1.4-1]. --- check_hpasm/nagios-okplugin-check_hpasm.spec | 5 ++++- rel-eng/packages/nagios-okplugin-check_hpasm | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/check_hpasm/nagios-okplugin-check_hpasm.spec b/check_hpasm/nagios-okplugin-check_hpasm.spec index 7dfc47c..3f643c8 100644 --- a/check_hpasm/nagios-okplugin-check_hpasm.spec +++ b/check_hpasm/nagios-okplugin-check_hpasm.spec @@ -2,7 +2,7 @@ Summary: A Nagios plugin to check HP Hardware Status Name: nagios-okplugin-check_hpasm -Version: 4.1.3 +Version: 4.1.4 Release: 1%{?dist} License: GPLv2+ Group: Applications/System @@ -45,6 +45,9 @@ rm -rf %{buildroot} /etc/nrpe.d/check_hpasm.cfg %changelog +* Fri Oct 03 2014 Tomas Edwardsson 4.1.4-1 +- hpasm invalid nrpe check command name (tommi@tommi.org) + * Thu May 15 2014 Tomas Edwardsson 4.1.3-1 - new package built with tito diff --git a/rel-eng/packages/nagios-okplugin-check_hpasm b/rel-eng/packages/nagios-okplugin-check_hpasm index bbe4412..9b0118a 100644 --- a/rel-eng/packages/nagios-okplugin-check_hpasm +++ b/rel-eng/packages/nagios-okplugin-check_hpasm @@ -1 +1 @@ -4.1.3-1 check_hpasm/ +4.1.4-1 check_hpasm/ From c8e7fbbff849d20fa684b627a961049f4af77c3e Mon Sep 17 00:00:00 2001 From: Tomas Edwardsson Date: Wed, 29 Oct 2014 23:42:42 +0000 Subject: [PATCH 22/23] Fix invalid regex if mountpoint has . in path --- check_disks.pl/check_disks.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_disks.pl/check_disks.pl b/check_disks.pl/check_disks.pl index a86805a..82725da 100755 --- a/check_disks.pl/check_disks.pl +++ b/check_disks.pl/check_disks.pl @@ -324,7 +324,7 @@ if($opt_f) { if(defined($alldisks{$f})) { $checkdisks{$f}=$alldisks{$f}; } - } elsif ($f =~ /([\/\w\d]+)\:(\w+)\:(\w+)/) { + } elsif ($f =~ /^(.+?)\:(\w+)\:(\w+)/) { if(defined($alldisks{$1})) { $checkdisks{$1}=$alldisks{$1}; updateRates($1,$2,$3,$checkdisks{$1}->{somme}); From f986b73474c20b10f4150a0e5de9c4e577d950f3 Mon Sep 17 00:00:00 2001 From: Tomas Edwardsson Date: Wed, 29 Oct 2014 23:45:26 +0000 Subject: [PATCH 23/23] Automatic commit of package [nagios-okplugin-check_disks] release [1.0.7-1]. --- check_disks.pl/nagios-okplugin-check_disks.spec | 6 +++++- rel-eng/packages/nagios-okplugin-check_disks | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/check_disks.pl/nagios-okplugin-check_disks.spec b/check_disks.pl/nagios-okplugin-check_disks.spec index 9369dad..c5b3136 100644 --- a/check_disks.pl/nagios-okplugin-check_disks.spec +++ b/check_disks.pl/nagios-okplugin-check_disks.spec @@ -2,7 +2,7 @@ Summary: A Nagios plugin to check disks via NRPE Name: nagios-okplugin-check_disks -Version: 1.0.6 +Version: 1.0.7 Release: 1%{?dist} License: GPLv2+ Group: Applications/System @@ -40,6 +40,10 @@ rm -rf %{buildroot} %{_libdir}/nagios/plugins/check_disks.pl %changelog +* Wed Oct 29 2014 Tomas Edwardsson 1.0.7-1 +- Fix invalid regex if mountpoint has . in path (tommi@tommi.org) +- Regex filtering broke disk checks (tommi@tommi.org) + * Tue Mar 25 2014 Tomas Edwardsson 1.0.6-1 - Bumped version diff --git a/rel-eng/packages/nagios-okplugin-check_disks b/rel-eng/packages/nagios-okplugin-check_disks index d2f118f..346dd92 100644 --- a/rel-eng/packages/nagios-okplugin-check_disks +++ b/rel-eng/packages/nagios-okplugin-check_disks @@ -1 +1 @@ -1.0.6-1 check_disks.pl/ +1.0.7-1 check_disks.pl/