centosnagiosnrpe

how to monitor crond service in nagios


I want to monitor crond service in Nagios.

I tried using creating below script and put at /usr/local/nagios/libexec/

CRON_RESULT=$(/etc/init.d/crond status)
STATUS=`echo $CRON_RESULT| grep pid`
if [ -z "$STATUS" ]; then
        echo "CROND CRITICAL- $CRON_RESULT"
        exit 2
else
        echo "CROND OK- $CRON_RESULT"
        exit 0
fi

It is working fine if no cron is running (shows CRITICAL) & if running (shows OK).

But if NRPE client is not reachable from Nagios Server, crond service shows the status as "OK" (in green color) with a message return code of 255 is out of bounds. And I can't get to know that crond is running or not.

Is there any other way to monitor crond service in CentOS 6.6?


Solution

  • I searched and find that it is bug in nrpe v2.15 so I reverted back to nrpe v2.12 on Nagios Server and it resolved the issue.