5.15. http

The http module performs GET requests over either HTTP or HTTPS and checks the return code and optionally the body.

loader

lua

object

noit.module.http

5.15.1. Module Configuration

5.15.2. Check Configuration

url
required

required

allowed

.+

The URL including schema and hostname (as you would type into a browser's location bar).

header_(\S+)
required

optional

allowed

.+

Allows the setting of arbitrary HTTP headers in the request.

method
required

optional

default

GET

allowed

\S+

The HTTP method to use.

payload
required

optional

allowed

.*

The information transferred as the payload of an HTTP request.

auth_method
required

optional

allowed

^(?:Basic|Digest|Auto)$

HTTP Authentication method to use.

auth_user
required

optional

allowed

[^:]*

The user to authenticate as.

auth_password
required

optional

allowed

.*

The password to use during authentication.

ca_chain
required

optional

allowed

.+

A path to a file containing all the certificate authorities that should be loaded to validate the remote certificate (for SSL checks).

certificate_file
required

optional

allowed

.+

A path to a file containing the client certificate that will be presented to the remote server (for SSL checks).

key_file
required

optional

allowed

.+

A path to a file containing key to be used in conjunction with the cilent certificate (for SSL checks).

ciphers
required

optional

allowed

.+

A list of ciphers to be used in the SSL protocol (for SSL checks).

code
required

optional

default

^200$

allowed

.+

The HTTP code that is expected. If the code received does not match this regular expression, the check is marked as "bad."

redirects
required

optional

default

0

allowed

\d+

The maximum number of Location header redirects to follow.

body
required

optional

allowed

.+

This regular expression is matched against the body of the response. If a match is not found, the check will be marked as "bad."

body_match_*
required

optional

allowed

.+

This regular expression is matched against the body of the response. If a match is found it is captured and added as a metric. For example, if setting is named 'body_match_foo_bar' and a match is found new metric called 'foo_bar' will be added.

extract
required

optional

allowed

.+

This regular expression is matched against the body of the response globally. The first capturing match is the key and the second capturing match is the value. Each key/value extracted is registered as a metric for the check.

pcre_match_limit
required

optional

default

10000

allowed

\d+

This sets the PCRE internal match limit (see pcreapi documentation).

include_body
required

optional

default

false

allowed

^(?:true|false|on|off)$

Include whole response body as a metric with the key 'body'.

read_limit
required

optional

default

0

allowed

\d+

Sets an approximate limit on the data read (0 means no limit).

http_version
required

optional

default

1.1

allowed

^(\d+\.\d+)?$

Sets the HTTP version for the check to use.

Example 5.16. Checking an HTTP and HTTPS URL.

This example checks the OmniTI Labs website over both HTTP and HTTPS.

      <noit>
        <modules>
          <loader image="lua" name="lua">
            <config><directory>/opt/reconnoiter/libexec/modules-lua/?.lua</directory></config>
          </loader>
          <module loader="lua" name="http" object="noit.module.http" />
        </modules>
        <checks>
          <labs target="8.8.38.5" module="http">
            <check uuid="fe3e984c-7895-11dd-90c1-c74c31b431f0" name="http">
              <config><url>http://labs.omniti.com/</url></config>
            </check>
            <check uuid="1ecd887a-7896-11dd-b28d-0b4216877f83" name="https">
              <config><url>https://labs.omniti.com/</url></config>
            </check>
          </labs>
        </checks>
      </noit>