Test check works in CCM, but fails once applied

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
TJ.AHC
Posts: 11
Joined: Mon Nov 30, 2015 2:16 pm

Test check works in CCM, but fails once applied

Post 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
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

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

Post 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?
Former Nagios Employee
TJ.AHC
Posts: 11
Joined: Mon Nov 30, 2015 2:16 pm

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

Post by TJ.AHC »

Here are the screenshots
nagios_1.png
nagios_1.png
You do not have the required permissions to view the files attached to this post.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

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

Post 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.
Former Nagios Employee
TJ.AHC
Posts: 11
Joined: Mon Nov 30, 2015 2:16 pm

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

Post 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
You do not have the required permissions to view the files attached to this post.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

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

Post 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?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
TJ.AHC
Posts: 11
Joined: Mon Nov 30, 2015 2:16 pm

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

Post 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)"
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

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

Post by rkennedy »

Can you try taking out the single quotes around $ARG2$ and see what the result is?
Former Nagios Employee
TJ.AHC
Posts: 11
Joined: Mon Nov 30, 2015 2:16 pm

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

Post 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'
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

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

Post by rkennedy »

Do you see anything in your NSClient++ log?
Former Nagios Employee
Locked