Check_HTTP query
-
neworderfac33
- Posts: 329
- Joined: Fri Jul 24, 2015 11:04 am
Re: Check_HTTP query
Thank you - that's helping as I can now successfully identify text in either the header or the content, but can anyone confirm the correct syntax for specifying the URL as when I do this:
./check_http -H MyHost -u MyURL --expect=301 -s "Document Moved" -v
I get an OK, but when I add a trailing "/" to the URL, I get a Critical
Thanks all, and have a good weekend.
Pete
./check_http -H MyHost -u MyURL --expect=301 -s "Document Moved" -v
I get an OK, but when I add a trailing "/" to the URL, I get a Critical
Thanks all, and have a good weekend.
Pete
Re: Check_HTTP query
The trailing slash thing depends on the web server. With Apache, mod_dir is usually the culprit here:
http://httpd.apache.org/docs/current/mod/mod_dir.html
http://httpd.apache.org/docs/current/mod/mod_dir.html
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
-
neworderfac33
- Posts: 329
- Joined: Fri Jul 24, 2015 11:04 am
Re: Check_HTTP query
OK, So here's what I have:
returns "Name or service not known"
Any offers?
As always, thanks for your help.
Pete
Code: Select all
define command{
command_name check_http_url
command_line $USER1$/check_http -I $HOSTADDRESS$ -u $ARG1$
}
define host{
host_name URL1
hostgroups 000-URL1
address www.MyURL.com/
max_check_attempts 5
check_period 24x7
contact_groups admins
notification_period 24x7
}
define hostgroup{
hostgroup_name 000-URL1
alias Website Checking
}
define service{
use generic-service
host_name URL1
service_description URL1 + Text [Country of Residence] + Status [301]
check_command check_http_url!URL1 -u /blah/blah/system/ -s "Country of Residence" --expect=301
#register 0
}
Any offers?
As always, thanks for your help.
Pete
Re: Check_HTTP query
Your Service's check_command is malformed:
Drop the "URL1" since it doesn't fit into your command definition. It's just hanging out there. Also remove the -u argument since your Command definition is already including it.
Also remove the preceding slash from your Host's address definition. www.MyURL.com should be sufficient (especially if you're including the preceding slash in your URL path).
Code: Select all
check_command check_http_url!URL1 -u /blah/blah/system/ -s "Country of Residence" --expect=301Code: Select all
check_command check_http_url!/blah/blah/system/ -s "Country of Residence" --expect=301Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
-
neworderfac33
- Posts: 329
- Joined: Fri Jul 24, 2015 11:04 am
Re: Check_HTTP query
Thank you for coming back to me.
So now I have:
So, I'm testing for the presence of the text string "Country of residence" in "www.yada.dev.com/my/sub/folder"
But its STILL showing "Name or Service not known"
Sorry to be a nuisance!
Pete
So now I have:
Code: Select all
define host{
host_name URL1
hostgroups 000-URL1
address http://www.yada.dev.com
max_check_attempts 5
check_period 24x7
contact_groups admins
notification_period 24x7
}
define service{
use generic-service
host_name URL1
service_description MyServiceDescription
check_command check_http_url!/my/sub/folder/ -s "Country of Residence" --expect=301
#register 0
}
But its STILL showing "Name or Service not known"
Sorry to be a nuisance!
Pete
Re: Check_HTTP query
Oh pete, you're not a nuisance 
Your Host definition's address should not contain http://. See if removing that does the trick!
Your Host definition's address should not contain http://. See if removing that does the trick!
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
-
neworderfac33
- Posts: 329
- Joined: Fri Jul 24, 2015 11:04 am
Re: Check_HTTP query
No luck, I'm afraid - just to recap:
Within the service, I have tried both "URL" and the name of the actual url to which it refers, but both return "Name or service not known".
Maybe Core just isn't meant to be able to monitor a URL without a server hostname to attach it to (he finished, desperately)?
And yes, I AM a nuisance! Perhaps I should ask Core to resolve complex quantum mechanics equations and explain the meaning of life while I'm at it..!
Pete
Code: Select all
define command{
command_name check_http_url
command_line $USER1$/check_http -I $HOSTADDRESS$ -u $ARG1$
}
define host{
host_name URL1
hostgroups 000-URL1
address MyURL.dev.com
max_check_attempts 5
check_period 24x7
contact_groups admins
notification_period 24x7
}
define service{
use generic-service
host_name URL1
service_description URL1 - URL1/my/folder/structure + Text [Country of Residence] + Status [301]
check_command check_http_url!URL1/my/folder/structure/ -s "Country of Residence" --expect=301
#register 0
}
Maybe Core just isn't meant to be able to monitor a URL without a server hostname to attach it to (he finished, desperately)?
And yes, I AM a nuisance! Perhaps I should ask Core to resolve complex quantum mechanics equations and explain the meaning of life while I'm at it..!
Pete
Re: Check_HTTP query
Your check_http_url command definition seems to have switched back to using -I instead of -H. Try changing it like so:
Code: Select all
define command{
command_name check_http_url
command_line $USER1$/check_http -H $HOSTADDRESS$ -u $ARG1$
}Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
-
neworderfac33
- Posts: 329
- Joined: Fri Jul 24, 2015 11:04 am
Re: Check_HTTP query
NOW we're getting somewhere.
The following:
returns:
HTTP CRITICAL - Invalid HTTP response received from host: HTTP/1.1 400 Bad Request
which is a bit further on than I was yesterday.
Thanks for your continued patience.
Pete
The following:
Code: Select all
define command{
command_name check_http_url
command_line $USER1$/check_http -H $HOSTADDRESS$ -u $ARG1$
}
define host{
host_name URL1
hostgroups 000-URL1
address MYURL.uat.com
max_check_attempts 5
check_period 24x7
contact_groups admins
notification_period 24x7
}
define service{
use generic-service
host_name URL1
service_description
check_command check_http_url!URL1/My/URL/name/ --expect=301
}
HTTP CRITICAL - Invalid HTTP response received from host: HTTP/1.1 400 Bad Request
which is a bit further on than I was yesterday.
Thanks for your continued patience.
Pete
Re: Check_HTTP query
Your Service's check command seems to have changed between posts. It no longer includes a preceding slash for the URL:
Try giving it a preceding slash like so:
Code: Select all
check_command check_http_url!URL1/My/URL/name/ --expect=301Code: Select all
check_command check_http_url!/URL1/My/URL/name/ --expect=301Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/