mirror of
https://github.com/opinkerfi/nagios-plugins.git
synced 2026-02-13 02:20:57 +01:00
Compare commits
54 Commits
nagios-okp
...
nagios-okp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ee29f68bcc | ||
|
|
077e862e6f | ||
|
|
b96bb5e207 | ||
|
|
51c659990b | ||
|
|
343c42339f | ||
|
|
8f89f773e3 | ||
|
|
24518a74e7 | ||
|
|
cdc1daad6d | ||
|
|
c40bee725a | ||
|
|
892f9c267e | ||
|
|
3501677f20 | ||
|
|
6726f614ad | ||
|
|
ee5adc2363 | ||
|
|
7dc3b57582 | ||
|
|
688e8b8412 | ||
|
|
1ccc433779 | ||
|
|
ee05a4f24a | ||
|
|
871c8348fa | ||
|
|
944d47e18e | ||
|
|
40ba14c4cb | ||
|
|
f986b73474 | ||
|
|
c8e7fbbff8 | ||
|
|
f23ac92b64 | ||
|
|
7ab36cbc66 | ||
|
|
bf0edd899b | ||
|
|
9060a171f0 | ||
|
|
1420e93c5c | ||
|
|
cbcaa14997 | ||
|
|
03f7389842 | ||
|
|
f186de5585 | ||
|
|
c22b89893d | ||
|
|
d3f75ec93a | ||
|
|
9862b3c0d9 | ||
|
|
790619d820 | ||
|
|
a743def0c8 | ||
|
|
c414e17b30 | ||
|
|
b481aadbd5 | ||
|
|
2049fbd692 | ||
|
|
5f604b852f | ||
|
|
e5772ab336 | ||
|
|
e5498e1554 | ||
|
|
7d9ba339bc | ||
|
|
37d504a039 | ||
|
|
e7af0e4098 | ||
|
|
6c126130cc | ||
|
|
f0968997e4 | ||
|
|
95693e3c73 | ||
|
|
55daf8f4c9 | ||
|
|
d11d29185a | ||
|
|
06194c84cc | ||
|
|
184d7d3b4a | ||
|
|
1574cd13d3 | ||
|
|
b0b55dcd3e | ||
|
|
b96e973e60 |
@@ -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.0
|
Version: 2.1.2
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
Group: Applications/System
|
Group: Applications/System
|
||||||
@@ -38,6 +38,15 @@ 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
|
||||||
|
- Merge github.com:opinkerfi/misc (palli@opensource.is)
|
||||||
|
- Use the right value for the job nbmstemp (tommi@tommi.org)
|
||||||
|
- Fixed metric conversion for all mibs (tommi@opensource.is)
|
||||||
|
- Added fahrenheit to celsius conversion (tommi@tommi.org)
|
||||||
|
|
||||||
* Thu Aug 23 2012 Pall Sigurdsson <palli@opensource.is> 2.1.0-1
|
* Thu Aug 23 2012 Pall Sigurdsson <palli@opensource.is> 2.1.0-1
|
||||||
- Version number bumped to 2.1.0 (palli@opensource.is)
|
- Version number bumped to 2.1.0 (palli@opensource.is)
|
||||||
- Added noarch buildarch (tommi@tommi.org)
|
- Added noarch buildarch (tommi@tommi.org)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
Summary: A Nagios plugin to check SMTP blacklists
|
Summary: A Nagios plugin to check SMTP blacklists
|
||||||
Name: nagios-okplugin-mailblacklist
|
Name: nagios-okplugin-mailblacklist
|
||||||
Version: 1.1
|
Version: 1.1
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
Group: Applications/System
|
Group: Applications/System
|
||||||
URL: http://opensource.ok.is/trac/wiki/Nagios-OKPlugin-MailBlacklist
|
URL: http://opensource.ok.is/trac/wiki/Nagios-OKPlugin-MailBlacklist
|
||||||
@@ -11,7 +11,7 @@ Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_bl/releases/%
|
|||||||
Requires: nagios-plugins
|
Requires: nagios-plugins
|
||||||
Requires: nagios-plugins-perl
|
Requires: nagios-plugins-perl
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||||
Packager: Tomas Edwardsson <tommi@ok.is>
|
Packager: Gardar Thorsteinsson <gardar@ok.is>
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
|
||||||
|
|
||||||
@@ -22,6 +22,8 @@ Checks DNS Blacklists for existance of hosts
|
|||||||
%setup -q
|
%setup -q
|
||||||
perl -pi -e "s|/usr/lib|%{_libdir}|g" check_bl
|
perl -pi -e "s|/usr/lib|%{_libdir}|g" check_bl
|
||||||
|
|
||||||
|
%global __requires_exclude %{?__requires_exclude:%__requires_exclude}|}^perl\\(utils\\)
|
||||||
|
|
||||||
%build
|
%build
|
||||||
|
|
||||||
|
|
||||||
@@ -38,6 +40,9 @@ rm -rf %{buildroot}
|
|||||||
%{_libdir}/nagios/plugins/*
|
%{_libdir}/nagios/plugins/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri May 04 2018 Richard Allen <ra@ok.is> 1.1-2
|
||||||
|
- Filter out perl-utils dependancy
|
||||||
|
|
||||||
* Thu Feb 20 2014 Pall Sigurdsson <palli@opensource.is> 1.1-1
|
* Thu Feb 20 2014 Pall Sigurdsson <palli@opensource.is> 1.1-1
|
||||||
-
|
-
|
||||||
|
|
||||||
|
|||||||
@@ -3,14 +3,14 @@
|
|||||||
Summary: A Nagios plugin to check Brocade devices
|
Summary: A Nagios plugin to check Brocade devices
|
||||||
Name: nagios-okplugin-brocade
|
Name: nagios-okplugin-brocade
|
||||||
Version: 0.0.5
|
Version: 0.0.5
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
Group: Applications/System
|
Group: Applications/System
|
||||||
URL: http://opensource.ok.is/trac/wiki/Nagios-OKPlugin-Brocade
|
URL: http://opensource.ok.is/trac/wiki/Nagios-OKPlugin-Brocade
|
||||||
Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_brocade/releases/nagios-okplugin-brocade-%{version}.tar.gz
|
Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_brocade/releases/nagios-okplugin-brocade-%{version}.tar.gz
|
||||||
Requires: perl-Nagios-Plugin
|
Requires: perl-Nagios-Plugin
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||||
Packager: Tomas Edwardsson <tommi@ok.is>
|
Packager: Gardar Thorsteinsson <gardar@ok.is>
|
||||||
|
|
||||||
|
|
||||||
%description
|
%description
|
||||||
@@ -20,6 +20,8 @@ Checks Brocade devices
|
|||||||
%setup -q
|
%setup -q
|
||||||
perl -pi -e "s|/usr/lib|%{_libdir}|g" check_brocade_env
|
perl -pi -e "s|/usr/lib|%{_libdir}|g" check_brocade_env
|
||||||
|
|
||||||
|
%global __requires_exclude %{?__requires_exclude:%__requires_exclude}|}^perl\\(utils\\)
|
||||||
|
|
||||||
%build
|
%build
|
||||||
|
|
||||||
|
|
||||||
@@ -36,6 +38,9 @@ rm -rf %{buildroot}
|
|||||||
%{_libdir}/nagios/plugins/*
|
%{_libdir}/nagios/plugins/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri May 09 2018 Gardar Thorsteinsson <gardar@ok.is> 0.0.5-2
|
||||||
|
- filter out perl-utils dep
|
||||||
|
|
||||||
* Thu Feb 20 2014 Pall Sigurdsson <palli@opensource.is> 0.0.5-1
|
* Thu Feb 20 2014 Pall Sigurdsson <palli@opensource.is> 0.0.5-1
|
||||||
-
|
-
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
Summary: A Nagios plugin to check CIFS shares
|
Summary: A Nagios plugin to check CIFS shares
|
||||||
Name: nagios-okplugin-cifs
|
Name: nagios-okplugin-cifs
|
||||||
Version: 1.1
|
Version: 1.1
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
Group: Applications/System
|
Group: Applications/System
|
||||||
URL: http://opensource.ok.is/trac/wiki/Nagios-OKPlugin-Brocade
|
URL: http://opensource.ok.is/trac/wiki/Nagios-OKPlugin-Brocade
|
||||||
@@ -11,7 +11,7 @@ Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_cifs/releases
|
|||||||
Requires: perl-Nagios-Plugin
|
Requires: perl-Nagios-Plugin
|
||||||
Requires: samba-client, krb5-workstation
|
Requires: samba-client, krb5-workstation
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||||
Packager: Tomas Edwardsson <tommi@ok.is>
|
Packager: Gardar Thorsteinsson <gardar@ok.is>
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
|
||||||
|
|
||||||
@@ -23,6 +23,8 @@ NTML authentication
|
|||||||
%setup -q
|
%setup -q
|
||||||
perl -pi -e "s|/usr/lib|%{_libdir}|g" check_cifs
|
perl -pi -e "s|/usr/lib|%{_libdir}|g" check_cifs
|
||||||
|
|
||||||
|
%global __requires_exclude %{?__requires_exclude:%__requires_exclude}|}^perl\\(utils\\)
|
||||||
|
|
||||||
%build
|
%build
|
||||||
|
|
||||||
|
|
||||||
@@ -39,6 +41,9 @@ rm -rf %{buildroot}
|
|||||||
%{_libdir}/nagios/plugins/*
|
%{_libdir}/nagios/plugins/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri May 09 2018 Gardar Thorsteinsson <gardar@ok.is> 1.1-2
|
||||||
|
- Filter out perl-utils dep
|
||||||
|
|
||||||
* Thu Feb 20 2014 Pall Sigurdsson <palli@opensource.is> 1.1-1
|
* Thu Feb 20 2014 Pall Sigurdsson <palli@opensource.is> 1.1-1
|
||||||
- Merge github.com:opinkerfi/misc (palli@opensource.is)
|
- Merge github.com:opinkerfi/misc (palli@opensource.is)
|
||||||
|
|
||||||
|
|||||||
@@ -89,7 +89,6 @@ def remove_stale_state():
|
|||||||
state_mtime = os.stat("/var/lib/nagios-okplugin/check_cpu").st_mtime
|
state_mtime = os.stat("/var/lib/nagios-okplugin/check_cpu").st_mtime
|
||||||
boot_time = os.stat("/proc/1").st_mtime
|
boot_time = os.stat("/proc/1").st_mtime
|
||||||
if state_mtime < boot_time:
|
if state_mtime < boot_time:
|
||||||
print "unlinking"
|
|
||||||
os.unlink("/var/lib/nagios-okplugin/check_cpu")
|
os.unlink("/var/lib/nagios-okplugin/check_cpu")
|
||||||
except OSError:
|
except OSError:
|
||||||
return None
|
return None
|
||||||
|
|||||||
@@ -251,10 +251,10 @@ if ($ret > 1) {
|
|||||||
#
|
#
|
||||||
|
|
||||||
foreach my $l (@output) {
|
foreach my $l (@output) {
|
||||||
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/$opt_r/);
|
next if ($l !~ m/$opt_r/);
|
||||||
next if ($l =~ m/$exclude_re/);
|
next if ($l =~ m/$exclude_re/);
|
||||||
|
if($l =~ /(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\%\s+([\/\w\d\.-]+)$/) {
|
||||||
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.4
|
Version: 1.0.7
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
Group: Applications/System
|
Group: Applications/System
|
||||||
@@ -40,6 +40,16 @@ 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
|
||||||
|
- Bumped version
|
||||||
|
|
||||||
|
* Tue Mar 25 2014 Tomas Edwardsson <tommi@tommi.org> 1.0.5-1
|
||||||
|
- Added support for inodes (tryggvi@linux.is)
|
||||||
|
|
||||||
* Sat Mar 02 2013 Tryggvi Farestveit <tryggvi@linux.is> 1.0.4-1
|
* Sat Mar 02 2013 Tryggvi Farestveit <tryggvi@linux.is> 1.0.4-1
|
||||||
- Added support for inodes
|
- Added support for inodes
|
||||||
|
|
||||||
|
|||||||
23
check_firewall_active/check_firewall_active.sh
Executable file
23
check_firewall_active/check_firewall_active.sh
Executable file
@@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
EXIT_OK=0
|
||||||
|
EXIT_WARN=1
|
||||||
|
EXIT_CRIT=2
|
||||||
|
|
||||||
|
PATH=/sbin:/usr/sbin:$PATH
|
||||||
|
|
||||||
|
if [ "$(id -u)" != "0" ]; then
|
||||||
|
echo "This script must be run as root" 1>&2
|
||||||
|
exit $EXIT_CRIT
|
||||||
|
fi
|
||||||
|
|
||||||
|
blocks=$(iptables -L -v -n | egrep 'REJECT|DROP' | wc -l)
|
||||||
|
|
||||||
|
if [ $blocks -eq 0 ]; then
|
||||||
|
echo "CRITICAL: No firewall detected"
|
||||||
|
exit $EXIT_CRIT
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "OK: Firewall is active"
|
||||||
|
exit $EXIT_OK
|
||||||
|
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
%define debug_package %{nil}
|
||||||
|
|
||||||
|
Summary: A Nagios plugin to check if iptables are actually enforcing rules
|
||||||
|
Name: nagios-okplugin-check_firewall_active
|
||||||
|
Version: 1.0.2
|
||||||
|
Release: 1%{?dist}
|
||||||
|
License: GPLv2+
|
||||||
|
Group: Applications/System
|
||||||
|
URL: https://github.com/opinkerfi/nagios-plugins/issues
|
||||||
|
Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_firewall_active/releases/nagios-okplugin-check_firewall_active-%{version}.tar.gz
|
||||||
|
Requires: nagios-nrpe
|
||||||
|
Requires: iptables
|
||||||
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||||
|
Packager: Richard Allen <ra@ok.is>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%description
|
||||||
|
A Nagios plugin to check if iptables are actually enforcing rules
|
||||||
|
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%setup -q
|
||||||
|
#perl -pi -e "s|/usr/lib64|%{_libdir}|g" nrpe.d/check_firewall_active.cfg
|
||||||
|
|
||||||
|
%build
|
||||||
|
|
||||||
|
|
||||||
|
%install
|
||||||
|
rm -rf %{buildroot}
|
||||||
|
install -D -p -m 0755 check_firewall_active.sh %{buildroot}%{_libdir}/nagios/plugins/check_firewall_active.sh
|
||||||
|
install -D -p -m 0755 nrpe.d/check_firewall_active.cfg %{buildroot}/etc/nrpe.d/check_firewall_active.cfg
|
||||||
|
install -D -p -m 0644 sudoers.d/check_firewall_active %{buildroot}/etc/sudoers.d/check_firewall_active
|
||||||
|
|
||||||
|
%clean
|
||||||
|
rm -rf %{buildroot}
|
||||||
|
|
||||||
|
%files
|
||||||
|
%defattr(-,root,root,-)
|
||||||
|
#%doc README LICENSE
|
||||||
|
%{_libdir}/nagios/plugins/*
|
||||||
|
/etc/nrpe.d/check_firewall_active.cfg
|
||||||
|
/etc/sudoers.d/check_firewall_active
|
||||||
|
|
||||||
|
%post
|
||||||
|
restorecon -v %{_libdir}/nagios/plugins/check_firewall_active.sh /etc/nrpe.d/check_firewall_active.cfg /etc/sudoers.d/check_firewall_active
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Thu Dec 21 2016 Gardar Thorsteinsson <gardart@gmail.com> 1.0.1-1
|
||||||
|
* Thu Dec 21 2016 Gardar Thorsteinsson <gardart@gmail.com> 1.0.0-3
|
||||||
|
* Thu Dec 20 2016 Richard Allen <ra@ok.is> 0.1-1
|
||||||
|
- Initial packaging
|
||||||
3
check_firewall_active/nrpe.d/check_firewall_active.cfg
Normal file
3
check_firewall_active/nrpe.d/check_firewall_active.cfg
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
|
command[check_firewall_active]=sudo /usr/lib64/nagios/plugins/check_firewall_active.sh
|
||||||
2
check_firewall_active/sudoers.d/check_firewall_active
Normal file
2
check_firewall_active/sudoers.d/check_firewall_active
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
Defaults:nrpe !requiretty
|
||||||
|
nrpe ALL = (root) NOPASSWD: /usr/lib64/nagios/plugins/check_firewall_active.sh
|
||||||
@@ -274,6 +274,9 @@ def check_logicaldisks():
|
|||||||
ld_status = check(i, 'Status')
|
ld_status = check(i, 'Status')
|
||||||
status = max(status, ld_status)
|
status = max(status, ld_status)
|
||||||
|
|
||||||
|
if i.get('Status') == 'Failed':
|
||||||
|
status = max(status, critical)
|
||||||
|
|
||||||
mount_point = i['Mount Points']
|
mount_point = i['Mount Points']
|
||||||
add_long("- %s (%s) = %s" % (i['name'], mount_point, state[ld_status]))
|
add_long("- %s (%s) = %s" % (i['name'], mount_point, state[ld_status]))
|
||||||
add_summary(". ")
|
add_summary(". ")
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ check_raid()
|
|||||||
{
|
{
|
||||||
raid_ok=`cat $TEMPFILE |grep -i ok|wc -l`
|
raid_ok=`cat $TEMPFILE |grep -i ok|wc -l`
|
||||||
raid_warning=`cat $TEMPFILE|grep -i -E 'rebuild|predictive' |wc -l`
|
raid_warning=`cat $TEMPFILE|grep -i -E 'rebuild|predictive' |wc -l`
|
||||||
raid_critical_1=`cat $TEMPFILE|grep -i 'failed|recovery' | wc -l`
|
raid_critical_1=`cat $TEMPFILE|grep -i -E 'failed|recovery' | wc -l`
|
||||||
|
|
||||||
err_check=`expr $raid_ok + $raid_warning + $raid_critical_1 `
|
err_check=`expr $raid_ok + $raid_warning + $raid_critical_1 `
|
||||||
|
|
||||||
@@ -133,7 +133,7 @@ case "$1" in
|
|||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
--all)
|
--all)
|
||||||
controllers=`sudo -u root hpacucli controller all show | sed 's/.*Slot \([0-9]*\).*/\1/'`
|
controllers=`sudo -u root $HPACUCLI controller all show | sed 's/.*Slot \([0-9]*\).*/\1/'`
|
||||||
for i in $controllers ; do sudo -u root $HPACUCLI controller slot=$i pd all show status;done > $TEMPFILE
|
for i in $controllers ; do sudo -u root $HPACUCLI controller slot=$i pd all show status;done > $TEMPFILE
|
||||||
check_raid
|
check_raid
|
||||||
;;
|
;;
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -20,18 +20,16 @@
|
|||||||
# This script will check the status of a remote IBM Bladecenter via SNMP.
|
# This script will check the status of a remote IBM Bladecenter via SNMP.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# No real need to change anything below here
|
# No real need to change anything below here
|
||||||
version="1.1.2"
|
version = "1.1.2"
|
||||||
ok=0
|
ok = 0
|
||||||
warning=1
|
warning = 1
|
||||||
critical=2
|
critical = 2
|
||||||
unknown=3
|
unknown = 3
|
||||||
not_present = -1
|
not_present = -1
|
||||||
exit_status = -1
|
exit_status = -1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
state = {}
|
state = {}
|
||||||
state[not_present] = "Not Present"
|
state[not_present] = "Not Present"
|
||||||
state[ok] = "OK"
|
state[ok] = "OK"
|
||||||
@@ -40,59 +38,57 @@ state[critical] = "Critical"
|
|||||||
state[unknown] = "Unknown"
|
state[unknown] = "Unknown"
|
||||||
|
|
||||||
|
|
||||||
longserviceoutput="\n"
|
longserviceoutput = "\n"
|
||||||
perfdata=""
|
perfdata = ""
|
||||||
summary=""
|
summary = ""
|
||||||
sudo=False
|
sudo = False
|
||||||
|
|
||||||
|
|
||||||
from sys import exit
|
from sys import exit
|
||||||
from sys import argv
|
from sys import argv
|
||||||
from os import getenv,putenv,environ
|
from os import getenv, putenv, environ
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Parse some Arguments
|
# Parse some Arguments
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
parser = OptionParser()
|
parser = OptionParser()
|
||||||
parser.add_option("-m","--mode", dest="mode",
|
parser.add_option("-m", "--mode", dest="mode",
|
||||||
help="Which check mode is in use (powermodules,system-health,temperature,chassis-status,bladehealth,blowers,switchmodules)")
|
help="Which check mode is in use (powermodules,system-health,temperature,chassis-status,bladehealth,blowers,switchmodules)")
|
||||||
parser.add_option("-H","--host", dest="host",
|
parser.add_option("-H", "--host", dest="host",
|
||||||
help="Hostname or IP address of the host to check")
|
help="Hostname or IP address of the host to check")
|
||||||
parser.add_option("-w","--warning", dest="warning_threshold",
|
parser.add_option("-w", "--warning", dest="warning_threshold",
|
||||||
help="Warning threshold", type="int", default=None)
|
help="Warning threshold", type="int", default=None)
|
||||||
parser.add_option("-c","--critical", type="int", dest="critical_threshold",
|
parser.add_option("-c", "--critical", type="int", dest="critical_threshold",
|
||||||
help="Critical threshold", default=None)
|
help="Critical threshold", default=None)
|
||||||
parser.add_option("-e","--exclude", dest="exclude",
|
parser.add_option("-e", "--exclude", dest="exclude",
|
||||||
help="Exclude specific object", default=None)
|
help="Exclude specific object", default=None)
|
||||||
parser.add_option("-v","--snmp_version", dest="snmp_version",
|
parser.add_option("-v", "--snmp_version", dest="snmp_version",
|
||||||
help="SNMP Version to use (1, 2c or 3)", default="1")
|
help="SNMP Version to use (1, 2c or 3)", default="1")
|
||||||
parser.add_option("-u","--snmp_username", dest="snmp_username",
|
parser.add_option("-u", "--snmp_username", dest="snmp_username",
|
||||||
help="SNMP username (only with SNMP v3)", default=None)
|
help="SNMP username (only with SNMP v3)", default=None)
|
||||||
parser.add_option("-C","--snmp_community", dest="snmp_community",
|
parser.add_option("-C", "--snmp_community", dest="snmp_community",
|
||||||
help="SNMP Community (only with SNMP v1|v2c)", default=None)
|
help="SNMP Community (only with SNMP v1|v2c)", default=None)
|
||||||
parser.add_option("-p","--snmp_password", dest="snmp_password",
|
parser.add_option("-p", "--snmp_password", dest="snmp_password",
|
||||||
help="SNMP password (only with SNMP v3)", default=None)
|
help="SNMP password (only with SNMP v3)", default=None)
|
||||||
parser.add_option("-l","--snmp_security_level", dest="snmp_seclevel",
|
parser.add_option("-l", "--snmp_security_level", dest="snmp_seclevel",
|
||||||
help="SNMP security level (only with SNMP v3) (noAuthNoPriv|authNoPriv|authPriv)", default=None)
|
help="SNMP security level (only with SNMP v3) (noAuthNoPriv|authNoPriv|authPriv)", default=None)
|
||||||
parser.add_option("-t","--snmp_timeout", dest="snmp_timeout",
|
parser.add_option("-t", "--snmp_timeout", dest="snmp_timeout",
|
||||||
help="Timeout in seconds for SNMP", default=10)
|
help="Timeout in seconds for SNMP", default=10)
|
||||||
parser.add_option("-d","--debug", dest="debug",
|
parser.add_option("-d", "--debug", dest="debug",
|
||||||
help="Enable debugging (for troubleshooting", action="store_true", default=False)
|
help="Enable debugging (for troubleshooting", action="store_true", default=False)
|
||||||
|
|
||||||
(opts,args) = parser.parse_args()
|
(opts, args) = parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
if opts.host == None:
|
if opts.host is None:
|
||||||
parser.error("Hostname (-H) is required.")
|
parser.error("Hostname (-H) is required.")
|
||||||
if opts.mode == None:
|
if opts.mode is None:
|
||||||
parser.error("Mode (--mode) is required.")
|
parser.error("Mode (--mode) is required.")
|
||||||
|
|
||||||
snmp_options = ""
|
snmp_options = ""
|
||||||
|
|
||||||
|
|
||||||
def set_snmp_options():
|
def set_snmp_options():
|
||||||
global snmp_options
|
global snmp_options
|
||||||
if opts.snmp_version is not None:
|
if opts.snmp_version is not None:
|
||||||
@@ -101,39 +97,47 @@ def set_snmp_options():
|
|||||||
if opts.snmp_username is None:
|
if opts.snmp_username is None:
|
||||||
parser.error("--snmp_username required with --snmp_version=3")
|
parser.error("--snmp_username required with --snmp_version=3")
|
||||||
if opts.snmp_seclevel is None:
|
if opts.snmp_seclevel is None:
|
||||||
parser.error("--snmp_security_level required with --snmp_version=3")
|
parser.error(
|
||||||
|
"--snmp_security_level required with --snmp_version=3")
|
||||||
if opts.snmp_password is None:
|
if opts.snmp_password is None:
|
||||||
parser.error("--snmp_password required with --snmp_version=3")
|
parser.error("--snmp_password required with --snmp_version=3")
|
||||||
snmp_options = snmp_options + " -u %s -l %s -A %s " % (opts.snmp_username, opts.snmp_seclevel,opts.snmp_password)
|
snmp_options = snmp_options + " -u %s -l %s -A %s " % (
|
||||||
|
opts.snmp_username, opts.snmp_seclevel, opts.snmp_password)
|
||||||
else:
|
else:
|
||||||
if opts.snmp_community is None:
|
if opts.snmp_community is None:
|
||||||
parser.error("--snmp_community is required with --snmp_version=1|2c")
|
parser.error(
|
||||||
|
"--snmp_community is required with --snmp_version=1|2c")
|
||||||
snmp_options = snmp_options + " -c %s " % opts.snmp_community
|
snmp_options = snmp_options + " -c %s " % opts.snmp_community
|
||||||
snmp_options += " -t %s " % (opts.snmp_timeout)
|
snmp_options += " -t %s " % (opts.snmp_timeout)
|
||||||
|
|
||||||
|
|
||||||
def error(errortext):
|
def error(errortext):
|
||||||
print "* Error: %s" % errortext
|
print "* Error: %s" % errortext
|
||||||
exit(unknown)
|
exit(unknown)
|
||||||
|
|
||||||
def debug( debugtext ):
|
|
||||||
|
def debug(debugtext):
|
||||||
if opts.debug:
|
if opts.debug:
|
||||||
print debugtext
|
print debugtext
|
||||||
|
|
||||||
def nagios_status( newStatus ):
|
|
||||||
|
def nagios_status(newStatus):
|
||||||
global exit_status
|
global exit_status
|
||||||
exit_status = max(exit_status, newStatus)
|
exit_status = max(exit_status, newStatus)
|
||||||
return exit_status
|
return exit_status
|
||||||
|
|
||||||
'''runCommand: Runs command from the shell prompt. Exit Nagios style if unsuccessful'''
|
|
||||||
def runCommand(command):
|
def runCommand(command):
|
||||||
debug( "Executing: %s" % command )
|
'''runCommand: Runs command from the shell prompt. Exit Nagios style if unsuccessful'''
|
||||||
proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE,stderr=subprocess.PIPE,)
|
debug("Executing: %s" % command)
|
||||||
|
proc = subprocess.Popen(
|
||||||
|
command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE,)
|
||||||
stdout, stderr = proc.communicate('through stdin to stdout')
|
stdout, stderr = proc.communicate('through stdin to stdout')
|
||||||
if proc.returncode > 0:
|
if proc.returncode > 0:
|
||||||
print "Error %s: %s\n command was: '%s'" % (proc.returncode,stderr.strip(),command)
|
print "Error %s: %s\n command was: '%s'" % (proc.returncode, stderr.strip(), command)
|
||||||
debug("results: %s" % (stdout.strip() ) )
|
debug("results: %s" % (stdout.strip()))
|
||||||
if proc.returncode == 127: # File not found, lets print path
|
if proc.returncode == 127: # File not found, lets print path
|
||||||
path=getenv("PATH")
|
path = getenv("PATH")
|
||||||
print "Check if your path is correct %s" % (path)
|
print "Check if your path is correct %s" % (path)
|
||||||
if stderr.find('Password:') == 0 and command.find('sudo') == 0:
|
if stderr.find('Password:') == 0 and command.find('sudo') == 0:
|
||||||
print "Check if user is in the sudoers file"
|
print "Check if user is in the sudoers file"
|
||||||
@@ -143,70 +147,82 @@ def runCommand(command):
|
|||||||
else:
|
else:
|
||||||
return stdout
|
return stdout
|
||||||
|
|
||||||
|
|
||||||
def end():
|
def end():
|
||||||
global summary
|
global summary
|
||||||
global longserviceoutput
|
global longserviceoutput
|
||||||
global perfdata
|
global perfdata
|
||||||
global exit_status
|
global exit_status
|
||||||
print "%s - %s | %s" % (state[exit_status], summary,perfdata)
|
print "%s - %s | %s" % (state[exit_status], summary, perfdata)
|
||||||
print longserviceoutput
|
print longserviceoutput
|
||||||
if exit_status < 0: exit_status = unknown
|
if exit_status < 0:
|
||||||
|
exit_status = unknown
|
||||||
exit(exit_status)
|
exit(exit_status)
|
||||||
|
|
||||||
|
|
||||||
def add_perfdata(text):
|
def add_perfdata(text):
|
||||||
global perfdata
|
global perfdata
|
||||||
text = text.strip()
|
text = text.strip()
|
||||||
perfdata = perfdata + " %s " % (text)
|
perfdata = perfdata + " %s " % (text)
|
||||||
|
|
||||||
|
|
||||||
def add_long(text):
|
def add_long(text):
|
||||||
global longserviceoutput
|
global longserviceoutput
|
||||||
longserviceoutput = longserviceoutput + text + '\n'
|
longserviceoutput = longserviceoutput + text + '\n'
|
||||||
|
|
||||||
|
|
||||||
def add_summary(text):
|
def add_summary(text):
|
||||||
global summary
|
global summary
|
||||||
summary = summary + text
|
summary = summary + text
|
||||||
|
|
||||||
|
|
||||||
def set_path(path):
|
def set_path(path):
|
||||||
current_path = getenv('PATH')
|
current_path = getenv('PATH')
|
||||||
if current_path.find('C:\\') > -1: # We are on this platform
|
if current_path.find('C:\\') > -1: # We are on this platform
|
||||||
if path == '':
|
if path == '':
|
||||||
pass
|
pass
|
||||||
else: path = ';' + path
|
else:
|
||||||
|
path = ';' + path
|
||||||
else: # Unix/Linux, etc
|
else: # Unix/Linux, etc
|
||||||
if path == '': path = ":/usr/sbin"
|
if path == '':
|
||||||
else: path = ':' + path
|
path = ":/usr/sbin"
|
||||||
current_path = "%s%s" % (current_path,path)
|
else:
|
||||||
|
path = ':' + path
|
||||||
|
current_path = "%s%s" % (current_path, path)
|
||||||
environ['PATH'] = current_path
|
environ['PATH'] = current_path
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def snmpget(oid):
|
def snmpget(oid):
|
||||||
snmpgetcommand = "snmpget %s %s %s" % (snmp_options,opts.host,oid)
|
snmpgetcommand = "snmpget %s %s %s" % (snmp_options, opts.host, oid)
|
||||||
output = runCommand(snmpgetcommand)
|
output = runCommand(snmpgetcommand)
|
||||||
oid,result = output.strip().split(' = ', 1)
|
oid, result = output.strip().split(' = ', 1)
|
||||||
resultType,resultValue = result.split(': ',1)
|
resultType, resultValue = result.split(': ', 1)
|
||||||
if resultType == 'STRING': # strip quotes of the string
|
if resultType == 'STRING': # strip quotes of the string
|
||||||
resultValue = resultValue[1:-1]
|
resultValue = resultValue[1:-1]
|
||||||
return resultValue
|
return resultValue
|
||||||
|
|
||||||
# snmpwalk -v3 -u v3get mgmt-rek-proxy-p02 -A proxy2011 -l authNoPriv 1.3.6.1.4.1.15497
|
# snmpwalk -v3 -u v3get mgmt-rek-proxy-p02 -A proxy2011 -l authNoPriv
|
||||||
|
# 1.3.6.1.4.1.15497
|
||||||
|
|
||||||
|
|
||||||
def snmpwalk(base_oid):
|
def snmpwalk(base_oid):
|
||||||
snmpwalkcommand = "snmpwalk %s %s %s" % (snmp_options, opts.host, base_oid)
|
snmpwalkcommand = "snmpwalk %s %s %s" % (snmp_options, opts.host, base_oid)
|
||||||
output = runCommand(snmpwalkcommand + " " + base_oid)
|
output = runCommand(snmpwalkcommand + " " + base_oid)
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
def getTable(base_oid):
|
def getTable(base_oid):
|
||||||
myTable = {}
|
myTable = {}
|
||||||
output = snmpwalk(base_oid)
|
output = snmpwalk(base_oid)
|
||||||
for line in output.split('\n'):
|
for line in output.split('\n'):
|
||||||
tmp = line.strip().split(' = ', 1)
|
tmp = line.strip().split(' = ', 1)
|
||||||
if len(tmp) == 2:
|
if len(tmp) == 2:
|
||||||
oid,result = tmp
|
oid, result = tmp
|
||||||
else:
|
else:
|
||||||
continue
|
continue
|
||||||
tmp = result.split(': ',1)
|
tmp = result.split(': ', 1)
|
||||||
if len(tmp) > 1:
|
if len(tmp) > 1:
|
||||||
resultType,resultValue = tmp[0],tmp[1]
|
resultType, resultValue = tmp[0], tmp[1]
|
||||||
else:
|
else:
|
||||||
resultType = None
|
resultType = None
|
||||||
resultValue = tmp[0]
|
resultValue = tmp[0]
|
||||||
@@ -215,10 +231,12 @@ def getTable(base_oid):
|
|||||||
index = oid.strip().split('.')
|
index = oid.strip().split('.')
|
||||||
column = int(index.pop())
|
column = int(index.pop())
|
||||||
row = int(index.pop())
|
row = int(index.pop())
|
||||||
if not myTable.has_key(column): myTable[column] = {}
|
if not myTable.has_key(column):
|
||||||
|
myTable[column] = {}
|
||||||
myTable[column][row] = resultValue
|
myTable[column][row] = resultValue
|
||||||
return myTable
|
return myTable
|
||||||
|
|
||||||
|
|
||||||
def check_powermodules():
|
def check_powermodules():
|
||||||
powermodules = getTable('1.3.6.1.4.1.2.3.51.2.2.4')
|
powermodules = getTable('1.3.6.1.4.1.2.3.51.2.2.4')
|
||||||
index = 1
|
index = 1
|
||||||
@@ -232,22 +250,27 @@ def check_powermodules():
|
|||||||
myStatus = i[status]
|
myStatus = i[status]
|
||||||
myDetails = i[details]
|
myDetails = i[details]
|
||||||
myExists = i[exists]
|
myExists = i[exists]
|
||||||
if myIndex == opts.exclude: continue
|
if myIndex == opts.exclude:
|
||||||
|
continue
|
||||||
if myExists == "0":
|
if myExists == "0":
|
||||||
num_no = num_no + 1
|
num_no = num_no + 1
|
||||||
else:
|
else:
|
||||||
if myStatus != "1":
|
if myStatus != "1":
|
||||||
nagios_status(warning)
|
nagios_status(warning)
|
||||||
add_summary( 'Powermodule "%s" status "%s". %s. ' % (myIndex,myStatus,myDetails) )
|
add_summary('Powermodule "%s" status "%s". %s. ' %
|
||||||
|
(myIndex, myStatus, myDetails))
|
||||||
else:
|
else:
|
||||||
num_ok = num_ok + 1
|
num_ok = num_ok + 1
|
||||||
add_long('Powersupply "%s" status "%s". %s. ' % (myIndex,myStatus,myDetails) )
|
add_long('Powersupply "%s" status "%s". %s. ' %
|
||||||
add_summary( "%s out of %s powermodules are healthy" % (num_ok, len(powermodules) ) )
|
(myIndex, myStatus, myDetails))
|
||||||
add_perfdata( "'Number of powermodules'=%s" % (len(powermodules) - num_no ) )
|
add_summary("%s out of %s powermodules are healthy" %
|
||||||
|
(num_ok, len(powermodules)))
|
||||||
|
add_perfdata("'Number of powermodules'=%s" %
|
||||||
|
(len(powermodules) - num_no))
|
||||||
|
|
||||||
nagios_status(ok)
|
nagios_status(ok)
|
||||||
|
|
||||||
|
|
||||||
def check_switchmodules():
|
def check_switchmodules():
|
||||||
switchmodules = getTable("1.3.6.1.4.1.2.3.51.2.22.3.1.1")
|
switchmodules = getTable("1.3.6.1.4.1.2.3.51.2.22.3.1.1")
|
||||||
# The following oid is undocumented, but contains some useful extra info
|
# The following oid is undocumented, but contains some useful extra info
|
||||||
@@ -265,18 +288,21 @@ def check_switchmodules():
|
|||||||
'this module is installed'
|
'this module is installed'
|
||||||
if healthstate == "1":
|
if healthstate == "1":
|
||||||
nagios_status(ok)
|
nagios_status(ok)
|
||||||
add_long("Module%s health good.\n post=%s" % (myIndex,resultvalue))
|
add_long("Module%s health good.\n post=%s" %
|
||||||
|
(myIndex, resultvalue))
|
||||||
else:
|
else:
|
||||||
nagios_status(warning)
|
nagios_status(warning)
|
||||||
add_long("Module%s health bad(%s).\n post=%s" % (myIndex, healthstate,resultvalue) )
|
add_long("Module%s health bad(%s).\n post=%s" %
|
||||||
|
(myIndex, healthstate, resultvalue))
|
||||||
add_summary("Problem with Module %s. " % (myIndex))
|
add_summary("Problem with Module %s. " % (myIndex))
|
||||||
if len(extrainfo) > int(myIndex):
|
if len(extrainfo) > int(myIndex):
|
||||||
try:
|
try:
|
||||||
myExtraInfo = extrainfo[int(myIndex)-1]
|
myExtraInfo = extrainfo[int(myIndex) - 1]
|
||||||
module_type = myExtraInfo[22]
|
module_type = myExtraInfo[22]
|
||||||
module_ip = myExtraInfo[6]
|
module_ip = myExtraInfo[6]
|
||||||
add_long( " type=%s ip=%s" % (module_type,module_ip) )
|
add_long(" type=%s ip=%s" % (module_type, module_ip))
|
||||||
except: pass
|
except:
|
||||||
|
pass
|
||||||
if exit_status == ok:
|
if exit_status == ok:
|
||||||
add_summary("All switchmodules healthy")
|
add_summary("All switchmodules healthy")
|
||||||
|
|
||||||
@@ -291,14 +317,14 @@ def check_blowers():
|
|||||||
blower2speed = snmpget("1.3.6.1.4.1.2.3.51.2.2.3.2.0")
|
blower2speed = snmpget("1.3.6.1.4.1.2.3.51.2.2.3.2.0")
|
||||||
blower2state = snmpget("1.3.6.1.4.1.2.3.51.2.2.3.11.0")
|
blower2state = snmpget("1.3.6.1.4.1.2.3.51.2.2.3.11.0")
|
||||||
|
|
||||||
add_long( "Blower 1 state=%s speed=%s" % (blower1state,blower1speed) )
|
add_long("Blower 1 state=%s speed=%s" % (blower1state, blower1speed))
|
||||||
add_long( "Blower 2 state=%s speed=%s" % (blower2state,blower2speed) )
|
add_long("Blower 2 state=%s speed=%s" % (blower2state, blower2speed))
|
||||||
add_perfdata("blower1=%s" %(blower1speed.split(None,1)[0] ))
|
add_perfdata("blower1=%s" % (blower1speed.split(None, 1)[0]))
|
||||||
add_perfdata("blower2=%s" %(blower2speed.split(None,1)[0] ))
|
add_perfdata("blower2=%s" % (blower2speed.split(None, 1)[0]))
|
||||||
# Check blower 1
|
# Check blower 1
|
||||||
if blower1state == "1":
|
if blower1state == "1":
|
||||||
nagios_status(ok)
|
nagios_status(ok)
|
||||||
add_summary("Blower1 OK. " )
|
add_summary("Blower1 OK. ")
|
||||||
else:
|
else:
|
||||||
add_summary("Blower1 NOT OK. ")
|
add_summary("Blower1 NOT OK. ")
|
||||||
nagios_status(warning)
|
nagios_status(warning)
|
||||||
@@ -306,7 +332,7 @@ def check_blowers():
|
|||||||
# Check blower 2
|
# Check blower 2
|
||||||
if blower2state == "1":
|
if blower2state == "1":
|
||||||
nagios_status(ok)
|
nagios_status(ok)
|
||||||
add_summary("Blower2 OK. " )
|
add_summary("Blower2 OK. ")
|
||||||
else:
|
else:
|
||||||
add_summary("Blower2 NOT OK. ")
|
add_summary("Blower2 NOT OK. ")
|
||||||
nagios_status(warning)
|
nagios_status(warning)
|
||||||
@@ -319,33 +345,33 @@ def check_chassis_status():
|
|||||||
chassis = getTable('1.3.6.1.4.1.2.3.51.2.2.5.2')
|
chassis = getTable('1.3.6.1.4.1.2.3.51.2.2.5.2')
|
||||||
oids = chassis.values()[0]
|
oids = chassis.values()[0]
|
||||||
chassis_oid = {
|
chassis_oid = {
|
||||||
1 :"bistSdram",
|
1: "bistSdram",
|
||||||
10 :"bistBootRomFlashImage",
|
10: "bistBootRomFlashImage",
|
||||||
11 :"bistEthernetPort1",
|
11: "bistEthernetPort1",
|
||||||
113 :"bistSwitchModulesCommunicating",
|
113: "bistSwitchModulesCommunicating",
|
||||||
12 :"bistEthernetPort2",
|
12: "bistEthernetPort2",
|
||||||
13 :"bistInternalPCIBus",
|
13: "bistInternalPCIBus",
|
||||||
14 :"bistExternalI2CDevices",
|
14: "bistExternalI2CDevices",
|
||||||
15 :"bistUSBController",
|
15: "bistUSBController",
|
||||||
16 :"bistVideoCompressorBoard",
|
16: "bistVideoCompressorBoard",
|
||||||
17 :"bistPrimaryBus",
|
17: "bistPrimaryBus",
|
||||||
18 :"bistInternalEthernetSwitch",
|
18: "bistInternalEthernetSwitch",
|
||||||
2 :"bistRs485Port1",
|
2: "bistRs485Port1",
|
||||||
3 :"bistRs485Port2",
|
3: "bistRs485Port2",
|
||||||
33 :"bistBladesInstalled",
|
33: "bistBladesInstalled",
|
||||||
4 :"bistNvram",
|
4: "bistNvram",
|
||||||
49 :"bistBladesCommunicating",
|
49: "bistBladesCommunicating",
|
||||||
6 :"bistRtc",
|
6: "bistRtc",
|
||||||
65 :"bistBlowersInstalled",
|
65: "bistBlowersInstalled",
|
||||||
7 :"bistLocalI2CBus",
|
7: "bistLocalI2CBus",
|
||||||
73 :"bistBlowersFunctional",
|
73: "bistBlowersFunctional",
|
||||||
74 :"bistMediaTrayInstalled",
|
74: "bistMediaTrayInstalled",
|
||||||
75 :"bistMediaTrayCommunicating",
|
75: "bistMediaTrayCommunicating",
|
||||||
8 :"bistPrimaryMainAppFlashImage",
|
8: "bistPrimaryMainAppFlashImage",
|
||||||
81 :"bistPowerModulesInstalled",
|
81: "bistPowerModulesInstalled",
|
||||||
89 :"bistPowerModulesFunctional",
|
89: "bistPowerModulesFunctional",
|
||||||
9 :"bistSecondaryMainAppFlashImage",
|
9: "bistSecondaryMainAppFlashImage",
|
||||||
97 :"bistSwitchModulesInstalled",
|
97: "bistSwitchModulesInstalled",
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check if all blades are working
|
# Check if all blades are working
|
||||||
@@ -363,59 +389,60 @@ def check_chassis_status():
|
|||||||
|
|
||||||
# Check Blade Communications
|
# Check Blade Communications
|
||||||
if not oids.has_key(bistBladesInstalled) or not oids.has_key(bistBladesCommunicating):
|
if not oids.has_key(bistBladesInstalled) or not oids.has_key(bistBladesCommunicating):
|
||||||
add_summary( "Blades N/A. ")
|
add_summary("Blades N/A. ")
|
||||||
elif oids[bistBladesInstalled] == oids[bistBladesCommunicating]:
|
elif oids[bistBladesInstalled] == oids[bistBladesCommunicating]:
|
||||||
nagios_status(ok)
|
nagios_status(ok)
|
||||||
add_summary( "Blades OK. " )
|
add_summary("Blades OK. ")
|
||||||
else:
|
else:
|
||||||
nagios_status(warning)
|
nagios_status(warning)
|
||||||
add_summary( "Blades NOT OK. " )
|
add_summary("Blades NOT OK. ")
|
||||||
# Check PowerModule Status
|
# Check PowerModule Status
|
||||||
if not oids.has_key(bistPowerModulesFunctional) or not oids.has_key(bistPowerModulesInstalled):
|
if not oids.has_key(bistPowerModulesFunctional) or not oids.has_key(bistPowerModulesInstalled):
|
||||||
add_summary( "Powermodules N/A. ")
|
add_summary("Powermodules N/A. ")
|
||||||
elif oids[bistPowerModulesFunctional] == oids[bistPowerModulesInstalled]:
|
elif oids[bistPowerModulesFunctional] == oids[bistPowerModulesInstalled]:
|
||||||
nagios_status(ok)
|
nagios_status(ok)
|
||||||
add_summary( "PowerModules OK. " )
|
add_summary("PowerModules OK. ")
|
||||||
else:
|
else:
|
||||||
nagios_status(warning)
|
nagios_status(warning)
|
||||||
add_summary( "PowerModules NOT OK. " )
|
add_summary("PowerModules NOT OK. ")
|
||||||
|
|
||||||
# Check SwitcModule Communications
|
# Check SwitcModule Communications
|
||||||
if not oids.has_key(bistSwitchModulesCommunicating) or not oids.has_key(bistSwitchModulesInstalled):
|
if not oids.has_key(bistSwitchModulesCommunicating) or not oids.has_key(bistSwitchModulesInstalled):
|
||||||
add_summary( "SwitchModules N/A. ")
|
add_summary("SwitchModules N/A. ")
|
||||||
if oids[bistSwitchModulesCommunicating] == oids[bistSwitchModulesInstalled]:
|
if oids[bistSwitchModulesCommunicating] == oids[bistSwitchModulesInstalled]:
|
||||||
nagios_status(ok)
|
nagios_status(ok)
|
||||||
add_summary("Switchmodules OK. ")
|
add_summary("Switchmodules OK. ")
|
||||||
else:
|
else:
|
||||||
nagios_status(warning)
|
nagios_status(warning)
|
||||||
add_summary( "Switchmodules NOT OK. ")
|
add_summary("Switchmodules NOT OK. ")
|
||||||
# Check blower status
|
# Check blower status
|
||||||
if not oids.has_key(bistBlowersInstalled) or not oids.has_key(bistBlowersFunctional):
|
if not oids.has_key(bistBlowersInstalled) or not oids.has_key(bistBlowersFunctional):
|
||||||
add_summary( "Blowers N/A. ")
|
add_summary("Blowers N/A. ")
|
||||||
elif oids[bistBlowersInstalled] == oids[bistBlowersFunctional]:
|
elif oids[bistBlowersInstalled] == oids[bistBlowersFunctional]:
|
||||||
nagios_status(ok)
|
nagios_status(ok)
|
||||||
add_summary( "Blowers OK. " )
|
add_summary("Blowers OK. ")
|
||||||
else:
|
else:
|
||||||
nagios_status(warning)
|
nagios_status(warning)
|
||||||
add_summary( "Blowers NOT OK. " )
|
add_summary("Blowers NOT OK. ")
|
||||||
# Check Media Tray Status
|
# Check Media Tray Status
|
||||||
if not oids.has_key(bistMediaTrayCommunicating) or not oids.has_key(bistMediaTrayInstalled):
|
if not oids.has_key(bistMediaTrayCommunicating) or not oids.has_key(bistMediaTrayInstalled):
|
||||||
nagios_status(ok)
|
nagios_status(ok)
|
||||||
add_summary( "Media Trays N/A. ")
|
add_summary("Media Trays N/A. ")
|
||||||
elif oids[bistMediaTrayCommunicating] == oids[bistMediaTrayInstalled]:
|
elif oids[bistMediaTrayCommunicating] == oids[bistMediaTrayInstalled]:
|
||||||
add_summary( "Media Trays OK. " )
|
add_summary("Media Trays OK. ")
|
||||||
else:
|
else:
|
||||||
nagios_status(warning)
|
nagios_status(warning)
|
||||||
add_summary( "Media Trays NOT OK. " )
|
add_summary("Media Trays NOT OK. ")
|
||||||
|
|
||||||
|
|
||||||
# status_oids, oids that where 0 == ok
|
# status_oids, oids that where 0 == ok
|
||||||
status_oids = ( 2,3,5,7,8,9,10,11,14,18,19,20,21,22,23,24,25,26,27,28,29,30, )
|
status_oids = (2, 3, 5, 7, 8, 9, 10, 11, 14, 18,
|
||||||
|
19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, )
|
||||||
|
|
||||||
add_long("Other Sensors: ")
|
add_long("Other Sensors: ")
|
||||||
sensor_status = ok
|
sensor_status = ok
|
||||||
for oid in status_oids:
|
for oid in status_oids:
|
||||||
if not chassis_oid.has_key(oid): continue
|
if not chassis_oid.has_key(oid):
|
||||||
|
continue
|
||||||
oidValue = oids[oid]
|
oidValue = oids[oid]
|
||||||
oidName = chassis_oid[oid]
|
oidName = chassis_oid[oid]
|
||||||
if oidValue == "0":
|
if oidValue == "0":
|
||||||
@@ -424,28 +451,32 @@ def check_chassis_status():
|
|||||||
friendly_status = "%s (not ok)" % oidValue
|
friendly_status = "%s (not ok)" % oidValue
|
||||||
nagios_status(warning)
|
nagios_status(warning)
|
||||||
sensor_status = warning
|
sensor_status = warning
|
||||||
add_summary( "%s is %s" % oidName, friendly_status)
|
add_summary("%s is %s" % oidName, friendly_status)
|
||||||
add_long( " %s status: %s" % (oidName,friendly_status) )
|
add_long(" %s status: %s" % (oidName, friendly_status))
|
||||||
if sensor_status == ok:
|
if sensor_status == ok:
|
||||||
add_summary( "Other Sensors: OK. ")
|
add_summary("Other Sensors: OK. ")
|
||||||
|
|
||||||
|
|
||||||
def check_bladehealth():
|
def check_bladehealth():
|
||||||
blades = getTable('1.3.6.1.4.1.2.3.51.2.22.1.5.2.1')
|
blades = getTable('1.3.6.1.4.1.2.3.51.2.22.1.5.2.1')
|
||||||
bladestate = getTable('1.3.6.1.4.1.2.3.51.2.22.1.5.1.1').values()
|
bladestate = getTable('1.3.6.1.4.1.2.3.51.2.22.1.5.1.1').values()
|
||||||
|
|
||||||
index,bladeid,severity,description = (1,2,3,4)
|
index, bladeid, severity, description = (1, 2, 3, 4)
|
||||||
good_blades = 0
|
good_blades = 0
|
||||||
total_blades = 0
|
total_blades = 0
|
||||||
for i,row in enumerate(blades.values()):
|
for i, row in enumerate(blades.values()):
|
||||||
myIndex = row[index]
|
myIndex = row[index]
|
||||||
myBladeid = row[bladeid]
|
myBladeid = row[bladeid]
|
||||||
mySeverity = row[severity]
|
mySeverity = row[severity]
|
||||||
myDescription = row[description]
|
myDescription = row[description]
|
||||||
try: myName = bladestate[i][6]
|
try:
|
||||||
except: myName = ""
|
myName = bladestate[i][6]
|
||||||
if mySeverity == "(No severity)": continue
|
except:
|
||||||
add_long( "blade%s (%s): %s %s" % (myBladeid,myName,mySeverity, myDescription) )
|
myName = ""
|
||||||
|
if mySeverity == "(No severity)":
|
||||||
|
continue
|
||||||
|
add_long("blade%s (%s): %s %s" %
|
||||||
|
(myBladeid, myName, mySeverity, myDescription))
|
||||||
if opts.exclude:
|
if opts.exclude:
|
||||||
if myDescription.find(opts.exclude) > -1:
|
if myDescription.find(opts.exclude) > -1:
|
||||||
continue
|
continue
|
||||||
@@ -455,27 +486,33 @@ def check_bladehealth():
|
|||||||
good_blades += 1
|
good_blades += 1
|
||||||
else:
|
else:
|
||||||
nagios_status(warning)
|
nagios_status(warning)
|
||||||
add_summary( "blade%s (%s): %s %s. " % (myBladeid,myName,mySeverity, myDescription) )
|
add_summary("blade%s (%s): %s %s. " %
|
||||||
|
(myBladeid, myName, mySeverity, myDescription))
|
||||||
if good_blades == total_blades:
|
if good_blades == total_blades:
|
||||||
add_summary( "%s out of %s blades in Good health. " % (good_blades, total_blades))
|
add_summary("%s out of %s blades in Good health. " %
|
||||||
|
(good_blades, total_blades))
|
||||||
nagios_status(ok)
|
nagios_status(ok)
|
||||||
else:
|
else:
|
||||||
nagios_status(warning)
|
nagios_status(warning)
|
||||||
|
|
||||||
|
|
||||||
def check_systemhealth():
|
def check_systemhealth():
|
||||||
systemhealthstat = snmpget('1.3.6.1.4.1.2.3.51.2.2.7.1.0')
|
systemhealthstat = snmpget('1.3.6.1.4.1.2.3.51.2.2.7.1.0')
|
||||||
summary = getTable('1.3.6.1.4.1.2.3.51.2.2.7.2.1')
|
summary = getTable('1.3.6.1.4.1.2.3.51.2.2.7.2.1')
|
||||||
index,severity,description,date = (1,2,3,4)
|
index, severity, description, date = (1, 2, 3, 4)
|
||||||
# Sometimes chassis delivers warning when absolutely nothing is going on. Lets work around that
|
# Sometimes chassis delivers warning when absolutely nothing is going on.
|
||||||
|
# Lets work around that
|
||||||
workaround = [{1: '1', 2: 'Good', 3: 'No critical or warning events', 4: 'No timestamp'}]
|
workaround = [{1: '1', 2: 'Good', 3: 'No critical or warning events', 4: 'No timestamp'}]
|
||||||
# Check overall health
|
# Check overall health
|
||||||
if systemhealthstat == '255':
|
if systemhealthstat == '255':
|
||||||
nagios_status(ok)
|
nagios_status(ok)
|
||||||
add_summary("Bladecenter health: OK. ")
|
add_summary("Bladecenter health: OK. ")
|
||||||
elif systemhealthstat == "2":
|
elif summary.values() == workaround:
|
||||||
if summary.values() == workaround:
|
add_summary("Non-Critical Error (bug in firmware): '%s' " %
|
||||||
add_summary("Non-Critical Error: %s " % workaround[0][description] )
|
workaround[0][description])
|
||||||
nagios_status(ok)
|
nagios_status(ok)
|
||||||
return
|
return
|
||||||
|
elif systemhealthstat == "2":
|
||||||
nagios_status(warning)
|
nagios_status(warning)
|
||||||
add_summary("Non-Critical Error. ")
|
add_summary("Non-Critical Error. ")
|
||||||
elif systemhealthstat == "4":
|
elif systemhealthstat == "4":
|
||||||
@@ -486,7 +523,9 @@ def check_systemhealth():
|
|||||||
add_summary("Critical. ")
|
add_summary("Critical. ")
|
||||||
else:
|
else:
|
||||||
nagios_status(unknown)
|
nagios_status(unknown)
|
||||||
add_summary("Bladecenter health unkown (oid 1.3.6.1.4.1.2.3.51.2.2.7.1.0 returns %s). " % systemhealthstat)
|
add_summary(
|
||||||
|
"Bladecenter health unkown (oid 1.3.6.1.4.1.2.3.51.2.2.7.1.0 returns %s). " %
|
||||||
|
systemhealthstat)
|
||||||
for row in summary.values():
|
for row in summary.values():
|
||||||
if row[severity] == 'Good':
|
if row[severity] == 'Good':
|
||||||
nagios_status(ok)
|
nagios_status(ok)
|
||||||
@@ -496,30 +535,37 @@ def check_systemhealth():
|
|||||||
nagios_status(warning)
|
nagios_status(warning)
|
||||||
else:
|
else:
|
||||||
nagios_status(critical)
|
nagios_status(critical)
|
||||||
add_summary( "%s. " % (row[description]) )
|
add_summary("%s. " % (row[description]))
|
||||||
add_long( "* %s. " % (row[description]) )
|
add_long("* %s. " % (row[description]))
|
||||||
|
|
||||||
|
|
||||||
def check_temperature():
|
def check_temperature():
|
||||||
# set some sensible defaults
|
# set some sensible defaults
|
||||||
if opts.warning_threshold is None: opts.warning_threshold = 28
|
if opts.warning_threshold is None:
|
||||||
if opts.critical_threshold is None: opts.critical_threshold = 35
|
opts.warning_threshold = 28
|
||||||
|
if opts.critical_threshold is None:
|
||||||
|
opts.critical_threshold = 35
|
||||||
str_temp = snmpget('1.3.6.1.4.1.2.3.51.2.2.1.5.1.0')
|
str_temp = snmpget('1.3.6.1.4.1.2.3.51.2.2.1.5.1.0')
|
||||||
float_temp,measurement = str_temp.split(None, 1)
|
float_temp, measurement = str_temp.split(None, 1)
|
||||||
float_temp = float( float_temp )
|
float_temp = float(float_temp)
|
||||||
if opts.critical_threshold is not None and float_temp > opts.critical_threshold:
|
if opts.critical_threshold is not None and float_temp > opts.critical_threshold:
|
||||||
nagios_status(critical)
|
nagios_status(critical)
|
||||||
add_summary( "ambient temperature (%s) is over critical thresholds (%s). " % (str_temp, opts.critical_threshold) )
|
add_summary(
|
||||||
|
"ambient temperature (%s) is over critical thresholds (%s). " %
|
||||||
|
(str_temp, opts.critical_threshold))
|
||||||
elif opts.warning_threshold is not None and float_temp > opts.warning_threshold:
|
elif opts.warning_threshold is not None and float_temp > opts.warning_threshold:
|
||||||
nagios_status(warning)
|
nagios_status(warning)
|
||||||
add_summary( "ambient temperature (%s) is over warning thresholds (%s). " % (str_temp, opts.warning_threshold) )
|
add_summary(
|
||||||
|
"ambient temperature (%s) is over warning thresholds (%s). " %
|
||||||
|
(str_temp, opts.warning_threshold))
|
||||||
else:
|
else:
|
||||||
add_summary( "Ambient temperature = %s. " % (str_temp) )
|
add_summary("Ambient temperature = %s. " % (str_temp))
|
||||||
add_perfdata( "'ambient_temp'=%s;%s;%s " % (float_temp,opts.warning_threshold,opts.critical_threshold) )
|
add_perfdata("'ambient_temp'=%s;%s;%s " %
|
||||||
|
(float_temp, opts.warning_threshold, opts.critical_threshold))
|
||||||
#add_long( "Ambient Temperature = %s" % (str_temp) )
|
#add_long( "Ambient Temperature = %s" % (str_temp) )
|
||||||
nagios_status(ok)
|
nagios_status(ok)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
try:
|
try:
|
||||||
set_snmp_options()
|
set_snmp_options()
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Summary: A Nagios plugin to check IBM Bladecenters
|
Summary: A Nagios plugin to check IBM Bladecenters
|
||||||
Name: nagios-okplugin-check_ibm_bladecenter
|
Name: nagios-okplugin-check_ibm_bladecenter
|
||||||
Version: 2
|
Version: 4
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
Group: Applications/System
|
Group: Applications/System
|
||||||
@@ -40,6 +40,16 @@ rm -rf %{buildroot}
|
|||||||
#%config(noreplace) %{_sysconfdir}/nrpe.d/check_bond.cfg
|
#%config(noreplace) %{_sysconfdir}/nrpe.d/check_bond.cfg
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Feb 21 2014 Pall Sigurdsson <palli@opensource.is> 4-1
|
||||||
|
-
|
||||||
|
|
||||||
|
* Fri Feb 21 2014 Unknown name 3-1
|
||||||
|
- Merge branch 'master' of github.com:opinkerfi/nagios-plugins
|
||||||
|
(palli@opensource.is)
|
||||||
|
- ibm_bladecenter - another firmware bug workaround (palli@opensource.is)
|
||||||
|
- pep8 fixes (palli@opensource.is)
|
||||||
|
- Fix workaround for firmware bug (palli@opensource.is)
|
||||||
|
|
||||||
* Thu Feb 20 2014 Pall Sigurdsson <palli@opensource.is> 2-1
|
* Thu Feb 20 2014 Pall Sigurdsson <palli@opensource.is> 2-1
|
||||||
- Merge branch 'master' of github.com:opinkerfi/misc (palli@opensource.is)
|
- Merge branch 'master' of github.com:opinkerfi/misc (palli@opensource.is)
|
||||||
- --exclude option added. Added workaround around false positives
|
- --exclude option added. Added workaround around false positives
|
||||||
|
|||||||
@@ -46,10 +46,13 @@ except Exception, e:
|
|||||||
# Loop through replication agreements
|
# Loop through replication agreements
|
||||||
for rhost in replication:
|
for rhost in replication:
|
||||||
plugin.add_summary("Replica %s Status: %s" % (rhost[1]['nsDS5ReplicaHost'][0], rhost[1]['nsds5replicaLastUpdateStatus'][0]))
|
plugin.add_summary("Replica %s Status: %s" % (rhost[1]['nsDS5ReplicaHost'][0], rhost[1]['nsds5replicaLastUpdateStatus'][0]))
|
||||||
if rhost[1]['nsds5replicaLastUpdateStatus'][0][:2] != "0 ":
|
if rhost[1]['nsds5replicaLastUpdateStatus'][0][:2] == "0 ":
|
||||||
plugin.status(critical)
|
|
||||||
else:
|
|
||||||
plugin.status(ok)
|
plugin.status(ok)
|
||||||
|
elif rhost[1]['nsds5replicaLastUpdateStatus'][0][:2] == "1 ":
|
||||||
|
# Busy Replica is not an error, its "unknown" (but its "ok" for now)
|
||||||
|
plugin.status(ok)
|
||||||
|
else:
|
||||||
|
plugin.status(critical)
|
||||||
|
|
||||||
if not len(replication):
|
if not len(replication):
|
||||||
plugin.add_summary("Warning: No replicas found")
|
plugin.add_summary("Warning: No replicas found")
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|
||||||
|
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
%define debug_package %{nil}
|
%define debug_package %{nil}
|
||||||
%define plugin check_msa_hardware
|
%define plugin check_msa_hardware
|
||||||
%define packager Pall Sigurdsson <palli@opensource.is>
|
%define packager Gardar Thorsteinsson <gardar@ok.is>
|
||||||
|
|
||||||
Summary: A Nagios plugin to check status of an MSA (HP P2000) disk array
|
Summary: A Nagios plugin to check status of an MSA (HP P2000) disk array
|
||||||
Name: nagios-okplugin-%{plugin}
|
Name: nagios-okplugin-%{plugin}
|
||||||
Version: 1.0.5
|
Version: 1.0.5
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
License: GPLv3+
|
License: GPLv3+
|
||||||
Group: Applications/System
|
Group: Applications/System
|
||||||
URL: https://github.com/opinkerfi/nagios-plugins/tree/master/%{plugin}
|
URL: https://github.com/opinkerfi/nagios-plugins/tree/master/%{plugin}
|
||||||
@@ -21,6 +21,8 @@ Checks status of a remote MSA disk array, also known as HP P2000
|
|||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
|
|
||||||
|
%global __requires_exclude %{?__requires_exclude:%__requires_exclude}|}^perl\\(utils\\)
|
||||||
|
|
||||||
%build
|
%build
|
||||||
|
|
||||||
|
|
||||||
@@ -46,6 +48,9 @@ rm -rf %{buildroot}
|
|||||||
%config(noreplace) %{_sysconfdir}/nrpe.d/%{plugin}.cfg
|
%config(noreplace) %{_sysconfdir}/nrpe.d/%{plugin}.cfg
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri May 09 2018 Gardar Thorsteinsson <gardar@ok.is> 1.0.5-2
|
||||||
|
- Filter out perl-utils dep
|
||||||
|
|
||||||
* Thu Jan 30 2014 Pall Sigurdsson <palli@opensource.is> 1.0.5-1
|
* Thu Jan 30 2014 Pall Sigurdsson <palli@opensource.is> 1.0.5-1
|
||||||
-
|
-
|
||||||
|
|
||||||
|
|||||||
@@ -48,9 +48,9 @@ print_help() {
|
|||||||
|
|
||||||
echo "Add this to your sudoers file by running visudo to add access:"
|
echo "Add this to your sudoers file by running visudo to add access:"
|
||||||
if [ -r /proc/modules ]; then
|
if [ -r /proc/modules ]; then
|
||||||
echo "Cmnd_Alias MULTIPATH=$MULTIPATH -l"
|
echo "Cmnd_Alias MULTIPATH=$MULTIPATH -ll"
|
||||||
else
|
else
|
||||||
echo "Cmnd_Alias MULTIPATH=$MULTIPATH -l, $SUDO"
|
echo "Cmnd_Alias MULTIPATH=$MULTIPATH -ll, $SUDO"
|
||||||
fi
|
fi
|
||||||
echo "nagios ALL= NOPASSWD: MULTIPATH"
|
echo "nagios ALL= NOPASSWD: MULTIPATH"
|
||||||
echo "The user nagios may very well be nobody or someone else depending on your configuration"
|
echo "The user nagios may very well be nobody or someone else depending on your configuration"
|
||||||
@@ -98,7 +98,7 @@ if [ $(id -un) != "root" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
OUTPUT=$($MULTIPATH -l 2>/dev/null)
|
OUTPUT=$($MULTIPATH -ll 2>/dev/null)
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
# Failed. grab more info why
|
# Failed. grab more info why
|
||||||
if [ $(id -un) != "root" ] && [ `$SUDO -l | grep -c multipath` -eq 0 ]; then
|
if [ $(id -un) != "root" ] && [ `$SUDO -l | grep -c multipath` -eq 0 ]; then
|
||||||
@@ -112,7 +112,7 @@ if [ $? != 0 ]; then
|
|||||||
exit $STATE_UNKNOWN
|
exit $STATE_UNKNOWN
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "MULTIPATH: $(MULTIPATH -l 2>&1)"
|
echo "MULTIPATH: $($MULTIPATH -ll 2>&1)"
|
||||||
exit $STATE_UNKNOWN
|
exit $STATE_UNKNOWN
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -137,6 +137,7 @@ if [ "$NUMPATHS" ]; then
|
|||||||
/^ \\/ {targets++; next} # count targets (lenny)
|
/^ \\/ {targets++; next} # count targets (lenny)
|
||||||
/[0-9]+:[0-9]+:[0-9]+:[0-9]+/ {
|
/[0-9]+:[0-9]+:[0-9]+:[0-9]+/ {
|
||||||
if (/active undef running/) { targets++ } # count targets (squeeze)
|
if (/active undef running/) { targets++ } # count targets (squeeze)
|
||||||
|
if (/active ready running/) { targets++ } # count targets (RHEL6)
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|
||||||
|
|||||||
@@ -72,12 +72,11 @@ def getLocalNodeState(dom):
|
|||||||
"""
|
"""
|
||||||
Get the state of the local node
|
Get the state of the local node
|
||||||
"""
|
"""
|
||||||
hostname = socket.gethostname()
|
|
||||||
nodesList = dom.getElementsByTagName('node')
|
nodesList = dom.getElementsByTagName('node')
|
||||||
nodeState = {}
|
nodeState = {}
|
||||||
|
|
||||||
for node in nodesList:
|
for node in nodesList:
|
||||||
if node.attributes['name'].value == hostname:
|
if node.attributes['local'].value == "1":
|
||||||
nodeState['name'] = node.attributes['name'].value
|
nodeState['name'] = node.attributes['name'].value
|
||||||
nodeState['state'] = node.attributes['state'].value
|
nodeState['state'] = node.attributes['state'].value
|
||||||
nodeState['rgmanager'] = node.attributes['rgmanager'].value
|
nodeState['rgmanager'] = node.attributes['rgmanager'].value
|
||||||
@@ -95,7 +94,6 @@ def getServiceState(dom, service):
|
|||||||
Get the state of the named service
|
Get the state of the named service
|
||||||
"""
|
"""
|
||||||
groupList = dom.getElementsByTagName('group')
|
groupList = dom.getElementsByTagName('group')
|
||||||
hostname = socket.gethostname()
|
|
||||||
serviceState = {}
|
serviceState = {}
|
||||||
for group in groupList:
|
for group in groupList:
|
||||||
if group.attributes['name'].value in (service,"service:"+service,"vm:"+service):
|
if group.attributes['name'].value in (service,"service:"+service,"vm:"+service):
|
||||||
|
|||||||
@@ -74,17 +74,17 @@ OUTPUT=`$CHECK_COMMAND`
|
|||||||
RESULT=$?
|
RESULT=$?
|
||||||
|
|
||||||
if [ $RESULT -gt 0 ]; then
|
if [ $RESULT -gt 0 ]; then
|
||||||
echo "Error - Could not run command $CHECK_COMMAND"
|
echo "UNKNOWN - Could not run command $CHECK_COMMAND"
|
||||||
echo "Error was: $OUTPUT"
|
echo "Error was: $OUTPUT"
|
||||||
exit 3
|
exit 3
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Parse the output from the command
|
# Parse the output from the command
|
||||||
if [ "$OUTPUT" == "$STATUS" ]; then
|
if [ "$OUTPUT" == "$STATUS" ]; then
|
||||||
echo "ok, selinux status is $OUTPUT"
|
echo "OK - SELinux status is $OUTPUT"
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
echo "warning, selinux status is $OUTPUT (supposed to be $STATUS)"
|
echo "WARNING - SELinux status is $OUTPUT (supposed to be $STATUS)"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -3,14 +3,14 @@
|
|||||||
Summary: Various nagios plugins to check cpu,memory,interfaces via SNMP
|
Summary: Various nagios plugins to check cpu,memory,interfaces via SNMP
|
||||||
Name: nagios-okplugin-check_snmp
|
Name: nagios-okplugin-check_snmp
|
||||||
Version: 2
|
Version: 2
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
Group: Applications/System
|
Group: Applications/System
|
||||||
URL: http://opensource.is/trac/wiki/check_snmp
|
URL: http://opensource.is/trac/wiki/check_snmp
|
||||||
Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_snmp/releases/nagios-okplugin-check_snmp-%{version}.tar.gz
|
Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_snmp/releases/nagios-okplugin-check_snmp-%{version}.tar.gz
|
||||||
Requires: perl-Net-SNMP
|
Requires: perl-Net-SNMP
|
||||||
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: Gardar Thorsteinsson <gardar@ok.is>
|
||||||
|
|
||||||
|
|
||||||
%description
|
%description
|
||||||
@@ -20,6 +20,8 @@ Various nagios plugins to check cpu,memory,interfaces via SNMP
|
|||||||
%setup -q
|
%setup -q
|
||||||
#perl -pi -e "s|/usr/lib|%{_libdir}|g" nrpe.d/check_hpacucli.cfg
|
#perl -pi -e "s|/usr/lib|%{_libdir}|g" nrpe.d/check_hpacucli.cfg
|
||||||
|
|
||||||
|
%global __requires_exclude %{?__requires_exclude:%__requires_exclude}|}^perl\\(utils\\)
|
||||||
|
|
||||||
%build
|
%build
|
||||||
|
|
||||||
|
|
||||||
@@ -45,6 +47,9 @@ rm -rf %{buildroot}
|
|||||||
%{_libdir}/nagios/plugins/*
|
%{_libdir}/nagios/plugins/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri May 09 2018 Gardar Thorsteinsson <gardar@ok.is> 2-2
|
||||||
|
- Filter out perl-utils dep
|
||||||
|
|
||||||
* Thu Feb 20 2014 Pall Sigurdsson <palli@opensource.is> 2-1
|
* Thu Feb 20 2014 Pall Sigurdsson <palli@opensource.is> 2-1
|
||||||
- make sure nagios does not run us in embedded perl (palli@opensource.is)
|
- make sure nagios does not run us in embedded perl (palli@opensource.is)
|
||||||
|
|
||||||
|
|||||||
@@ -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.1
|
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,12 @@ 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
|
||||||
|
- Bump version
|
||||||
|
|
||||||
* Mon Mar 12 2012 Pall Sigurdsson <palli@opensource.is> 1.0.1-1
|
* Mon Mar 12 2012 Pall Sigurdsson <palli@opensource.is> 1.0.1-1
|
||||||
- new package built with tito
|
- new package built with tito
|
||||||
|
|
||||||
|
|||||||
@@ -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.0-1 check_apcext.pl/
|
2.1.2-1 check_apcext.pl/
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
1.0.3-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 @@
|
|||||||
2-1 check_ibm_bladecenter/
|
4-1 check_ibm_bladecenter/
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
1.0.1-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/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user