File check plugin

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.
ofadl
Posts: 201
Joined: Mon Jun 03, 2013 8:57 am

File check plugin

Post 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?
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: File check plugin

Post by lmiltchev »

Be sure to check out our Knowledgebase for helpful articles and solutions!
ofadl
Posts: 201
Joined: Mon Jun 03, 2013 8:57 am

Re: File check plugin

Post 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'


abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: File check plugin

Post 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.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
ofadl
Posts: 201
Joined: Mon Jun 03, 2013 8:57 am

Re: File check plugin

Post 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?
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: File check plugin

Post by abrist »

What version of nsclient are you using? Could you by chance post your nsclient config in code wraps? (obfuscate password, etc)
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
ofadl
Posts: 201
Joined: Mon Jun 03, 2013 8:57 am

Re: File check plugin

Post by ofadl »

ok
Last edited by ofadl on Fri Jul 26, 2013 12:52 pm, edited 1 time in total.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: File check plugin

Post 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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
ofadl
Posts: 201
Joined: Mon Jun 03, 2013 8:57 am

Re: File check plugin

Post 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
yancy
Posts: 523
Joined: Thu Oct 06, 2011 10:12 am

Re: File check plugin

Post by yancy »

Did you also restart NSClient? Also verify the plugin is in the Scripts directory of NSClient.

-Yancy
Locked