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:
parent
6726f614ad
commit
802da30b9b
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
|
||||
|
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/lib/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/lib/nagios/plugins/check_firewall_active.sh
|
Loading…
Reference in New Issue
Block a user