Hello, I am having issues getting the string check to work on my sites, I am using Nagios XI version 5.7.2 and trying to use check_http as detailed below
My site www.blahblahblah.com redirects to https://www.blahblahblah.com/xx/yy/register.asp
$USER1$/check_http -H $ARG1$ $ARG2$
$ARG1$
blahblahblah.com
$ARG2$
-s "stringiamtesting" -f ok -u /xx/register.asp?f5=true -S --sni -p 443
When I run the test url on nagios xi
/usr/local/nagios/libexec/check_http -H www.blahblahblah.com -s "stringiamtesting" -f ok -u /xx/register.asp?f5=true -S --sni -p 443
I receive the error below
HTTP CRITICAL: HTTP/1.1 404 Not Found - string 'stringiamtesting' not found on 'https://www.blahblahblah.com/xx/yy/regi ... p\?f5=true' - 1503 bytes in 0.013 second response time |time=0.012899s;;;0.000000 size=1503B;;;0
When I run the same command directly on the server via ssh it returns an http 200 ok both as the nagios user and as root as below
HTTP OK: HTTP/1.1 200 OK - 8908 bytes in 0.025 second response time |time=0.025099s;;;0.000000 size=8908B;;;0
check_http string not found issue
-
benjaminsmith
- Posts: 5324
- Joined: Wed Aug 22, 2018 4:39 pm
- Location: saint paul
Re: check_http string not found issue
Hi,
I believe there are some special characters in the string that are not getting passed as desired. This is likely due to sricter security requirements in the Nagios XI PHP scirpts.
Try wrapping the string single quotes instead of double, and test it again. For example,
I believe there are some special characters in the string that are not getting passed as desired. This is likely due to sricter security requirements in the Nagios XI PHP scirpts.
Try wrapping the string single quotes instead of double, and test it again. For example,
Code: Select all
/usr/local/nagios/libexec/check_http -H www.blahblahblah.com -s 'stringiamtesting' -f ok -u /xx/register.asp?f5=true -S --sni -p 443
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: check_http string not found issue
Hi Benjamin, thank you for your reply but unfortunately I still receive the same error using single quotes instead of double quotes
Re: check_http string not found issue
Also looking around the forum the fact I am seeing HTTP CRITICAL: HTTP/1.1 404 does this mean the http critical is for the string it does not see and the http/1.1 404 is because it is not seeing the webpage? If so I guess as it does not see the page it will never see the string.
-
benjaminsmith
- Posts: 5324
- Joined: Wed Aug 22, 2018 4:39 pm
- Location: saint paul
Re: check_http string not found issue
Hi @Elcom,
I know this not working when you run the test URL in the CCM, but how about the actual check results, are they failing?
Can post a screenshot of the check command from the CCM so we can review how the arguments are being passed? Also, try wrapping the URL argument in single quotes in case that is getting passed incorrectly via th GUI.
I know this not working when you run the test URL in the CCM, but how about the actual check results, are they failing?
Can post a screenshot of the check command from the CCM so we can review how the arguments are being passed? Also, try wrapping the URL argument in single quotes in case that is getting passed incorrectly via th GUI.
Code: Select all
/usr/local/nagios/libexec/check_http -H www.blahblahblah.com -s "stringiamtesting" -f ok -u '/xx/register.asp?f5=true' -S --sni -p 443
You do not have the required permissions to view the files attached to this post.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: check_http string not found issue
Hi Benjamin,
I have attached a screenshot of the check command from CCM and have tried wrapping the URL in single quotes to no avail.
I am unsure of your question "how about the actual check results, are they failing?" As when I run the command on the command line it returns HTTP OK: HTTP/1.1 200 OK as I had said previously.
Thanks
I have attached a screenshot of the check command from CCM and have tried wrapping the URL in single quotes to no avail.
I am unsure of your question "how about the actual check results, are they failing?" As when I run the command on the command line it returns HTTP OK: HTTP/1.1 200 OK as I had said previously.
Thanks
You do not have the required permissions to view the files attached to this post.
Re: check_http string not found issue
Using single quotes should work. Don't test it by clicking on the "Run Check Command" button under the CCM as the CCM seems to be escaping the question mark (\?), which causes the check to fail.I have attached a screenshot of the check command from CCM and have tried wrapping the URL in single quotes to no avail.
Go to:
Home > Service Status > <your service>, click on Force an immediate check under the Quick Actions section, and review the output.
Is your check working now?
See the instructions above.I am unsure of your question "how about the actual check results, are they failing?" As when I run the command on the command line it returns HTTP OK: HTTP/1.1 200 OK as I had said previously.
In addition to this, you can try using "-f follow" instead of "-f ok" since your site (www.blahblahblah.com) redirects to https://www.blahblahblah.com/xx/yy/register.asp. I can't test this in house, but I believe you should be using "follow".
Let us know if this helped. Thanks!
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: check_http string not found issue
Hi Imiltchev,
Many thanks, when I run the force immediate check (Home > Service Status > <your service>, click on Force an immediate check under the Quick Actions) as you suggest this does indeed work, when I try and use the -f follow this still errors.
Is there a way to stop CCM escaping the question mark and causing the test to fail?
Many thanks, when I run the force immediate check (Home > Service Status > <your service>, click on Force an immediate check under the Quick Actions) as you suggest this does indeed work, when I try and use the -f follow this still errors.
Is there a way to stop CCM escaping the question mark and causing the test to fail?
Re: check_http string not found issue
Leave the "working" command "as is" then. Don't change it. As long as it works when you click on "Force an immediate check", your check will work just fine.Many thanks, when I run the force immediate check (Home > Service Status > <your service>, click on Force an immediate check under the Quick Actions) as you suggest this does indeed work, when I try and use the -f follow this still errors.
Testing in the CCM was never meant to be a replacement of the testing from the command line. It is placed there for convenience. It works in the majority of the cases, but sometimes it fails. Some of the escaping is done for "security reasons", and it won't go away. I hope this makes sense.Is there a way to stop CCM escaping the question mark and causing the test to fail?
Be sure to check out our Knowledgebase for helpful articles and solutions!