Page 1 of 2

Test check works in CCM, but fails once applied

Posted: Tue Dec 15, 2015 12:27 pm
by TJ.AHC
I'm having issues with a command and i'd greatly appreciate some help.

I am using Desktop NSC++ Ver. 4.4.14
Server Nagios XI 2014R2.7

I have done testing from the Nagios Server, Test Check Command, and local computer the following command works just fine.

$USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c Check_Files -a path=$ARG1$ "filter=filename='$ARG2$'" "ok=count>= 1" "warn=written< -$ARG3$" "crit=written< -$ARG4$ or count= 0" "perf-syntax=${file} Last Written: %(written_l)"


From using the "test check" this is the output

COMMAND: /usr/local/nagios/libexec/check_nrpe -H 172.21.1.73 -t 30 -c Check_Files -a path=C:\\temp "filter=filename='test.txt'" "ok=count>= 1" "warn=written< -1h" "crit=written< -1d or count= 0" "perf-syntax=${file} Last Written: %(written_l)"
OUTPUT: CRITICAL: 2/2 files (test.txt, test.txt)|' Last Written: 2015-Nov-24 12:35:31_written'=1448393731;1450196700;1450113900 ' Last Written: 2015-Nov-23 14:41:56_written'=1448314916;1450196700;1450113900 'count'=2;0;0

However when i apply the code to go live, it says it has unknown state and words that says "no files found". I know at one point I was getting errors with Filters. i'm not sure why it works everywhere else just not in "live" after applying


Please let me know with any information that may help.


Thanks

Re: Test check works in CCM, but fails once applied

Posted: Tue Dec 15, 2015 12:43 pm
by rkennedy
Can you post a screenshot of your service configuration?

What is the result when you run the command over CLI as the nagios user?

Re: Test check works in CCM, but fails once applied

Posted: Tue Dec 15, 2015 12:57 pm
by TJ.AHC
Here are the screenshots
nagios_1.png
nagios_1.png

Re: Test check works in CCM, but fails once applied

Posted: Tue Dec 15, 2015 2:08 pm
by rkennedy
Before running the command over the CLI, can you run a su nagios to run the command as nagios rather than root? This may be a permission related error.

Re: Test check works in CCM, but fails once applied

Posted: Tue Dec 15, 2015 2:24 pm
by TJ.AHC
I tried that and got the same results. on top of that, why would it work IN nagios on the Test check? but not after applying?
nagios_3.png

Re: Test check works in CCM, but fails once applied

Posted: Tue Dec 15, 2015 9:45 pm
by Box293
I can see you are running into a problem which can lead to the issues you are having, it is using the "Test Check Command" button.

Due to some issues with how PHP escapes characters the "Test Check Command" does not work in these situations and should be ignored.

So for all further testing of this service you need to:

Make the changes to the service
Save the Service
Apply Configuration
Go back to the home screen and find the Service
When viewing the Service Status Details page click the Schedule a forced immediate check link

Just to re-iterate, for all further testing for this service DO NOT use the "Test Check Command" button, follow the steps above.


Now onto your issue, I believe the problem is the value you are putting in $ARG1$

Image

Change it to C:\\temp\\ and then follow the steps above.

Does it work now?

Re: Test check works in CCM, but fails once applied

Posted: Wed Dec 16, 2015 10:31 am
by TJ.AHC
After updating that i'm getting this error.

Invalid command line: unrecognised option 'test.txt'

I'm not sure how the management of double quotes works... the section in question is this

Code: Select all

"filter=filename='$ARG2$'"
and the full code is below

Code: Select all

$USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c Check_Files -a path=$ARG1$ "filter=filename='$ARG2$'" "ok=count>= 1" "warn=written< -$ARG3$" "crit=written< -$ARG4$ or count= 0" "perf-syntax=${file} Last Written: %(written_l)"

Re: Test check works in CCM, but fails once applied

Posted: Wed Dec 16, 2015 5:12 pm
by rkennedy
Can you try taking out the single quotes around $ARG2$ and see what the result is?

Re: Test check works in CCM, but fails once applied

Posted: Wed Dec 16, 2015 5:20 pm
by TJ.AHC
New code is as follows:

[code$USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c Check_Files -a path=$ARG1$ "filter=filename=$ARG2$" "ok=count>= 1" "warn=written< -$ARG3$" "crit=written< -$ARG4$ or count= 0" "perf-syntax=${file} Last Written: %(written_l)"][/code]

Error Recieved:
Invalid command line: unrecognised option 'test.txt'

Re: Test check works in CCM, but fails once applied

Posted: Wed Dec 16, 2015 6:01 pm
by rkennedy
Do you see anything in your NSClient++ log?