[Nagiosplug-help] how to monitor crond service

Heiko rupertt at gmail.com
Fri Sep 5 15:41:59 CEST 2008


On Fri, Sep 5, 2008 at 1:27 PM, Thomas Guyot-Sionnest <dermoth at aei.ca> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> 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
}

where $ARG1$ is the community string and "proc crond" has to be the
second proc entry.

snmpwalk -v 2c -c noc_snmp IPADDRESS .1.3.6.1.4.1.2021.2

shows you all the procs you defined
The output strings isnt saying anything about cron, but I know when
something is wrong.


The other way could be the following:
I found that script and changed it a bit, you have to use it with nrpe
and change incrond to crond

----------cut---------
#!/bin/bash
INCRONCOUNT=`ps afx | grep incrond | grep -v grep | grep -v
check_incrond | wc -l`


STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
STATE_DEPENDENT=4


case "${INCRONCOUNT}" in
        0)  echo "incrond is not running"; exit ${STATE_CRITICAL}
        ;;
        1)  echo "incrond is running"; exit ${STATE_OK}
        ;;
       *)  echo "incrond is running more than once"; exit ${STATE_WARNING}
       ;;
esac

exit 0
----------cut---------


cheers

Rupertt
> - --
> Thomas
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFIwReK6dZ+Kt5BchYRAg9JAJ47IpfGEOyRkc54mXKeVpNGwvxQGgCfX/Du
> 1I4wPR5lQEi9NKNa5DZTk8w=
> =JAcQ
> -----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
>

-------------------------------------------------------------------------
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