Page 1 of 1

File Count Checks Not Working

Posted: Wed Aug 28, 2013 1:55 pm
by kbob6682
I am trying to setup a windows file check using this plugin http://exchange.nagios.org/directory/Pl ... TK/details.

I am using the check_nrpe command in nagiosxi and nsclient++ on the server.

Nagios Command: $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_winfile -a '$ARG1$' '$ARG2$' '$ARG3$'

nsc.ini Modifications:
External Scripts
check_winfile=scripts\check_winfile.exe --target $ARG1$ --warn $ARG2$ --critical $ARG3$
arguments and allow nasty characters are enabled

If I run test command from the service I created, it works fine.
If I save service and have Nagios do the checks like normal, I get "File Unknown-Target does not exist".

If I turn on debug mode in the nsc.ini and look at the log. When I run the test command I see these lines:
2013-08-28 13:44:50: debug:NSClient++.cpp:1144: Injecting: check_winfile: D:\\RightFax\\EDC\\Processors\\Convert, 10, 20
2013-08-28 13:44:50: debug:NSClient++.cpp:1180: Injected Result: OK 'FILE OK - 3 files to consider'
2013-08-28 13:44:50: debug:NSClient++.cpp:1181: Injected Performance Result: ''selected files'=3;10;20; 'all files'=3 'deleted files'=0'


When Nagios executes the check like normal I get this:
2013-08-28 13:45:01: debug:NSClient++.cpp:1144: Injecting: check_winfile: D:RightFaxEDCProcessorsConvert, 10, 20
2013-08-28 13:45:01: debug:NSClient++.cpp:1180: Injected Result: WARNING 'FILE UNKNOWN - Target does not exist'
2013-08-28 13:45:01: debug:NSClient++.cpp:1181: Injected Performance Result: ''


It drops the \\ from the file path. Explaining the file unknown error.

I am able to create a new command for each file needing monitored with success, but I would rather not create a command for each check I need to do. I just hard code the path, warning, and critical data in the command located in the nsc.ini. I want to get around this and have it be configured through the NagiosXI interface.

Any idea what the problem could be?

Thanks for your help!

Caleb

Re: File Count Checks Not Working

Posted: Wed Aug 28, 2013 3:06 pm
by sreinhardt
I would highly suggest not using the test command for windows services. Due to the escaping in place, it causes many issues that do not actually happen with nagios or cli. I would instead suggest either running the command in the cli and testing there, then moving the command to arguments in the CCM, or setup the command, and use the run immediate check on the service to avoid waiting long periods for testing.