Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a cron job that runs every morning that produces an output file when run successfully. I'd like to have a follow up process that verifies that the job executed properly or fire off a Nagios alert if it didn't.

I feel like I could make this work with a Nagios check_file_age service check that restricts the check to occur only once every morning through careful construction of the check_interval and check_period in the service def, but I'm wondering if there is a simpler way?

share|improve this question
up vote 1 down vote accepted

A couple of options spring to mind:

  1. Use passive check results to have the verification script tell Nagios to go alert, and if you want to know if the verification script doesn't run, then set a freshness interval of a little over 24 hours and have an active check command that always goes critical; or
  2. Have the cron job itself submit an OK passive check result when it finishes successfully, but not do anything when it fails. Then, again, freshness check with an auto-critical active check command to alert when all is not well.
share|improve this answer

Possibly look at having the cronjob output an error code to a log, ahve nagios look at the log. If the cronjob reports an error, than boom. Or, a little easier but less precise, have the last line of your cronjob script write to a log file. Have nagios check for the modification date of the log file. If it goes more than 25 hours, kick off an alret.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.