# http - fetch and verify a URL

Attempts to fetch a URL and makes sure the HTTP return code is (by default) 200/OK. Can also match the content of the page to a regular expression.

method
  Type:

    string

  Required:

    true

  Default:

    GET

  The method used in the HTTP request: HEAD GET POST

url
  Type:

    string

  Required:

    true

  the URL to open

regexp
  Type:

    regexp

  Required:

    false

  Default:

    none

  the regexp to look for in the body of the response

allowed_codes
  Type:

    comma-separated list of integer

  Required:

    false

  Default:

    200

  a list of acceptable HTTP status codes

allow_redirects
  Type:

    bool

  Required:

    false

  Default:

    true

  Follow redirects

username
  Type:

    str

  Required:

    false

  Default:

    none

  Username for http basic auth

password
  Type:

    str

  Required:

    false

  Default:

    none

  Password for http basic auth

verify_hostname
  Type:

    boolean

  Required:

    false

  Default:

    true

  set to false to disable SSL hostname verification (e.g. with self-signed certificates)

timeout
  Type:

    integer

  Required:

    false

  Default:

    `5`

  the timeout in seconds for the HTTP request to complete

Tip

You can set the headers globally in monitors.ini - just create `[defaults]` section on top of the file

headers
  Type:

    JSON map as string

  Required:

    false

  Default:

    none

  JSON map of HTTP header names and values to add to the request

Warning

Use only one of the following options - either json OR data.

data
  Type:

    string

  Required:

    false

  Default:

    none

  Data to add to the POST request

json
  Type:

    JSON as string

  Required:

    false

  Default:

    none

  JSON to add to the POST request