Page 2 of 2

Re: Check file age

Posted: Mon Jul 06, 2015 10:49 am
by jdalrymple
The line specified above by Box293 would be in your service definition (the check_command directive) on your Nagios server.

Re: Check file age

Posted: Tue Jul 07, 2015 9:56 am
by spiderpig
Sorry for my noob questions :)
but should i set it in nrpe.cfg, command.cfg? I tried that but nagios -v gave me an error.

Re: Check file age

Posted: Tue Jul 07, 2015 10:12 am
by jdalrymple
Service definition

It can be in any of the .cfg files, but typically it will be named after the host for which the service belongs.

You might have a file called windowshost.cfg that looks something like this:

Code: Select all

define host {
       host_name                                windowsbox
       address                                  192.168.1.100
       ...
}

define service {
       host_name                                windowsbox
       service_description                      monitor_logfile
       check_command                            check_nrpe!CheckFiles!-a path='D:\\Important Stuff\\Important File.txt' 'filter=written < -2h' 'master-syntax={%total% Files Found}' MaxCrit=1
       ...
}

Re: Check file age

Posted: Tue Jul 07, 2015 1:35 pm
by spiderpig
Thank you jdalrymple,

ok, I got it running withou an error, it shows up in the Nagios webinterface, but I get an "Missing argument(s)."
any idea what arguments are missing?

Re: Check file age

Posted: Tue Jul 07, 2015 1:59 pm
by jdalrymple
Let's browse out to the command expansion in the web UI:

System --> Configuration
Choose Services under Object Type --> Continue
Locate your service and click on the hyperlink under the 'Check Command' column

Screenshot that page and shoot it our way, I've attached an example that it should look somewhat similar to.