Debugging check_http
This plugin tests HTTP/HTTPS services, follows redirects, checks content, connection times, and certificate expirations.
LAST TESTED ON CHECKMK 2.3.0P1
check_http has many valuable configuration options. Please click here for some of the more common ones.
Debugging
Proxy
In the following examples, you will see references to myproxyip and proxy_port. Please replace this information with your own proxy IP and port number.
Debugging with curl
If you have trouble using check_http, you can start to query the URL with curl:
curl -x myproxyip:proxy_port https://www.google.com/ --verbose
Execute the active Check manually
There are several ways to access the command. One way is described here: Execute active check manually.
One other way is with cmk -N:
OMD[mysite]:~/lib/nagios/plugins$ cmk -N |grep http
check_command check_mk_active-http!'-u' 'https://www.google.com/' '--ssl' '--onredirect=follow' '-j' 'CONNECT' '--sni' '-p' 'proxy_port' 'myproxyip' 'www.google.com'
command_line /omd/sites/mysite/lib/nagios/plugins/check_http $ARG1$
command_name check_mk_active-httpcmk -N will show you the nagios config. Active Checks in Checkmk are based on nagios.
A second way to access the command is via livestatus:
OMD[mysite]:~/lib/nagios/plugins$ lq "GET services\nColumns:host_name description check_command_expanded\nFilter: host_name = mysite\nFilter: description = myservicename"
localhost;HTTPS HTTPS;check_mk_active-http!'-u' 'https://www.google.com/' '--ssl' '--onredirect=follow' '-j' 'CONNECT' '--sni' '-p' 'proxy_port' 'myproxyip' 'www.google.com'In both cases: Copy the parameters after the '!' for executing the command later.
Now you need to run the check_http and paste the copied parameters:
OMD[mysite]:~/lib/nagios/plugins$ ./check_http '-u' 'https://www.google.com/' '--ssl' '--onredirect=follow' '-j' 'CONNECT' '--sni' '-p' 'proxy_port' 'myproxyip' 'www.google.com'
For a detailed log, you can use --verbose at the end of the command:
OMD[mysite]:~/lib/nagios/plugins$ ./check_http '-u' 'https://www.google.com/' '--ssl' '--onredirect=follow' '-j' 'CONNECT' '--sni' '-p' 'proxy_port' 'myproxyip' 'www.google.com' --verbose
For more information, you can use --help command flag.
OMD[mysite]:~/lib/nagios/plugins$ ./check_http --help
Debugging Regular Expressions (Regex)
Javascript
If there is any client-side or Javascript-related content, Checkmk will not be able to parse this information with regular expressions.
In the following example, we are using regular expressions on status.cloud.google.com to gather Access Content Manager information.
The service check returns OK
Running the command by hand can help debug issues as well.
OMD[mysite]:~/lib/nagios/plugins$ ./check_http -u /regional/americas --ssl -l -R 'Access Context Manager' --sni -I status.cloud.google.com -H status.cloud.google.com
HTTP OK: HTTP/1.1 200 OK - 584329 bytes in 4.511 second response time |time=4.511160s;;;0.000000;10.000000 size=584329B;;;0;
Some important options
Address (name / IP or Proxy)
If you need a proxy to access the domainVirtual host
This is necessary if you have multiple domains and one host runningHow to handle redirect
How to handle redirected pagesRegular Expression to expect in content
Used to parse particular content from websites.HTTP Method
Set toCONNECTif you're using a proxy
Useful Links
List of public proxies for debugging: Free proxy server list