mirror of
https://github.com/opinkerfi/nagios-plugins.git
synced 2024-12-04 08:13:48 +01:00
Merge branch 'master' of github.com:opinkerfi/nagios-plugins
This commit is contained in:
commit
944d47e18e
@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
|
# nagios: -epn
|
||||||
#
|
#
|
||||||
# check_apcext.pl - APC Extra gear monitoring plugin for Nagios
|
# check_apcext.pl - APC Extra gear monitoring plugin for Nagios
|
||||||
# 05.02.07 Paul Venezia
|
# 05.02.07 Paul Venezia
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Summary: A Nagios plugin to check APC devices
|
Summary: A Nagios plugin to check APC devices
|
||||||
Name: nagios-okplugin-apc
|
Name: nagios-okplugin-apc
|
||||||
Version: 2.1.1
|
Version: 2.1.2
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
Group: Applications/System
|
Group: Applications/System
|
||||||
@ -38,6 +38,9 @@ rm -rf %{buildroot}
|
|||||||
%{_libdir}/nagios/plugins/*
|
%{_libdir}/nagios/plugins/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Jun 09 2014 Tomas Edwardsson <tommi@tommi.org> 2.1.2-1
|
||||||
|
- Disable embedded perl (tommi@tommi.org)
|
||||||
|
|
||||||
* Thu Mar 20 2014 Tomas Edwardsson <tommi@tommi.org> 2.1.1-1
|
* Thu Mar 20 2014 Tomas Edwardsson <tommi@tommi.org> 2.1.1-1
|
||||||
- Merge github.com:opinkerfi/misc (palli@opensource.is)
|
- Merge github.com:opinkerfi/misc (palli@opensource.is)
|
||||||
- Use the right value for the job nbmstemp (tommi@tommi.org)
|
- Use the right value for the job nbmstemp (tommi@tommi.org)
|
||||||
|
@ -251,10 +251,10 @@ if ($ret > 1) {
|
|||||||
#
|
#
|
||||||
|
|
||||||
foreach my $l (@output) {
|
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\.-]+)$/) {
|
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);
|
my ($s,$u,$f,$pu,$d) = ($1,$2,$3,$4,$5);
|
||||||
$alldisks{$d}->{pused} = $pu;
|
$alldisks{$d}->{pused} = $pu;
|
||||||
$alldisks{$d}->{pfree} = 100-$pu;
|
$alldisks{$d}->{pfree} = 100-$pu;
|
||||||
@ -268,10 +268,10 @@ foreach my $l (@output) {
|
|||||||
# This is the output of df.exe on Windows
|
# This is the output of df.exe on Windows
|
||||||
#C:\ 9097126 6094081 3003045 67% argon-c (ntfs)
|
#C:\ 9097126 6094081 3003045 67% argon-c (ntfs)
|
||||||
else {
|
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/$opt_r/);
|
next if ($l !~ m/$opt_r/);
|
||||||
next if ($l =~ m/$exclude_re/);
|
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);
|
my ($d,$s,$u,$f,$pu) = ("/$1",$2,$3,$4,$5);
|
||||||
$alldisks{$d}->{pused} = $pu;
|
$alldisks{$d}->{pused} = $pu;
|
||||||
$alldisks{$d}->{pfree} = 100-$pu;
|
$alldisks{$d}->{pfree} = 100-$pu;
|
||||||
@ -324,7 +324,7 @@ if($opt_f) {
|
|||||||
if(defined($alldisks{$f})) {
|
if(defined($alldisks{$f})) {
|
||||||
$checkdisks{$f}=$alldisks{$f};
|
$checkdisks{$f}=$alldisks{$f};
|
||||||
}
|
}
|
||||||
} elsif ($f =~ /([\/\w\d]+)\:(\w+)\:(\w+)/) {
|
} elsif ($f =~ /^(.+?)\:(\w+)\:(\w+)/) {
|
||||||
if(defined($alldisks{$1})) {
|
if(defined($alldisks{$1})) {
|
||||||
$checkdisks{$1}=$alldisks{$1};
|
$checkdisks{$1}=$alldisks{$1};
|
||||||
updateRates($1,$2,$3,$checkdisks{$1}->{somme});
|
updateRates($1,$2,$3,$checkdisks{$1}->{somme});
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Summary: A Nagios plugin to check disks via NRPE
|
Summary: A Nagios plugin to check disks via NRPE
|
||||||
Name: nagios-okplugin-check_disks
|
Name: nagios-okplugin-check_disks
|
||||||
Version: 1.0.6
|
Version: 1.0.7
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
Group: Applications/System
|
Group: Applications/System
|
||||||
@ -40,6 +40,10 @@ rm -rf %{buildroot}
|
|||||||
%{_libdir}/nagios/plugins/check_disks.pl
|
%{_libdir}/nagios/plugins/check_disks.pl
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Oct 29 2014 Tomas Edwardsson <tommi@tommi.org> 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 <tommi@tommi.org> 1.0.6-1
|
* Tue Mar 25 2014 Tomas Edwardsson <tommi@tommi.org> 1.0.6-1
|
||||||
- Bumped version
|
- Bumped version
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ perl -pi -e "s|/usr/lib64|%{_libdir}|g" sudoers.d/*
|
|||||||
rm -rf %{buildroot}
|
rm -rf %{buildroot}
|
||||||
install -D -p -m 0755 check_hpacucli.py %{buildroot}%{_libdir}/nagios/plugins/check_hpacucli.py
|
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 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
|
%clean
|
||||||
rm -rf %{buildroot}
|
rm -rf %{buildroot}
|
||||||
|
@ -1 +1,2 @@
|
|||||||
|
Defaults:nrpe !requiretty
|
||||||
nrpe ALL=(ALL) NOPASSWD: /usr/lib64/nagios/plugins/check_hpacucli.py
|
nrpe ALL=(ALL) NOPASSWD: /usr/lib64/nagios/plugins/check_hpacucli.py
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Summary: A Nagios plugin to check HP Hardware Status
|
Summary: A Nagios plugin to check HP Hardware Status
|
||||||
Name: nagios-okplugin-check_hpasm
|
Name: nagios-okplugin-check_hpasm
|
||||||
Version: 4.1.2
|
Version: 4.1.4
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
Group: Applications/System
|
Group: Applications/System
|
||||||
@ -45,5 +45,11 @@ rm -rf %{buildroot}
|
|||||||
/etc/nrpe.d/check_hpasm.cfg
|
/etc/nrpe.d/check_hpasm.cfg
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Oct 03 2014 Tomas Edwardsson <tommi@tommi.org> 4.1.4-1
|
||||||
|
- hpasm invalid nrpe check command name (tommi@tommi.org)
|
||||||
|
|
||||||
|
* Thu May 15 2014 Tomas Edwardsson <tommi@tommi.org> 4.1.3-1
|
||||||
|
- new package built with tito
|
||||||
|
|
||||||
* Tue Jun 4 2013 Pall Sigurdsson <palli@opensource.is> 4.1.2-1
|
* Tue Jun 4 2013 Pall Sigurdsson <palli@opensource.is> 4.1.2-1
|
||||||
- Initial packaging
|
- Initial packaging
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
command[check_updates]=sudo /usr/lib/nagios/plugins/check_hpasm
|
command[check_hpasm]=sudo /usr/lib/nagios/plugins/check_hpasm
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
Summary: A Nagios plugin to check IPA server status
|
Summary: A Nagios plugin to check IPA server status
|
||||||
Name: nagios-okplugin-%{plugin}
|
Name: nagios-okplugin-%{plugin}
|
||||||
Version: 0.0.3
|
Version: 0.0.4
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
Group: Applications/System
|
Group: Applications/System
|
||||||
@ -42,6 +42,12 @@ rm -rf %{buildroot}
|
|||||||
%config(noreplace) %{_sysconfdir}/nrpe.d/check_ipa.cfg
|
%config(noreplace) %{_sysconfdir}/nrpe.d/check_ipa.cfg
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Apr 04 2014 Tomas Edwardsson <tommi@tommi.org> 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 <tommi@tommi.org> 0.0.3-1
|
* Thu Apr 25 2013 Tomas Edwardsson <tommi@tommi.org> 0.0.3-1
|
||||||
- Preliminary testing done, released
|
- Preliminary testing done, released
|
||||||
- Various errors in syntax fixed (tommi@tommi.org)
|
- Various errors in syntax fixed (tommi@tommi.org)
|
||||||
|
117
check_lvm_mirror/check_lvm_mirror.py
Normal file
117
check_lvm_mirror/check_lvm_mirror.py
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
from pynag.Plugins import simple as Plugin, WARNING, CRITICAL, UNKNOWN, OK
|
||||||
|
from subprocess import Popen, PIPE
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
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()
|
||||||
|
|
||||||
|
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 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'
|
||||||
|
|
||||||
|
# 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, e:
|
||||||
|
plugin.nagios_exit(UNKNOWN, "Unable to execute lvs: %s" % (e))
|
||||||
|
|
||||||
|
if ret != 0:
|
||||||
|
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
|
||||||
|
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))
|
||||||
|
|
||||||
|
# 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()
|
||||||
|
|
||||||
|
|
@ -45,6 +45,11 @@ def main():
|
|||||||
for pkg in pkg_updates[update_type]:
|
for pkg in pkg_updates[update_type]:
|
||||||
p.add_long_output(" %s" % pkg)
|
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.check_all_metrics()
|
||||||
p.exit()
|
p.exit()
|
||||||
|
|
||||||
|
@ -2,13 +2,14 @@
|
|||||||
|
|
||||||
Summary: A Nagios plugin to compare time on remote host with localhost
|
Summary: A Nagios plugin to compare time on remote host with localhost
|
||||||
Name: nagios-okplugin-check_time
|
Name: nagios-okplugin-check_time
|
||||||
Version: 1.0.2
|
Version: 1.0.3
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
Group: Applications/System
|
Group: Applications/System
|
||||||
URL: http://opensource.is/trac/wiki/check_time
|
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
|
Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_time/releases/nagios-okplugin-check_time-%{version}.tar.gz
|
||||||
Requires: nagios-nrpe
|
Requires: nagios-nrpe
|
||||||
|
Requires: bc
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||||
Packager: Pall Sigurdsson <palli@opensource.is>
|
Packager: Pall Sigurdsson <palli@opensource.is>
|
||||||
|
|
||||||
@ -40,6 +41,9 @@ rm -rf %{buildroot}
|
|||||||
/etc/nrpe.d/check_time.cfg
|
/etc/nrpe.d/check_time.cfg
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Apr 04 2014 Tomas Edwardsson <tommi@tommi.org> 1.0.3-1
|
||||||
|
- check_time - Added requirement for bc (tommi@tommi.org)
|
||||||
|
|
||||||
* Tue Mar 25 2014 Tomas Edwardsson <tommi@tommi.org> 1.0.2-1
|
* Tue Mar 25 2014 Tomas Edwardsson <tommi@tommi.org> 1.0.2-1
|
||||||
- Bump version
|
- Bump version
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Summary: A Nagios plugin to check uptime of a remote host via NRPE
|
Summary: A Nagios plugin to check uptime of a remote host via NRPE
|
||||||
Name: nagios-okplugin-check_uptime
|
Name: nagios-okplugin-check_uptime
|
||||||
Version: 1.0.2
|
Version: 1.0.3
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
Group: Applications/System
|
Group: Applications/System
|
||||||
@ -41,6 +41,9 @@ rm -rf %{buildroot}
|
|||||||
/etc/nrpe.d/check_uptime.cfg
|
/etc/nrpe.d/check_uptime.cfg
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Sun Apr 13 2014 Tomas Edwardsson <tommi@tommi.org> 1.0.3-1
|
||||||
|
- Update tag
|
||||||
|
|
||||||
* Mon Dec 30 2013 Tomas Edwardsson <tommi@tommi.org> 1.0.2-1
|
* Mon Dec 30 2013 Tomas Edwardsson <tommi@tommi.org> 1.0.2-1
|
||||||
- Updated tag for build with newer tito
|
- Updated tag for build with newer tito
|
||||||
|
|
||||||
|
46
okc-get_network_stat/nagios-okplugin-get_network_stat.spec
Normal file
46
okc-get_network_stat/nagios-okplugin-get_network_stat.spec
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
%define debug_package %{nil}
|
||||||
|
|
||||||
|
Summary: A Nagios plugin to get network statistics over NRPE
|
||||||
|
Name: nagios-okplugin-get_network_stat
|
||||||
|
Version: 1.0.1
|
||||||
|
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 <tommi@tommi.org>
|
||||||
|
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 02 2014 Tomas Edwardsson <tommi@tommi.org> 1.0.1-1
|
||||||
|
- new package built with tito
|
||||||
|
|
||||||
|
* Wed Apr 2 2014 Tomas Edwardsson <tommi@tommi.org> 1.0.0-1
|
||||||
|
- Initial release
|
65
okc-get_network_stat/okc-get_network_stat
Normal file
65
okc-get_network_stat/okc-get_network_stat
Normal file
@ -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_stat" % 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
|
||||||
|
|
@ -1 +1 @@
|
|||||||
2.1.1-1 check_apcext.pl/
|
2.1.2-1 check_apcext.pl/
|
||||||
|
@ -1 +1 @@
|
|||||||
1.0.6-1 check_disks.pl/
|
1.0.7-1 check_disks.pl/
|
||||||
|
1
rel-eng/packages/nagios-okplugin-check_hpasm
Normal file
1
rel-eng/packages/nagios-okplugin-check_hpasm
Normal file
@ -0,0 +1 @@
|
|||||||
|
4.1.4-1 check_hpasm/
|
@ -1 +1 @@
|
|||||||
1.0.2-1 check_time/
|
1.0.3-1 check_time/
|
||||||
|
@ -1 +1 @@
|
|||||||
1.0.2-1 check_uptime/
|
1.0.3-1 check_uptime/
|
||||||
|
1
rel-eng/packages/nagios-okplugin-get_network_stat
Normal file
1
rel-eng/packages/nagios-okplugin-get_network_stat
Normal file
@ -0,0 +1 @@
|
|||||||
|
1.0.1-1 okc-get_network_stat/
|
@ -1 +1 @@
|
|||||||
0.0.3-1 check_ipa/
|
0.0.4-1 check_ipa/
|
||||||
|
@ -1,10 +1,18 @@
|
|||||||
# Fedora FC20
|
# RHEL 7 Production
|
||||||
[test-fc20-x86_64]
|
[production-el7-x86_64]
|
||||||
releaser = tito.release.YumRepoReleaser
|
releaser = tito.release.YumRepoReleaser
|
||||||
builder = tito.builder.MockBuilder
|
builder = tito.builder.MockBuilder
|
||||||
builder.mock = fedora-20-x86_64
|
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
|
builder.test = 1
|
||||||
rsync = tito@opensource.is:/var/www/sites/opensource.ok.is/repo/testing/fedora20/x86_64/
|
rsync = tito@opensource.is:/var/www/sites/opensource.ok.is/repo/testing/rhel7/x86_64/
|
||||||
|
|
||||||
|
|
||||||
# RHEL 6 Production
|
# RHEL 6 Production
|
||||||
[production-el6-x86_64]
|
[production-el6-x86_64]
|
||||||
@ -37,6 +45,21 @@ builder.mock = epel-5-i386
|
|||||||
createrepo_command = createrepo -s sha1 .
|
createrepo_command = createrepo -s sha1 .
|
||||||
rsync = tito@opensource.is:/var/www/sites/opensource.ok.is/repo/rhel5/i386/
|
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
|
# RHEL 5 Testing
|
||||||
[test-el5-x86_64]
|
[test-el5-x86_64]
|
||||||
@ -57,20 +80,22 @@ createrepo_command = createrepo -s sha1 .
|
|||||||
rsync = tito@opensource.is:/var/www/sites/opensource.ok.is/repo/testing/rhel5/i386/
|
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]
|
# Fedora FC20
|
||||||
|
[production-fc20-x86_64]
|
||||||
releaser = tito.release.YumRepoReleaser
|
releaser = tito.release.YumRepoReleaser
|
||||||
builder = tito.builder.MockBuilder
|
builder = tito.builder.MockBuilder
|
||||||
builder.mock = epel-6-i386
|
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
|
builder.test = 1
|
||||||
rsync = tito@opensource.is:/var/www/sites/opensource.ok.is/repo/testing/rhel6/i386/
|
rsync = tito@opensource.is:/var/www/sites/opensource.ok.is/repo/testing/fedora20/x86_64/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user