[Nagiosplug-help] how to monitor crond service

Thomas Guyot-Sionnest dermoth at aei.ca
Sat Sep 6 00:21:55 CEST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05/09/08 09:41 AM, Heiko wrote:
> On Fri, Sep 5, 2008 at 1:27 PM, Thomas Guyot-Sionnest <dermoth at aei.ca> wrote:
> On 05/09/08 02:52 AM, asam30 at gmail.com wrote:
>>>> Hi,
>>>>
>>>> I've few of HP UX and Linux boxes that were monitored by Nagios. for the
>>>> past few days, I've observed that cron service on HP UX keeps shutting
>>>> down and I need to manually restart cron service. Is there any way
>>>> through nagios we can monitor cron service on HP UX or Linux boxes so I
>>>> can login before no one compliance and restart the service?
> Please do not cross-post to multiple mailing lists.
> 
> if you have NSCA running on the Nagios server and send_nsca on the
> client (and properly configured), do the following:
> 
> 1. Create a passive service on Nagios (ex.: "Cron")
> 2. Set the freshness threshold for that service (ex.: 350 seconds), and
> use check_dummy as the active check (returning WARNING or CRITICAL
> depending on your preferences)
> 3. On the server, add a cron entry (according that the threshold in 3 is
> adjusted for 5-minute intervals):
>>>> */5 * * * * nagios echo -e "<hostname>\tCron\t0\tOK: Cron is running" | /path/to/send_nsca -H <monitor_host> -c <config_file>
> NB.: I don't know about HP-UX but some cron daemons do not support */5
> so you have to put "0,5,10,15,20,etc..." instead. If you're editing a
> user crontab, remove the "nagios" argument (some cron do not support
> system crontabs at all so you must edit a user's crontab)
> 
> 
> Although if you're running important scripts/programs from crond, you
> could simply monitor the scripts/rograms either by modifying them where
> possible, or using a wrapper script to report status to send_nsca. This
> way you won't have to monitor the daemon itself.
> 
> 
> Oh, another way is to use check_procs, looking fro "crond", but if your
> daemon just locks the check won't fail.
> 
>> i did define the check like the following:
> 
>> define command{
>>         command_name    check_crond
>>         command_line    $USER1$/check_snmp -H $HOSTADDRESS$ -P 2c -C
>> $ARG1$ -o UCD-SNMP-MIB::prCount.2 -s 1
>> }

This requires UCD_SNMP or NET_SNMP, which might now be whatMs on your
HP-UX box. It's possible that you have HP-UX specific MIBs for
processes, but I can't help you regarding this.

The simplest and most complete way is to have a cron job reporting back
to Nagios as it check if Crond is also running scheduled jobs (what if
the daemon is blocked somehow?). This is my suggestion quoted above.

Another way that should work fairly well is using check_procs from
Nagios-plugins, which has been designed to be portable among different
platforms. I'm not very experienced with check_procs but I believe you
can also check the state of the process, so you could probably alert if
crond is not running or sleeping.

- --
Thomas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIwbED6dZ+Kt5BchYRAt8/AKDx8Em6n8sZ3hCNRiSc7tBPVvXB4gCgiVpJ
PiQ9m4ULM2fvAuIunGkT3jA=
=uHdM
-----END PGP SIGNATURE-----

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list