Warning: Cannot modify header information - headers already sent by (output started at /home/destefa1/public_html/nf/function.php:1) in /home/destefa1/public_html/nf/function.php on line 215
Warning: Cannot modify header information - headers already sent by (output started at /home/destefa1/public_html/nf/function.php:1) in /home/destefa1/public_html/nf/function.php on line 216
Warning: Cannot modify header information - headers already sent by (output started at /home/destefa1/public_html/nf/function.php:1) in /home/destefa1/public_html/nf/function.php on line 217
Warning: Cannot modify header information - headers already sent by (output started at /home/destefa1/public_html/nf/function.php:1) in /home/destefa1/public_html/nf/function.php on line 218
Warning: Cannot modify header information - headers already sent by (output started at /home/destefa1/public_html/nf/function.php:1) in /home/destefa1/public_html/nf/function.php on line 219
Warning: Cannot modify header information - headers already sent by (output started at /home/destefa1/public_html/nf/function.php:1) in /home/destefa1/public_html/nf/function.php on line 220
#!/bin/bash
source /usr/lib64/nagios/plugins/utils.sh
warn=${1:?Enter warn paramater}
crit=${2:?Enter critical paramater}
if [ ${warn} -le ${crit} ]
then
echo "UNKNOWN: Warning threshold cannot be less or equal to critical threshold"
exit $STATE_UNKNOWN
fi
ipcount=$(wc -l /etc/ipaddrpool | awk '{print $1}')
STATUS=${STATE_OK}
MSG="OK"
if [ ${ipcount} -le ${crit} ]
then
MSG="CRITCAL"
STATUS=$STATE_CRITICAL
elif [ ${ipcount} -le ${warn} ]
then
MSG="WARNING"
STATUS=$STATE_WARNING
else
MSG="OK"
STATUS=$STATE_OK
fi
echo "${MSG}: Dedicated IP count is ${ipcount}"
exit ${STATUS}