Page 1 of 5
File check plugin
Posted: Tue Jul 23, 2013 12:26 pm
by ofadl
Hello,
So i am trying to find a check for nagios, that would basically check files or files in a directory that have been sitting there for more than 5 minutes. Any help?
Re: File check plugin
Posted: Tue Jul 23, 2013 3:10 pm
by lmiltchev
Re: File check plugin
Posted: Thu Jul 25, 2013 12:39 pm
by ofadl
interesting, i rather not install python though. I found this plugin:
https://www.itefix.no/i2/check_winfile
I got it working on the command prompt from the remote server itself, but i am having difficulty getting it to work on the nagios. I am trying to set it up with a service check and a check command. Any help is appreciated.
For example, on the command prompt on the remote server inside C:\nrpe_nt, i ran
Code: Select all
check_winfile --target C:\nrpe_nt --filter "age gt -5 minutes" --critical 0
and got an output this:
Code: Select all
FILE OK - 0 files out of 72 to consider |'selected files'=0;;0; 'all files'=72 '
deleted files'=0
i tried doing similar on the nagios machine with :
Code: Select all
./check_nrpe -H 10.100.50.18 -p 5666 -c check_winfile -a --target C:\nrpe_nt --filter "age gt -5 minutes" --critical 0
but im getting this:
Code: Select all
./check_nrpe: unrecognized option '--filter'
./check_nrpe: unrecognized option '--critical'
Re: File check plugin
Posted: Thu Jul 25, 2013 1:35 pm
by abrist
What are you using as your nrpe client on the remote host?
Additionally, you need to wrap nrpe's command argument with single quotes:
Code: Select all
./check_nrpe -H 10.100.50.18 -p 5666 -c check_winfile -a '--target C:\nrpe_nt --filter "age gt -5 minutes" --critical 0'
You will also have to configure the command on the remote side in nsclient, etc.
Re: File check plugin
Posted: Thu Jul 25, 2013 1:43 pm
by ofadl
i am using NSClient. I wrapped the command as you said, and now i get :
Code: Select all
CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.
Any suggestions on how to configure a command to be put in the nsc.ini file?
Re: File check plugin
Posted: Thu Jul 25, 2013 2:07 pm
by abrist
What version of nsclient are you using? Could you by chance post your nsclient config in code wraps? (obfuscate password, etc)
Re: File check plugin
Posted: Thu Jul 25, 2013 2:18 pm
by ofadl
ok
Re: File check plugin
Posted: Fri Jul 26, 2013 7:49 am
by scottwilkerson
Copy check_winfile to your scripts directory, then add the following to your nsclient.ini under the [External Scripts] header
Code: Select all
check_winfile=scripts\check_winfile.exe $ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$ $ARG6$ $ARG7$ $ARG8$ $ARG9$
restart NSClient++ and try again from nagios server
Re: File check plugin
Posted: Fri Jul 26, 2013 10:29 am
by ofadl
so i copied it exactly as you put it, under the external scripts section, and reset nsclient. Went on the nagios machine, ran :
Code: Select all
./check_nrpe -H 10.100.50.18 -p 5666 -c check_winfile -a '--target C:\nrpe_nt --filter "age gt -5 minutes" --critical 0'
and got the output :
Code: Select all
UNKNOWN: No handler for that command
Re: File check plugin
Posted: Fri Jul 26, 2013 10:58 am
by yancy
Did you also restart NSClient? Also verify the plugin is in the Scripts directory of NSClient.
-Yancy