Search Directory

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
tgfde
Posts: 233
Joined: Thu May 12, 2011 7:55 am

Search Directory

Post 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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Search Directory

Post by scottwilkerson »

A quick look in the Exchange found this option

http://exchange.nagios.org/directory/Pl ... sh/details
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
tgfde
Posts: 233
Joined: Thu May 12, 2011 7:55 am

Re: Search Directory

Post by tgfde »

Thank you for the quick response.

Does anyone know how to set this up? Or point me to a documenation?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Search Directory

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
tgfde
Posts: 233
Joined: Thu May 12, 2011 7:55 am

Re: Search Directory

Post 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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Search Directory

Post 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$
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
tgfde
Posts: 233
Joined: Thu May 12, 2011 7:55 am

Re: Search Directory

Post 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)
You do not have the required permissions to view the files attached to this post.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Search Directory

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked