Skip to content

Check plugins - check-http

The check-http plugin performs monitoring of a desired server via HTTP connection.

Configurable options

OptionAbbreviationRequiredExplanationMultiple AllowedDefault Value
--url-uURL to connect to
--status-sDesignate the monitoring results for each HTTP response code in the format key=value
--no-check-certificateDo not authenticate certificate
--source-ip-iSource IP address
-HHTTP request header
--pattern-pRegular expression to check the HTTP response body
--max-redirectsMaximum number of redirects to follow10
--method-mHTTP request method (Specify GET, HEAD, POST, or PUT)GET
--connect-toConnect to HOST2:PORT2 instead of HOST1:PORT1. Specify in the format HOST1:PORT1:HOST2:PORT2
--proxy-xSend requests via HTTP proxy. Specify in the format [PROTOCOL://][USER:PASS@]HOST[:PORT]PORT is 1080
--userAssign the user ID and password for Basic authentication in the format USER[:PASSWORD]
--require-bytes-BChecks that response size matches designated number of bytes-1
--body-dRequest body
--min-bytes-gChecks that responses are at least the designated number of bytes-1
--timeout-tTimeout length (seconds)0
--cert-fileAssign certificate used for client authentication
--key-fileAssign key file used for client authentication
--ca-fileAssign CA certificate used for client authentication

Monitoring results by HTTP Response code

The monitoring results for each HTTP response code can be configured via the --status option, but if it they are not configured, the monitoring results are as below.

HTTP Response CodeMonitoring Results
100 levelOK
200 levelOK
300 levelOK
400 levelWARNING
OtherCRITICAL
  • The monitoring results for each HTTP response code can be configured via the --status option in the format key-value.
  • HTTP response codes may also be assigned to a range, such as 200-404.

Example configurations

To monitor https://mackerel.io/, use the following configuration.

toml
[plugin.checks.https-mackerelio]
command = ["check-http", "-u", "https://mackerel.io"]

To set the monitoring result for the HTTP response of 404 to OK, use the following configuration.

toml
[plugin.checks.https-mackerelio]
command = ["check-http", "-u", "https://mackerel.io", "--status", "404=OK"]

It is also possible to designate the HTTP status code in the format 200-404.

toml
[plugin.checks.https-mackerelio]
command = ["check-http", "-u", "https://mackerel.io", "--status", "200-404=OK"]

Tips

Usually, for monitoring Internet-exposed endpoints as in the [Example configurations](##Example configurations), [External URL Monitoring] (https://mackerel.io/docs/entry/external-monitoring) via the main Mackerel service is recommended.

Please use the check-http plugin as an internal monitoring method for monitoring internal APIs, etc., on the same network which cannot be monitored directly from the Internet.

It can also be used as a substitute to monitor URLs which require client authentication, etc., that are not compatible with external URL monitoring.

Repository

https://github.com/mackerelio/go-check-plugins/tree/master/check-http