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
Test check works in CCM, but fails once applied
Re: Test check works in CCM, but fails once applied
Can you post a screenshot of your service configuration?
What is the result when you run the command over CLI as the nagios user?
What is the result when you run the command over CLI as the nagios user?
Former Nagios Employee
Re: Test check works in CCM, but fails once applied
Here are the screenshots
You do not have the required permissions to view the files attached to this post.
Re: Test check works in CCM, but fails once applied
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
Re: Test check works in CCM, but fails once applied
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?
You do not have the required permissions to view the files attached to this post.
- 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
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$

Change it to C:\\temp\\ and then follow the steps above.
Does it work now?
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$
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.
Re: Test check works in CCM, but fails once applied
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 and the full code is below
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$'"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
Can you try taking out the single quotes around $ARG2$ and see what the result is?
Former Nagios Employee
Re: Test check works in CCM, but fails once applied
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:
[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
Do you see anything in your NSClient++ log?
Former Nagios Employee