1
0
mirror of https://github.com/opinkerfi/nagios-plugins.git synced 2026-02-13 02:20:57 +01:00

Compare commits

...

15 Commits

Author SHA1 Message Date
Richard Allen
74c1f3ebfd Fixing url 2016-12-21 12:36:01 +00:00
Richard Allen
45361e4606 Fixing spec a bit 2016-12-21 11:53:52 +00:00
Richard Allen
471d0fd2a2 Fixing things found in the review. Started work on rpm spec file 2016-12-21 11:47:04 +00:00
Richard Allen
802da30b9b Initial commit of check_firewall_active 2016-12-21 10:17:12 +00:00
hakong
6726f614ad Merge pull request #25 from FlorianHeigl/patch-1
make the output compliant with Nagios
2016-10-02 18:30:54 +00:00
Florian Heigl
ee5adc2363 make the output compliant with Nagios
First, use the proper keywords OK/WARN/UNKNOWN so the check follows the plugin guidelines
Second, to not confuse things, the UNKNOWN case would give multiline output. The first bit goes to the status line, the second to the extended status info.

I tried to not mess around, but I also made SELinux caps :-)
2016-10-02 20:25:42 +02:00
Pall Sigurdsson
7dc3b57582 Merge pull request #19 from TJM/issue-18-ipa-busy-replica
Issue #18 - Replica Busy is not critical
2015-10-17 22:49:26 +11:00
Pall Sigurdsson
688e8b8412 Merge pull request #20 from uakfdotb/patch-1
Fix "critical HDD detection" bug in check_hparray
2015-10-17 22:47:04 +11:00
uakfdotb
1ccc433779 Use $HPACUCLI 2015-10-14 19:24:53 -04:00
uakfdotb
ee05a4f24a Fix critical HDD detection bug in check_hparray 2015-10-14 16:23:12 -04:00
Tommy McNeely
871c8348fa Issue #18 - Replica Busy is not critical
Changed the plugin.status to allow for status 0 or status 1.
2015-10-01 15:45:14 -06:00
Pall Sigurdsson
944d47e18e Merge branch 'master' of github.com:opinkerfi/nagios-plugins 2014-11-16 15:02:17 +01:00
Pall Sigurdsson
40ba14c4cb check_hpacucli - critical on failed logical drives 2014-11-16 15:01:41 +01:00
Tomas Edwardsson
f986b73474 Automatic commit of package [nagios-okplugin-check_disks] release [1.0.7-1]. 2014-10-29 23:45:26 +00:00
Tomas Edwardsson
c8e7fbbff8 Fix invalid regex if mountpoint has . in path 2014-10-29 23:42:42 +00:00
11 changed files with 100 additions and 12 deletions

View File

@@ -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});

View File

@@ -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

View 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

View File

@@ -0,0 +1,50 @@
%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.0
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 20 2016 Richard Allen <ra@ok.is> 0.1-1
- Initial packaging

View File

@@ -0,0 +1,3 @@
command[check_firewall_active]=sudo /usr/lib64/nagios/plugins/check_firewall_active.sh

View File

@@ -0,0 +1,2 @@
Defaults:nrpe !requiretty
nrpe ALL = (root) NOPASSWD: /usr/lib64/nagios/plugins/check_firewall_active.sh

View File

@@ -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(". ")

View File

@@ -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
;; ;;

View File

@@ -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")

View File

@@ -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

View File

@@ -1 +1 @@
1.0.6-1 check_disks.pl/ 1.0.7-1 check_disks.pl/