1
0
mirror of https://github.com/opinkerfi/nagios-plugins.git synced 2024-11-24 03:13:47 +01:00

Initial commit of check_firewall_active

This commit is contained in:
Richard Allen 2016-12-21 10:17:12 +00:00
parent 6726f614ad
commit 802da30b9b
3 changed files with 28 additions and 0 deletions

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,3 @@
command[check_firewall_active]=sudo /usr/lib/nagios/plugins/check_firewall_active.sh

View File

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