Page 1 of 1
Search Directory
Posted: Wed Mar 14, 2012 4:33 pm
by tgfde
Hi,
Has someone setup a service check to check a directory if a new file has been created? Does Nagios have this capability.
Thanks in advanced.
Re: Search Directory
Posted: Wed Mar 14, 2012 4:48 pm
by scottwilkerson
Re: Search Directory
Posted: Thu Mar 15, 2012 3:38 pm
by tgfde
Thank you for the quick response.
Does anyone know how to set this up? Or point me to a documenation?
Re: Search Directory
Posted: Thu Mar 15, 2012 4:20 pm
by scottwilkerson
Edit check_newfiles.config and place the directory you want to check in the CHECKDIR variable.
Upload both check_newfiles.config and check_newfiles.sh to the nagios plugin directory.
You can do this through the web GUI at Admin -> Manage Plugins
Add a command at Configure -> Core Config Manager -> Commands -> Add New
Command = check_newfiles
Command line* = $USER1$/check_newfiles.sh -f $ARG1$
Command type = check command
Now you can add a service and use check_newfiles for the check command.
$ARG1$ = check_newfiles.config
Re: Search Directory
Posted: Fri Mar 16, 2012 8:49 am
by tgfde
How would you do it if you want to monitor multiple directories on multiple remote Windows agents?
Would I have to place the check_newfiles.config locally on the remote Windows agent?
Thanks.
Re: Search Directory
Posted: Fri Mar 16, 2012 9:40 am
by scottwilkerson
You would place both files on the remote machine, then if it is NRPE you are using you would have to add the command to the nrpe.cfg and then change the Nagios machine to use check_nrpe with the command name you specify in the remote nrpe.cfg
You can make a new file in the format of check_newfiles.config and you would use the name of the new file in your $ARGn$
Re: Search Directory
Posted: Fri Mar 23, 2012 3:52 pm
by tgfde
Ok, so I'm receiving the following message and have the following configuration (attached).
First message:
ExternalCommands: failed to create process (scripts\check_newfiles.sh --config scripts\check_newfiles\$ARG1$): it is not an exe file (check NSC.log for more info) - failed to lookup error code: 193( reson: 87)
So I renamed it to check_newfiles.exe and received the second message:
ExternalCommands: failed to create process (scripts\check_newfiles.exe --config scripts\check_newfiles\$ARG1$): failed to lookup error code: 216( reson: 87)
Re: Search Directory
Posted: Mon Mar 26, 2012 8:44 am
by scottwilkerson
I'm sorry I didn't catch your last post said "Windows" machines.
For that you would need a different setup, you can use something like
http://www.nsclient.org/nscp/wiki/CheckFiles