From 1637f8f93b5c9319ebeecf379e31398730e75e48 Mon Sep 17 00:00:00 2001 From: Pall Sigurdsson Date: Thu, 23 Aug 2012 10:49:04 +0000 Subject: [PATCH 01/16] Automatic commit of package [nagios-okplugin-apc] release [2.1.0-1]. --- check_apcext.pl/nagios-okplugin-apc.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/check_apcext.pl/nagios-okplugin-apc.spec b/check_apcext.pl/nagios-okplugin-apc.spec index dcacd0c..9099ab1 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: 0.0.3 +Version: 2.1.0 Release: 1%{?dist} License: GPLv2+ Group: Applications/System @@ -38,6 +38,10 @@ rm -rf %{buildroot} %{_libdir}/nagios/plugins/* %changelog +* Thu Aug 23 2012 Pall Sigurdsson 2.1.0-1 +- Version number bumped to 2.1.0 (palli@opensource.is) +- Added noarch buildarch (tommi@tommi.org) + * Mon Mar 12 2012 Pall Sigurdsson 0.0.3-1 - new package built with tito From 626ec4f2b90c1a161005871a6b8aedf8123dc3df Mon Sep 17 00:00:00 2001 From: Pall Sigurdsson Date: Thu, 23 Aug 2012 10:49:43 +0000 Subject: [PATCH 02/16] Automatic commit of package [nagios-okplugin-check_eva] release [1.0.2-1]. --- check_eva/nagios-okplugin-check_eva.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/check_eva/nagios-okplugin-check_eva.spec b/check_eva/nagios-okplugin-check_eva.spec index f3f8d03..20f0862 100644 --- a/check_eva/nagios-okplugin-check_eva.spec +++ b/check_eva/nagios-okplugin-check_eva.spec @@ -2,7 +2,7 @@ Summary: A Nagios plugin to check HP EVA Disk Systems Name: nagios-okplugin-check_eva -Version: 1.0.1 +Version: 1.0.2 Release: 1%{?dist} License: GPLv2+ Group: Applications/System @@ -40,6 +40,10 @@ rm -rf %{buildroot} /etc/nrpe.d/check_eva.cfg %changelog +* Thu Aug 23 2012 Pall Sigurdsson 1.0.2-1 +- changed sssu subcommands from being singlequoted to doublequoted for windows + compatibility (palli@opensource.is) + * Mon Mar 12 2012 Pall Sigurdsson 1.0.1-1 - new package built with tito From 2ccd5989e37815cd8dca3debe9994a931d4bce19 Mon Sep 17 00:00:00 2001 From: Pall Sigurdsson Date: Thu, 23 Aug 2012 10:50:56 +0000 Subject: [PATCH 03/16] Automatic commit of package [nagios-plugins-check_cpu] release [1.0-1]. --- check_cpu.sh/nagios-plugins-check_cpu.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/check_cpu.sh/nagios-plugins-check_cpu.spec b/check_cpu.sh/nagios-plugins-check_cpu.spec index c4d48d6..4c1ae7e 100644 --- a/check_cpu.sh/nagios-plugins-check_cpu.spec +++ b/check_cpu.sh/nagios-plugins-check_cpu.spec @@ -2,7 +2,7 @@ Summary: A Nagios plugin to check CPU on Linux servers Name: nagios-plugins-check_cpu -Version: 0.3 +Version: 1.0 Release: 1%{?dist} License: GPLv2+ Group: Applications/System @@ -42,6 +42,10 @@ rm -rf %{buildroot} %changelog +* Thu Aug 23 2012 Pall Sigurdsson 1.0-1 +- Version number bumped +- Updates buildarch to noarch (tommi@tommi.org) + * Mon Mar 12 2012 Pall Sigurdsson 0.3-1 - new package built with tito From 4a98095f7ca36ba7c87fea1f1ca884d2a1dd3cf6 Mon Sep 17 00:00:00 2001 From: Pall Sigurdsson Date: Thu, 23 Aug 2012 10:51:54 +0000 Subject: [PATCH 04/16] Automatic commit of package [nagios-okplugin-check_nagios] release [1.1-1]. --- check_nagios/nagios-okplugin-check_nagios.spec | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/check_nagios/nagios-okplugin-check_nagios.spec b/check_nagios/nagios-okplugin-check_nagios.spec index 52fb999..1472db7 100644 --- a/check_nagios/nagios-okplugin-check_nagios.spec +++ b/check_nagios/nagios-okplugin-check_nagios.spec @@ -2,7 +2,7 @@ Summary: A set of Nagios plugins to check the health of a nagios host Name: nagios-okplugin-check_nagios -Version: 0.0.8 +Version: 1.1 Release: 1%{?dist} License: GPLv2+ Group: Applications/System @@ -40,6 +40,12 @@ rm -rf %{buildroot} /etc/nrpe.d/check_nagios.cfg %changelog +* Thu Aug 23 2012 Pall Sigurdsson 1.1-1 +- Version number bumped +- bugfix, check_nagios_needs_reload check for reload instead of reparse + (palli@opensource.is) +- fixed missing tempfile cleanup (root@manage.tr.is) + * Mon Mar 12 2012 Pall Sigurdsson 0.0.8-1 - LICENSE file added (palli@opensource.is) From 36db6b96613917b6d09729257edab2ceea173f89 Mon Sep 17 00:00:00 2001 From: Pall Sigurdsson Date: Thu, 23 Aug 2012 10:54:14 +0000 Subject: [PATCH 05/16] Automatic commit of package [nagios-okplugin-check_yum] release [0.7.4-1]. --- check_yum/nagios-okplugin-check_yum.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/check_yum/nagios-okplugin-check_yum.spec b/check_yum/nagios-okplugin-check_yum.spec index 5dfe989..e3404b8 100644 --- a/check_yum/nagios-okplugin-check_yum.spec +++ b/check_yum/nagios-okplugin-check_yum.spec @@ -2,7 +2,7 @@ Summary: Nagios plugin to test for Yum updates on RedHat/CentOS Linux. Name: nagios-okplugin-check_yum -Version: 0.7.3 +Version: 0.7.4 Release: 1%{?dist} License: GPLv2+ Group: Applications/System @@ -39,6 +39,9 @@ rm -rf %{buildroot} /etc/nrpe.d/check_yum.cfg %changelog +* Thu Aug 23 2012 Pall Sigurdsson 0.7.4-1 +- Merging with check_yum from code.google.com (palli@opensource.is) + * Mon Mar 12 2012 Pall Sigurdsson 0.7.3-1 - new package built with tito From 75511d21dace87e0b18c1797fb29988e538afcae Mon Sep 17 00:00:00 2001 From: Pall Sigurdsson Date: Thu, 23 Aug 2012 10:55:36 +0000 Subject: [PATCH 06/16] Automatic commit of package [nagios-okplugin-check_ibm_bladecenter] release [1.1.2-2]. --- .../nagios-okplugin-check_ibm_bladecenter.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/check_ibm_bladecenter/nagios-okplugin-check_ibm_bladecenter.spec b/check_ibm_bladecenter/nagios-okplugin-check_ibm_bladecenter.spec index 1b9826d..22cc247 100644 --- a/check_ibm_bladecenter/nagios-okplugin-check_ibm_bladecenter.spec +++ b/check_ibm_bladecenter/nagios-okplugin-check_ibm_bladecenter.spec @@ -3,7 +3,7 @@ Summary: A Nagios plugin to check IBM Bladecenters Name: nagios-okplugin-check_ibm_bladecenter Version: 1.1.2 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ Group: Applications/System URL: http://opensource.ok.is/trac/wiki/Nagios-OKPlugin-check_ibm_bladecenter @@ -40,6 +40,9 @@ rm -rf %{buildroot} #%config(noreplace) %{_sysconfdir}/nrpe.d/check_bond.cfg %changelog +* Thu Aug 23 2012 Pall Sigurdsson 1.1.2-2 +- rpm spec file added. version number bumped (palli@opensource.is) + * Tue Jul 17 2012 Pall Sigurdsson 1.0.0-1 - Initial packaging From 518372579a5be9b14e5707964c4e5df2ffba619a Mon Sep 17 00:00:00 2001 From: Pall Sigurdsson Date: Thu, 23 Aug 2012 10:56:08 +0000 Subject: [PATCH 07/16] Automatic commit of package [nagios-okplugin-check_hpacucli] release [1.2-1]. --- check_hpacucli/nagios-okplugin-check_hpacucli.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/check_hpacucli/nagios-okplugin-check_hpacucli.spec b/check_hpacucli/nagios-okplugin-check_hpacucli.spec index 2b56824..01eb0e2 100644 --- a/check_hpacucli/nagios-okplugin-check_hpacucli.spec +++ b/check_hpacucli/nagios-okplugin-check_hpacucli.spec @@ -2,7 +2,7 @@ Summary: A Nagios plugin to check HP Array with hpacucli Name: nagios-okplugin-check_hpacucli -Version: 0.0.3 +Version: 1.2 Release: 1%{?dist} License: GPLv2+ Group: Applications/System @@ -38,6 +38,9 @@ rm -rf %{buildroot} /etc/nrpe.d/check_hpacucli.cfg %changelog +* Thu Aug 23 2012 Pall Sigurdsson 1.2-1 +- check_command is now sudo'ed (palli@opensource.is) + * Mon Mar 12 2012 Pall Sigurdsson 0.0.3-1 - new package built with tito From 36e6dbe188f4d258bc72cf653c6bf248c93f8aa1 Mon Sep 17 00:00:00 2001 From: Pall Sigurdsson Date: Thu, 23 Aug 2012 10:58:21 +0000 Subject: [PATCH 08/16] Automatic commit of package [nagios-okplugin-mailblacklist] release [1.0-1]. --- check_bl/nagios-okplugin-mailblacklist.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/check_bl/nagios-okplugin-mailblacklist.spec b/check_bl/nagios-okplugin-mailblacklist.spec index 94715f7..fba7c95 100644 --- a/check_bl/nagios-okplugin-mailblacklist.spec +++ b/check_bl/nagios-okplugin-mailblacklist.spec @@ -2,7 +2,7 @@ Summary: A Nagios plugin to check SMTP blacklists Name: nagios-okplugin-mailblacklist -Version: 0.0.2 +Version: 1.0 Release: 1%{?dist} License: GPLv2+ Group: Applications/System @@ -38,6 +38,9 @@ rm -rf %{buildroot} %{_libdir}/nagios/plugins/* %changelog +* Thu Aug 23 2012 Pall Sigurdsson 1.0-1 +- Updated buildarch to noarch (tommi@tommi.org) + * Mon Mar 12 2012 Pall Sigurdsson 0.0.2-1 - new package built with tito From 89c8e69d1e53df1613974009cd7dd53d8162c3d8 Mon Sep 17 00:00:00 2001 From: Pall Sigurdsson Date: Thu, 23 Aug 2012 10:58:42 +0000 Subject: [PATCH 09/16] version number of scripts bumped --- check_cifs/check_cifs | 2 +- check_hpacucli/check_hpacucli.py | 2 +- check_ibm_bladecenter/check_ibm_bladecenter.py | 2 +- check_yum/check_yum | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/check_cifs/check_cifs b/check_cifs/check_cifs index 61ae2c1..044990f 100644 --- a/check_cifs/check_cifs +++ b/check_cifs/check_cifs @@ -23,7 +23,7 @@ use Nagios::Plugin; # Create the Nagios plugin object my $np = Nagios::Plugin->new( usage => "Usage: %s -H -u -p -s ", - version => "0.01", + version => "1.0", ); # Add valid arguments diff --git a/check_hpacucli/check_hpacucli.py b/check_hpacucli/check_hpacucli.py index 04d3257..2b5e3c4 100644 --- a/check_hpacucli/check_hpacucli.py +++ b/check_hpacucli/check_hpacucli.py @@ -26,7 +26,7 @@ debugging = False # No real need to change anything below here -version="1.0" +version="1.1" ok=0 warning=1 critical=2 diff --git a/check_ibm_bladecenter/check_ibm_bladecenter.py b/check_ibm_bladecenter/check_ibm_bladecenter.py index c48c558..4375e3b 100644 --- a/check_ibm_bladecenter/check_ibm_bladecenter.py +++ b/check_ibm_bladecenter/check_ibm_bladecenter.py @@ -22,7 +22,7 @@ # No real need to change anything below here -version="1.1.0" +version="1.1.2" ok=0 warning=1 critical=2 diff --git a/check_yum/check_yum b/check_yum/check_yum index 1b28309..96c5358 100755 --- a/check_yum/check_yum +++ b/check_yum/check_yum @@ -26,7 +26,7 @@ __author__ = "Hari Sekhon" __title__ = "Nagios plugin to check the YUM package management system for package updates." -__version__ = "0.7.3" +__version__ = "0.7.4" # Changes: # 0.7.2 Addes support for rhel6-style output (palli@opensource.is) From 8e7144c1a44dba31239906d485d101d436a1052e Mon Sep 17 00:00:00 2001 From: Pall Sigurdsson Date: Thu, 23 Aug 2012 10:59:23 +0000 Subject: [PATCH 10/16] Automatic commit of package [nagios-okplugin-check_yum] release [0.7.4-2]. --- check_yum/nagios-okplugin-check_yum.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/check_yum/nagios-okplugin-check_yum.spec b/check_yum/nagios-okplugin-check_yum.spec index e3404b8..7548ad9 100644 --- a/check_yum/nagios-okplugin-check_yum.spec +++ b/check_yum/nagios-okplugin-check_yum.spec @@ -3,7 +3,7 @@ Summary: Nagios plugin to test for Yum updates on RedHat/CentOS Linux. Name: nagios-okplugin-check_yum Version: 0.7.4 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ Group: Applications/System URL: http://opensource.is/trac/wiki/check_yum @@ -39,6 +39,9 @@ rm -rf %{buildroot} /etc/nrpe.d/check_yum.cfg %changelog +* Thu Aug 23 2012 Pall Sigurdsson 0.7.4-2 +- version number of scripts bumped (palli@opensource.is) + * Thu Aug 23 2012 Pall Sigurdsson 0.7.4-1 - Merging with check_yum from code.google.com (palli@opensource.is) From 77c5917350739cf35325418cc26700b2c39d3d57 Mon Sep 17 00:00:00 2001 From: Pall Sigurdsson Date: Thu, 23 Aug 2012 10:59:45 +0000 Subject: [PATCH 11/16] Automatic commit of package [nagios-okplugin-check_ibm_bladecenter] release [1.1.2-3]. --- .../nagios-okplugin-check_ibm_bladecenter.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/check_ibm_bladecenter/nagios-okplugin-check_ibm_bladecenter.spec b/check_ibm_bladecenter/nagios-okplugin-check_ibm_bladecenter.spec index 22cc247..c68b790 100644 --- a/check_ibm_bladecenter/nagios-okplugin-check_ibm_bladecenter.spec +++ b/check_ibm_bladecenter/nagios-okplugin-check_ibm_bladecenter.spec @@ -3,7 +3,7 @@ Summary: A Nagios plugin to check IBM Bladecenters Name: nagios-okplugin-check_ibm_bladecenter Version: 1.1.2 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv2+ Group: Applications/System URL: http://opensource.ok.is/trac/wiki/Nagios-OKPlugin-check_ibm_bladecenter @@ -40,6 +40,9 @@ rm -rf %{buildroot} #%config(noreplace) %{_sysconfdir}/nrpe.d/check_bond.cfg %changelog +* Thu Aug 23 2012 Pall Sigurdsson 1.1.2-3 +- version number of scripts bumped (palli@opensource.is) + * Thu Aug 23 2012 Pall Sigurdsson 1.1.2-2 - rpm spec file added. version number bumped (palli@opensource.is) From 16ed641f8b34efe6c6ee3d626c4559b1d2922189 Mon Sep 17 00:00:00 2001 From: Pall Sigurdsson Date: Thu, 23 Aug 2012 11:00:03 +0000 Subject: [PATCH 12/16] Automatic commit of package [nagios-okplugin-check_hpacucli] release [1.2-2]. --- check_hpacucli/nagios-okplugin-check_hpacucli.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/check_hpacucli/nagios-okplugin-check_hpacucli.spec b/check_hpacucli/nagios-okplugin-check_hpacucli.spec index 01eb0e2..ee775d0 100644 --- a/check_hpacucli/nagios-okplugin-check_hpacucli.spec +++ b/check_hpacucli/nagios-okplugin-check_hpacucli.spec @@ -3,7 +3,7 @@ Summary: A Nagios plugin to check HP Array with hpacucli Name: nagios-okplugin-check_hpacucli Version: 1.2 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ Group: Applications/System URL: http://opensource.is/trac/wiki/check_hpacucli @@ -38,6 +38,9 @@ rm -rf %{buildroot} /etc/nrpe.d/check_hpacucli.cfg %changelog +* Thu Aug 23 2012 Pall Sigurdsson 1.2-2 +- version number of scripts bumped (palli@opensource.is) + * Thu Aug 23 2012 Pall Sigurdsson 1.2-1 - check_command is now sudo'ed (palli@opensource.is) From 468d1820146d179c5df97d96f8e0bc32daabdbe8 Mon Sep 17 00:00:00 2001 From: Pall Sigurdsson Date: Thu, 23 Aug 2012 11:00:52 +0000 Subject: [PATCH 13/16] Automatic commit of package [nagios-okplugin-cifs] release [1.0-1]. --- check_cifs/nagios-okplugin-cifs.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/check_cifs/nagios-okplugin-cifs.spec b/check_cifs/nagios-okplugin-cifs.spec index da5c0c9..e8fc1f5 100644 --- a/check_cifs/nagios-okplugin-cifs.spec +++ b/check_cifs/nagios-okplugin-cifs.spec @@ -2,7 +2,7 @@ Summary: A Nagios plugin to check CIFS shares Name: nagios-okplugin-cifs -Version: 0.0.4 +Version: 1.0 Release: 1%{?dist} License: GPLv2+ Group: Applications/System @@ -39,6 +39,10 @@ rm -rf %{buildroot} %{_libdir}/nagios/plugins/* %changelog +* Thu Aug 23 2012 Pall Sigurdsson 1.0-1 +- version number of scripts bumped (palli@opensource.is) +- Updates buildarch to noarch (tommi@tommi.org) + * Mon Mar 12 2012 Pall Sigurdsson 0.0.4-1 - new package built with tito From 745c719ac8cd3ef0641e6b5821d49772d238e867 Mon Sep 17 00:00:00 2001 From: Tomas Edwardsson Date: Thu, 13 Dec 2012 10:31:11 +0000 Subject: [PATCH 14/16] Added perfdata and longoutput with ERRATA IDs Option added: -l - runs yum list-security to get advisories and packages Perfdata now shows how many updates are available. --- check_yum/check_yum | 127 +++++++++++++++-------- check_yum/nagios-okplugin-check_yum.spec | 8 +- 2 files changed, 90 insertions(+), 45 deletions(-) diff --git a/check_yum/check_yum b/check_yum/check_yum index 96c5358..56564fc 100755 --- a/check_yum/check_yum +++ b/check_yum/check_yum @@ -1,37 +1,12 @@ #!/usr/bin/python # coding=utf-8 -#Copyright © 2008-2012, Hari Sekhon . -#Copyright © 2012, Christoph Anton Mitterer . -#All rights reserved. -# -# -#This program is free software; you can redistribute it and/or -#modify it under the terms of the GNU General Public License -#as published by the Free Software Foundation; version 2 -#of the License. -# -#This program is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. -# -#You should have received a copy of the GNU General Public License -#along with this program; if not, write to the Free Software -#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - """Nagios plugin to check the YUM package management system for package updates. Can optionally alert on any available updates as well as just security related updates""" -__author__ = "Hari Sekhon" -__title__ = "Nagios plugin to check the YUM package management system for package updates." -__version__ = "0.7.4" - -# Changes: -# 0.7.2 Addes support for rhel6-style output (palli@opensource.is) -# 0.7.3 Maintenance taken over by Christoph Anton Mitterer - +__title__ = "check_yum" +__version__ = "0.8.0" # Standard Nagios return codes OK = 0 @@ -330,9 +305,28 @@ class YumTester: + "of this plugin. If the problem persists, then " \ + "please contact the author for a fix") - return number_packages + return number_packages, "'updates'=%s" % (number_packages) + def get_security_updateinfo(self): + """Fetches errata numbers and package names""" + + cmd = "%s list-security" % YUM + + output = self.run(cmd) + + errata = [] + + for line in output: + try: + if line.split()[1] != "security": + continue + except: + continue + (advisoryid, etype, package) = line.split() + errata.append( { "name": package, "advisory": advisoryid } ) + return errata + def get_security_updates(self): """Gets all updates, but differentiates between security and normal updates. Returns a tuple of the number @@ -342,10 +336,10 @@ class YumTester: output = self.run(cmd) - re_security_summary_rhel5 = re.compile("Needed \d+ of \d+ packages, for security") - re_security_summary_rhel6 = re.compile("\d+ package\(s\) needed for security, out of \d+ available") - re_no_security_updates_available_rhel5 = re.compile("No packages needed, for security, \d+ available") - re_no_security_updates_available_rhel6 = re.compile("No packages needed for security; \d+ packages available") + re_security_summary_rhel5 = re.compile("Needed \d+ of \d+ packages, for security") + re_security_summary_rhel6 = re.compile("\d+ package\(s\) needed for security, out of \d+ available") + re_no_security_updates_available_rhel5 = re.compile("No packages needed, for security, \d+ available") + re_no_security_updates_available_rhel6 = re.compile("No packages needed for security; \d+ packages available") summary_line_found = False for line in output: if re_no_security_updates_available_rhel5.match(line): @@ -400,8 +394,8 @@ class YumTester: """Starts tests and controls logic flow""" check_yum_usable() - self.vprint(3, "%s - Version %s\nAuthor: %s\n" \ - % (__title__, __version__, __author__)) + self.vprint(3, "%s - Version %s\n" \ + % (__title__, __version__)) self.validate_all_variables() self.set_timeout() @@ -419,7 +413,7 @@ class YumTester: status = UNKNOWN message = "code error - please contact author for a fix" - number_updates = self.get_all_updates() + number_updates, perfdata = self.get_all_updates() if number_updates == 0: status = OK message = "0 Updates Available" @@ -430,7 +424,7 @@ class YumTester: else: message = "%s Updates Available" % number_updates - return status, message + return status, message, perfdata def test_security_updates(self): @@ -442,6 +436,8 @@ class YumTester: number_security_updates, number_other_updates = \ self.get_security_updates() + + perfdata = "'security_updates'=%s 'other_updates'=%s" % (number_security_updates, number_other_updates) if number_security_updates == 0: status = OK message = "0 Security Updates Available" @@ -452,9 +448,8 @@ class YumTester: elif number_security_updates > 1: message = "%s Security Updates Available" \ % number_security_updates - if number_other_updates != 0: - if self.warn_on_any_update == True and status != CRITICAL: + if self.warn_on_any_update and status != CRITICAL: status = WARNING if number_other_updates == 1: message += ". 1 Non-Security Update Available" @@ -462,7 +457,12 @@ class YumTester: message += ". %s Non-Security Updates Available" \ % number_other_updates - return status, message + if number_security_updates and self.long_output: + errata = self.get_security_updateinfo() + for e in errata: + message += "\n%s - %s" % (e['advisory'], e['name']) + + return status, message, perfdata def vprint(self, threshold, message): @@ -533,6 +533,13 @@ def main(): help="Explicitly disables a repository when calling YUM " + "Can take a comma separated list of repositories") + parser.add_option( "-l", + "--long-output", + action="store_true", + dest="long_output", + help="Shows more detailed output including the errata " + + "ID.") + parser.add_option( "-t", "--timeout", dest="timeout", @@ -569,14 +576,15 @@ def main(): tester.timeout = options.timeout tester.verbosity = options.verbosity tester.warn_on_any_update = options.warn_on_any_update + tester.long_output = options.long_output if options.version: - print "%s - Version %s\nAuthor: %s\n" \ - % (__title__, __version__, __author__) + print "%s - Version %s\n" \ + % (__title__, __version__) sys.exit(OK) - result, output = tester.test_yum_updates() - end(result, output) + result, output, perfdata = tester.test_yum_updates() + end(result, output, perfdata) if __name__ == "__main__": @@ -586,3 +594,36 @@ if __name__ == "__main__": print "Caught Control-C..." sys.exit(CRITICAL) + + + + + + + + + + + + + + + +#Copyright © ?–?, Hari Sekhon . +#Copyright © 2012, Christoph Anton Mitterer . +#All rights reserved. +# +# +#This program is free software; you can redistribute it and/or +#modify it under the terms of the GNU General Public License +#as published by the Free Software Foundation; version 2 +#of the License. +# +#This program is distributed in the hope that it will be useful, +#but WITHOUT ANY WARRANTY; without even the implied warranty of +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#GNU General Public License for more details. +# +#You should have received a copy of the GNU General Public License +#along with this program; if not, write to the Free Software +#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/check_yum/nagios-okplugin-check_yum.spec b/check_yum/nagios-okplugin-check_yum.spec index 7548ad9..ffaee75 100644 --- a/check_yum/nagios-okplugin-check_yum.spec +++ b/check_yum/nagios-okplugin-check_yum.spec @@ -2,8 +2,8 @@ Summary: Nagios plugin to test for Yum updates on RedHat/CentOS Linux. Name: nagios-okplugin-check_yum -Version: 0.7.4 -Release: 2%{?dist} +Version: 0.8.0 +Release: 1%{?dist} License: GPLv2+ Group: Applications/System URL: http://opensource.is/trac/wiki/check_yum @@ -39,11 +39,15 @@ rm -rf %{buildroot} /etc/nrpe.d/check_yum.cfg %changelog +* Thu Dec 13 2012 Tomas Edwardsson 0.8.0-1 +- New upstream release + * Thu Aug 23 2012 Pall Sigurdsson 0.7.4-2 - version number of scripts bumped (palli@opensource.is) * Thu Aug 23 2012 Pall Sigurdsson 0.7.4-1 - Merging with check_yum from code.google.com (palli@opensource.is) +>>>>>>> dbda03e114ea394a848e3d0419d9a48fc673d079 * Mon Mar 12 2012 Pall Sigurdsson 0.7.3-1 - new package built with tito From 824665b6d9ba53675f37b57b83574c373f8490dd Mon Sep 17 00:00:00 2001 From: Tomas Edwardsson Date: Thu, 13 Dec 2012 15:07:18 +0000 Subject: [PATCH 15/16] Added check for suspended services -Z --- check_rhcs/check_rhcs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/check_rhcs/check_rhcs b/check_rhcs/check_rhcs index 4ca9d49..4aeb022 100644 --- a/check_rhcs/check_rhcs +++ b/check_rhcs/check_rhcs @@ -40,6 +40,8 @@ Usage: """ + sys.argv[0] + """ ([-s serviceName] | [-c]) Gathers the overall cluster status for the local node -s, --service Gets the stats of the named service +-Z, --suspended + Checks whether there are any suspended services -h, --help Display this """ @@ -99,23 +101,27 @@ def getServiceState(dom, service): if group.attributes['name'].value in (service,"service:"+service,"vm:"+service): serviceState['owner'] = group.attributes['owner'].value serviceState['state'] = group.attributes['state_str'].value + serviceState['flags'] = group.attributes['flags_str'].value return serviceState def main(): try: - opts, args = getopt.getopt(sys.argv[1:], 's:ch', ['service=', 'cluster', 'help']) + opts, args = getopt.getopt(sys.argv[1:], 's:cZh', ['service=', 'cluster', 'supsended', 'help']) except getopt.GetoptError: usage() sys.exit(2) + check_suspend = False for o, a in opts: if o in ('-c', '--cluster'): typeCheck = 'cluster' if o in ('-s', '--service'): typeCheck = 'service' serviceName = a + if o in ('-Z', '--suspended'): + check_suspend = True if o in ('-h', '--help'): usage() sys.exit() @@ -124,8 +130,8 @@ def main(): clustatOutput = os.popen('/usr/sbin/clustat -fx') dom = xml.dom.minidom.parse(clustatOutput) except Exception, e: - print "Error: could not parse output of : '/usr/sbin/clustat -fx': ", e - sys.exit(3) + print "Error: could not parse output of : '/usr/sbin/clustat -fx': ", e + sys.exit(3) if typeCheck == 'cluster': # First we query for the state of the cluster itself. @@ -156,6 +162,9 @@ def main(): if serviceState['state'] != 'started': print "CRITICAL: Service " + serviceName + " on " + serviceState['owner'] + " is in " + serviceState['state'] + " state" sys.exit(2) + elif check_suspend is True and serviceState['flags'] == 'frozen': + print "WARNING: Service " + serviceName + " on " + serviceState['owner'] + " is in " + serviceState['flags'] + " state" + sys.exit(1) else: print "OK: Service " + serviceName + " on " + serviceState['owner'] + " is in " + serviceState['state'] + " state" sys.exit(0) From 35537937338c6b2e6603704542491d563467f711 Mon Sep 17 00:00:00 2001 From: Tomas Edwardsson Date: Thu, 13 Dec 2012 15:09:13 +0000 Subject: [PATCH 16/16] Updated rhcs nrpe config as well --- check_rhcs/nrpe.d/check_rhcs.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/check_rhcs/nrpe.d/check_rhcs.cfg b/check_rhcs/nrpe.d/check_rhcs.cfg index ef714d9..70ad24b 100644 --- a/check_rhcs/nrpe.d/check_rhcs.cfg +++ b/check_rhcs/nrpe.d/check_rhcs.cfg @@ -1,5 +1,6 @@ command[check_rhcs]=sudo /usr/lib64/nagios/plugins/check_rhcs -c command[check_rhcs_service]=sudo /usr/lib64/nagios/plugins/check_rhcs -s '$ARG1$' +command[check_rhcs_service_frozen]=sudo /usr/lib64/nagios/plugins/check_rhcs -s '$ARG1$' -Z command[get_rhcs_fencing]=test ! -p /tmp/fence_manual.fifo command[check_rhcs_fencing]=/usr/lib64/nagios/plugins/check_rhcs_manualfencing.sh