1
0
mirror of https://github.com/opinkerfi/nagios-plugins.git synced 2024-11-21 18:03:45 +01:00

Packaged check_ifoperstate.sh

This commit is contained in:
Tomas Edwardsson 2013-06-05 14:32:21 +00:00
parent 85c1474519
commit 91e7874a5b
3 changed files with 46 additions and 3 deletions

View File

@ -0,0 +1,5 @@
Checks the operator status of network interfaces
Requires:
The get_ifoperstate.sh script

View File

@ -17,7 +17,7 @@
# Enumerates interfaces and their operstate (up/down/unknown).
__author__ = 'tommi'
__author__ = 'Tomas Edwardsson <tommi@tommi.org>'
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

View File

@ -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 <tommi@tommi.org>
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