Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

In my current nagios installation I check for the existence of a remote backup through NRPE. In particular, my remote nrpe.cfg (on a Ubuntu 8.x) is:

command[check_zimbra_backup]=/usr/lib/nagios/plugins/check_file_age -f \\
/backupdir/zimbra_backup-$(date +%a).tar.gz -w 518400 -c 86400 

Running the command locally returned OK:

$ sudo su -m nagios -c "/usr/lib/nagios/plugins/check_file_age -f \\
/backupdir/zimbra_backup-$(date +%a).tar.gz -w 518400 -c 86400 "
FILE_AGE OK: /backupdir/zimbra_backup-Sun.tar.gz is 47661 seconds old and 10863637475 bytes

However, my logs showed CRITICAL:

nagios: SERVICE NOTIFICATION: zimbra backups;CRITICAL;notify-service-by-email;
FILE_AGE CRITICAL: /backupdir/zimbra_backup-Sun.tar.gz is 22373 seconds old and 10863637475 bytes 

Notice how it returns a critical state depsite the fact that the number of seconds reported (22373) is smaller than the warning parameters (86400s, or 24 hours).

The interesting bit is that running the NRPE plugin remotely returns something strange:

$ sudo su -m _nagios -c "/usr/local/libexec/nagios/check_nrpe -H HOST \\ 
-c check_zimbra_backup"
FILE_AGE CRITICAL: /backupdir/zimbra_backup-Sun.tar.gz is 23611 seconds old and 10863637475 bytes

Notice the last line, which looks like some sort of garbled output.

The check_file_age plugin is version v1750 (nagios-plugins 1.4.11)

share|improve this question

The solution was to change the command substitution from

[...]zimbra_backup-$(date +%a).tar.gz 


[...]zimbra_backup-`date +%a`.tar.gz 

Looks like nagios performs some odd command substitution when it encounters a $ sign.

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.