Nagios: checking for .lock files age

I wanted to check for age of certain .lock files from scripts, so I can catch if a certain script has been running for too long (or has died without removing the .lock file). In this instance it was a script that runs drupal cronjobs and to be sure that it doesn't run multiple times, the script throws a lock file while it is running.

It turns out that check_file_age in standard nagios-plugins worked beautifully, except for one little annoying detail - it returns CRITICAL if the file does not exist :(

I modified it, so that it works as usual, until you add the option: -n 1 (not-found-ok = true) - you can get check_file_age2.pl here

How do you check for this in Nagios?

0 comments on Nagios: checking for .lock files age