Monitoring Cron jobs

Sean Dilda agrajag at dragaera.net
Thu Jul 1 15:13:35 CEST 2004


On Thu, 2004-07-01 at 07:23, Enrique.Melero at reuters.com wrote:
> 
> On 07/01/2004 12:38:41 PM Andreas Ericsson wrote:
> > > The contents inside the percentage marks are passed through stdin to the
> > shell , as per
> > > standard Visie Cron behaviour .
> > >
> > > The nagiosawareshell would capture STDERR and return status of the job and
> > > send the correct info the the nagios.cmd pipe .
> > >
> > > Is this making sense ? or is there another better way ?
> > >
> >
> > Seems like an awful lot of work to me. Why don't you just let the
> > cron-jobs themselves send a passive service check result to the nagios
> > pipe, and set the check_freshness options to something appropriate?
> > That way the jobs themselves have to define whether or not they
> > succeeded, which seems like the right way to go. If the job doesn't run
> > at all, nagios sends alerts since the service-check goes stale
> > (providing nice monitoring of the cron daemon as well).
> 
> Thanks for your answer.
>  There are several reasons why I dont want to do it that manner:
> 1 If we ever change the way passive updates are done we would have to change each and any of the jobs.
> 2 Many of the jobs are like this
> echo "update a set b=c where d " | mysql
> and I cant figure out how to add there a passive update to notify OK or failure ...
> 3 I want to be able to group my jobs by service and be able to modify this without having to go
> through each and any of the jobs
> 4 There are dozens of cron jobs and maintained by different people. Having to add monitoring to each
> of them is far more effort than providing a generic solution based on standard return status and stderr generated by the jobs

All of those are easily solved.  Write a wrapper script for your cron
jobs.  Cron will call the wrapper script with arguments telling it what
really need to be done.  The wrapper script will run the program, and
based on the exit value, send the appropriate passive check status.  If
you ever have to change how the passive updates work, you just modify
the one script and you're done.



-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
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