Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

2 Answers 2

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

 
discard

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