Page 1 of 1

NRDS+Check TXT

Posted: Wed Nov 30, 2016 3:05 pm
by sarpione
Hi ppl
I need help again of course haha
I got Nagios XI and i need to check a windows 7 host, there is the situation:

One program create a file named "Datos.txt", this file only have to exist 2-3minutes then automatically is deleted, but sometimes (i dont know why) give an error and its not deleted.
Well i need to check if Datos.txt exist more than 5 minutes for example. pls tell me what plugin i need to use and the command to type.

PLUS: If its possible in case that Datos.txt exist more than 10 minutes delete it and report me.

thx a lot

Re: NRDS+Check TXT

Posted: Wed Nov 30, 2016 3:39 pm
by avandemore
I believe you were referred earlier to NRPE and NSClient. Have you looked at this plugin?

https://exchange.nagios.org/directory/P ... bs/details

https://exchange.nagios.org/ is a collection of community plugins which are provided as-is. If that plugin or one of the others doesn't work for you, you can refer to this:

https://docs.nsclient.org/reference/win ... heck_files
https://support.nagios.com/forum/viewto ... =7&t=33591

Please remember we don't write or maintain NSClient so NSClient questions are best answered by them.

Re: NRDS+Check TXT

Posted: Thu Dec 01, 2016 7:18 am
by sarpione
Thx for the answer i checked the links, but i dont use NSClient, i use NRDS client, because of that i need a plugin to load in the NRDS and configure the command in the "Config,ini".
These 2 things i dosent know, what plugin have to use and the command i need to type.

Re: NRDS+Check TXT

Posted: Thu Dec 01, 2016 1:08 pm
by tgriep
To use NRDS, go to this link
https://itefix.net/check_winfile
Download the check_winfile.exe file and put it in this folder in the Windows server.

Code: Select all

C:\Program Files\Nagios\NRDS_Win\plugins
Add the following command to your C:\Program Files\Nagios\NRDS_Win\config.ini file adjusting the target path and the name of the file (file.txt)

Code: Select all

command[File_Age] = $PLUGIN_DIR$\check_winfile.exe --target="c:\temp" --filter "age lt -10 minutes","name match file.txt" --critical 0
The above example if the file exists and is over 10 minutes old,set a critical alert.
Try that and post if you have any questions.

Re: NRDS+Check TXT

Posted: Thu Dec 01, 2016 3:42 pm
by sarpione
thx for the answer
i tested it and i have this error
Image

i create a folder in C: named "temp" and datos.txt inside and i paste check_winfile.exe in the nagios plugin folder
then in the config.ini i type this:
command[File_Age] = .\plugins\check_winfile.exe --target="c:\temp" --filter "age lt -10 minutes","datos.txt" --critical 0

Re: NRDS+Check TXT

Posted: Thu Dec 01, 2016 3:55 pm
by tgriep
You are missing the "name match" from the filter option.
Edit the config.ini file and chnage the command from

Code: Select all

command[File_Age] = .\plugins\check_winfile.exe --target="c:\temp" --filter "age lt -10 minutes","datos.txt" --critical 0
to

Code: Select all

command[File_Age] = .\plugins\check_winfile.exe --target="c:\temp" --filter "age lt -10 minutes","name match datos.txt" --critical 0
And that should work for you.

Re: NRDS+Check TXT

Posted: Fri Dec 02, 2016 7:25 am
by sarpione
You are a GENIUS!
Thank you very much!
It works perfectly.

Re: NRDS+Check TXT

Posted: Fri Dec 02, 2016 11:19 am
by tgriep
Your welcome. I'll close the post as solved but if you have any other questions, feel free to open a new post.