Check file age

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Check file age

Post by jdalrymple »

The line specified above by Box293 would be in your service definition (the check_command directive) on your Nagios server.
spiderpig
Posts: 23
Joined: Thu Jun 21, 2012 7:23 pm

Re: Check file age

Post 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.
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Check file age

Post 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
       ...
}
spiderpig
Posts: 23
Joined: Thu Jun 21, 2012 7:23 pm

Re: Check file age

Post 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?
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Check file age

Post 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.
Attachments
Clipboard01.jpg
Locked