Random Project

Great plugin

This is working great for me. I modified the output so that the number of days is always shown last, it makes it much easier to scan down the list for me.

I also created a dummy host that loops back to the nagius server (127.0.0.1) named “Domain-Expiration-Checks” then created a custom command and service checks for each domain. This requires quite a bit more typing and configuration but it keeps the domain checks under a host and not cluttering up my top level host view in Nagios.

I highly suggest that you limits on how often your whois services check to avoid whois rate control on your nagios server. I created a once daily time frame that only checks from midnight to 12:30 then used the following values in each service to get 1 check per day per domain.

normal_check_interval 30
max_check_attempts 1
check_period once-daily

I also added support for .ms and .us domains.

then
TYPE=ms
WHOIS_SERVER=”whois.nic.ms”
elif [ ${DLTYPE} == ‘us’ ];
then
TYPE=us
WHOIS_SERVER=”whois.nic.us”
else

# for .ms domains
elif [ $TYPE == ‘ms’ ];
then
day=`cat ${FILE} | awk ‘/Registry/’ | cut -d ‘ ‘ -f4 | cut -d T -f1 | cut -d ‘-‘ -f3`
month=`cat ${FILE} | awk ‘/Registry/’ | cut -d ‘ ‘ -f4 | cut -d T -f1 | cut -d ‘-‘ -f2`
getmonth()
{
case $month in
01) echo jan ;;
02) echo feb ;;
03) echo mar ;;
04) echo apr ;;
05) echo may ;;
06) echo jun ;;
07) echo jul ;;
08) echo aug ;;
09) echo sep ;;
10) echo oct ;;
11) echo nov ;;
12) echo dec ;;
*) echo 0 ;;
esac
}
year=`cat ${FILE} | awk ‘/Registry/’ | cut -d ‘ ‘ -f4 | cut -d T -f1 | cut -d ‘-‘ -f1`
expiration=$day-$(getmonth ${2})-$year
# for .us domains
elif [ $TYPE == ‘us’ ];
then
day=`cat ${FILE} | awk ‘/Domain Expiration Date:/’ | cut -d ‘ ‘ -f27`
month=`cat ${FILE} | awk ‘/Domain Expiration Date:/’ | cut -d ‘ ‘ -f26`
year=`cat ${FILE} | awk ‘/Domain Expiration Date:/’ | cut -d ‘ ‘ -f30`
expiration=$day-$month-$year

Great plugin, thanks for your efforts in writing it.