Page 1 of 1

check_winfile filter option

Posted: Fri Mar 31, 2017 2:25 pm
by ebutte
Hello. I've spent so much time on this and am hoping someone else can spot my problem.

About my setup:
Nagios is installed on a Linux server which I can only access via the NagiosQL admin module.

I've downloaded the check_winfile https://www.itefix.net/check_winfile for NRPE plugin. The perl file and .exe are in "C:\Program Files\NSClient++\scripts" on my local machine from which I am running NagiosQL and that I have NSClient++ installed on.

My COMMAND definition in NagiosQL is as follows: $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_winfile -a $ARG1$ $ARG2$ $ARG3$

My SERVICE definition in NagiosQl uses the following: $ARG1$ --target c:/temp $ARG2$ --filter size gt 1

[/settings/external scripts/scripts] : check_winfile=scripts\\check_winfile.exe //T:30 //NoLogo $ARG1$ $ARG2$ $ARG3$

I've downloaded Strawberry Perl ver. 5.24.1 and added Time::ParseDate Module

Output in Nagios is as follows:

Current Status: OK (for 0d 0h 15m 6s)
Status Information: FILE OK - 51 files to consider
Performance Data: 'selected files'=51 'all files'=51 'deleted files'=0

My issue is that anything that I add as ARG2 doesn't produce the desired effect. I tried ...
--filter size gt 10KB => UNKNOWN (No output returned from plugin)
-filter size gt 10KB => UNKNOWN (Incorrect command line argument supplied)
"filter=size gt 10KB" => UNKNOWN (Incorrect command line argument supplied)
I tried variations like name match /file.txt AND age gt 24hours
I've tried using --critical and --warning values in ARG2 and 3 and gotten the UNKNOWN status as well

It seems to be a format issue with the way the args are put into nagiosQL, but the --target options works and the others don't

Any insight would be greatly appreciate.
Thanks

Re: check_winfile filter option

Posted: Mon Apr 03, 2017 10:51 am
by mcapra
No one on the Nagios team has contributed to the source for check_winfile, so the advice we can offer is a bit limited.

These look a bit more like NSClient++ command arguments:

Code: Select all

--filter size gt 10KB => UNKNOWN (No output returned from plugin)
-filter size gt 10KB => UNKNOWN (Incorrect command line argument supplied)
"filter=size gt 10KB" => UNKNOWN (Incorrect command line argument supplied)
Here's the usage from the check_winfile page:

Code: Select all

--filter filterspec[,filterspec]...]] [[--filter ...] ... ]

...

 SIZE            eq, ne, gt, lt, ge, le    file size in bytes=
It looks as if you will need to be providing the size in bytes rather than kilobytes. Like so:

Code: Select all

check_winfile --target "c:\logfiles" --filter "size gt 10485760" --warning 10 --critical 50

Re: check_winfile filter option

Posted: Mon Apr 03, 2017 10:18 pm
by rkennedy
If you decide to skip the plugin and use NSClient++ see this page for reference - http://sites.box293.com/nagios/guides/c ... es-folders

Re: check_winfile filter option

Posted: Tue Apr 04, 2017 10:29 am
by tmcdonald
Thanks for the assist, @rkennedy!

Re: check_winfile filter option

Posted: Fri Apr 07, 2017 3:24 pm
by ebutte
Thanks for the assistance. I ended up ditching the check_winfile plugin and going with @rkennedy 's suggestion of using the NSClient++.

Re: check_winfile filter option

Posted: Fri Apr 07, 2017 3:53 pm
by cdienger
Glad to help. Were there any questions/issues related to this or can this thread be locked?