Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

...

...

...

...

...


Info
This plugin tests the HTTP service on the specified host. It can test normal (HTTP) and secure (HTTPS) servers, follow redirects, search for strings and regular expressions, check connection times, and report on certificate expiration times.

...

Important Options
Info
title

Status
colourGreen
titleLAST TESTED ON CHECKMK 2.3.0P1


Panel
borderColorblack
bgColor#f8f8f8
titleTable of Contents

Table of Contents


Note

check_http has many valuable configuration options. Please click here for some of the more common ones

Table of Contents

...


Debugging

Info
titleProxy

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:

Code Block
languagebash
themeRDark
curl -x 173.212.220.96:3128myproxyip:proxy_port https://www.google.decom/ --verbose

Execute the active Check manually

There are several ways to access the command. One way is described here: Configuring Check Email (check_mail)#ExecuteactiveCheckmanually

One other way is with cmk -N:

Code Block
languagebash
themeRDark
OMD[mysite]:~/lib/nagios/plugins$ cmk -N |grep http
  check_command                 check_mk_active-http!'-u' 'https://www.google.decom/' '--ssl' '--onredirect=follow' '-j' 'CONNECT' '--sni' '-p' '3128proxy_port' '173.212.220.96myproxyip' 'www.google.decom'
  command_line                  /omd/sites/cme2mysite/lib/nagios/plugins/check_http $ARG1$
  command_name                  check_mk_active-http

cmk -N will show you the nagios config. Active Checks in Checkmk are based on nagios.One



A second way to access the command is via livestatus:

Code Block
languagebash
themeRDark
OMD[mysite]:~/lib/nagios/plugins$ lq "GET services\nColumns:host_name description check_command_expanded\nFilter: host_name = localhostmysite\nFilter: description = HTTPS HTTPSmyservicename"
localhost;HTTPS HTTPS;check_mk_active-http!'-u' 'https://www.google.decom/' '--ssl' '--onredirect=follow' '-j' 'CONNECT' '--sni' '-p' '3128proxy_port' '173.212.220.96myproxyip' 'www.google.decom'

In both cases: Copy the parameters after the '!' for executing the command later.

...

Code Block
languagebash
themeRDark
OMD[mysite]:~/lib/nagios/plugins$ ./check_http '-u' 'https://www.google.decom/' '--ssl' '--onredirect=follow' '-j' 'CONNECT' '--sni' '-p' '3128proxy_port' '173.212.220.96myproxyip' 'www.google.decom'


For a detailed log, you can use --verbose at the end of the command:

Code Block
languagebash
themeRDark
OMD[mysite]:~/lib/nagios/plugins$ ./check_http '-u' 'https://www.google.decom/' '--ssl' '--onredirect=follow' '-j' 'CONNECT' '--sni' '-p' '3128proxy_port' '173.212.220.96myproxyip' 'www.google.decom' --verbose


For more information, you can use --help command flag.

Code Block
languagebash
themeRDark
OMD[mysite]:~/lib/nagios/plugins$ ./check_http --help

Debugging Regular Expressions (Regex)

Information on errors with Javascript
Note
titleJavascript

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. 

Example Check HTTP serviceImage Added


The service check returns OK

Screenshot of HTTP check OKImage Added


Running the command by hand can help debug issues as well.

Code Block
languagebash
themeRDark
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 domain
  • Virtual host → is necessary if you have multiple domains and one host running
  • How to handle redirect → How to handle redirected pages
  • Regular Expression to expect in
  • content → 
  • content → Used to parse particular content from websites. 
  • HTTP Method → Set to CONNECT if you're using a proxy
  • Disable SSL/TLS hostname extension support (SNI)
    Image Removed


  • Example configuration of Check HTTP service.Image Added


Info

Filter by label (Content by label)
showLabelsfalse
max5
spacesKB
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel in ( "check_http" , "http" , "active_check" ) and type = "page" and space = "KB"
labelshttp check_http

...