From 91e7874a5b7e63c995d8807de32265ba4a508dc5 Mon Sep 17 00:00:00 2001 From: Tomas Edwardsson Date: Wed, 5 Jun 2013 14:32:21 +0000 Subject: [PATCH] Packaged check_ifoperstate.sh --- check_ifoperstate/README.md | 5 +++ check_ifoperstate/check_ifoperstate.py | 5 +-- .../nagios-okplugin-check_ifoperstate.spec | 39 +++++++++++++++++++ 3 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 check_ifoperstate/README.md create mode 100644 check_ifoperstate/nagios-okplugin-check_ifoperstate.spec diff --git a/check_ifoperstate/README.md b/check_ifoperstate/README.md new file mode 100644 index 0000000..424bc08 --- /dev/null +++ b/check_ifoperstate/README.md @@ -0,0 +1,5 @@ +Checks the operator status of network interfaces + +Requires: + + The get_ifoperstate.sh script diff --git a/check_ifoperstate/check_ifoperstate.py b/check_ifoperstate/check_ifoperstate.py index 37b4b2f..0435397 100644 --- a/check_ifoperstate/check_ifoperstate.py +++ b/check_ifoperstate/check_ifoperstate.py @@ -17,7 +17,7 @@ # Enumerates interfaces and their operstate (up/down/unknown). -__author__ = 'tommi' +__author__ = 'Tomas Edwardsson ' from subprocess import PIPE, Popen import os @@ -32,7 +32,6 @@ helper.parser.add_option('-H', "--hostname", help="Check interface on remote hos helper.parser.add_option('-l', "--list-interfaces", help="List interfaces", dest="list_interfaces", action="store_true") helper.parse_arguments() -# /usr/lib/nagios/plugins:/usr/lib64/nagios/plugins:/usr/local/libexec:/usr/libexec:/usr/local/nagios/libexec local_env = os.environ local_env["PATH"] += ":%s" % (":".join([ @@ -58,7 +57,7 @@ def get_interfaces(): interfaces.append((interface, status)) except Exception, e: - helper.add_summary("Unable to get interfaces: %s" % e) + helper.add_summary("Unable to get interfaces \"%s\": %s" % (" ".join(command), e)) helper.status(unknown) helper.exit() return interfaces diff --git a/check_ifoperstate/nagios-okplugin-check_ifoperstate.spec b/check_ifoperstate/nagios-okplugin-check_ifoperstate.spec new file mode 100644 index 0000000..e425922 --- /dev/null +++ b/check_ifoperstate/nagios-okplugin-check_ifoperstate.spec @@ -0,0 +1,39 @@ +%define debug_package %{nil} +%define plugin check_ifoperstate + +Summary: A Nagios plugin to check interface operator status +Name: nagios-okplugin-%{plugin} +Version: 0.0.1 +Release: 1%{?dist} +License: GPLv2+ +Group: Applications/System +URL: https://github.com/opinkerfi/misc/tree/master/nagios-plugins/check_%{plugin} +Source0: https://github.com/opinkerfi/misc/tree/master/nagios-plugins/check_%{plugin}/releases/%{name}-%{version}.tar.gz +Requires: nagios-okconfig-nrpe >= 0.0.4 +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +Packager: Tomas Edwardsson +BuildArch: noarch + + +%description +Checks the operator status of network interfaces + +%prep +%setup -q + +%build + + +%install +rm -rf %{buildroot} +install -D -p -m 0755 %{plugin} %{buildroot}%{_libdir}/nagios/plugins/%{plugin} + +%clean +rm -rf %{buildroot} + +%files +%defattr(-,root,root,-) +%doc README.md +%{_libdir}/nagios/plugins/* + +%changelog