CLI reference

norcube monitor monitors create

Create a monitor; its first check runs right away

Not verified yet

Creates an enabled monitor of one type:

http     requests --url and expects --expect (default 2xx) within --timeout;
         for https URLs it also watches the certificate and the domain's
         registration unless --no-cert-watch / --no-domain-watch
keyword  an HTTP monitor that also looks for --keyword in the body
         (--keyword-mode absent: alerts when it appears)
ssl      checks the certificate of --host:--port and alerts --alert-days
         before it expires
domain   checks the registration of --domain and alerts --alert-days
         before it expires

Settings not given start from the dashboard's defaults. For anything the flags don't cover, pass the API's JSON body with --from-file (see "nrc api monitor POST /monitors"). Secret header values come from a file or standard input only (--secret-headers-file), never from arguments. The first check runs at once and is billed like a scheduled one.

Usage

norcube monitor monitors create <name> [flags]

Examples

norcube monitor monitors create "Shop" --type http --url https://shop.example.com/health
norcube monitor monitors create "Login page" --type keyword --url https://example.com/login --keyword "Sign in"
norcube monitor monitors create "API cert" --type ssl --host api.example.com --alert-days 30,7
norcube monitor monitors create "example.com" --type domain --domain example.com --interval 24h
printf 'Authorization: Bearer %s\n' "$TOKEN" | norcube monitor monitors create "Admin API" --type http --url https://example.com/admin/health --secret-headers-file -
norcube monitor monitors create --from-file monitor.json

Flags

FlagDefaultDescription
--alert-daysSSL and domain: alert this many days before expiry, up to 5 values (default 30,14,7)
--body-content-typeHTTP: Content-Type of --body-file
--body-fileHTTP: send the request body read from this file (- for standard input)
--cert-expiry-daysHTTP: also watch the certificate, alerting this many days before it expires (https URLs; default on with 30,14,7)
--descriptionA note on what the monitor is for
--domainDomain: the registered domain, e.g. example.com (not www.example.com)
--domain-expiry-daysHTTP: also watch the domain's registration, alerting this many days before it expires (default on with 30,14,7 for host names)
--expectHTTP: accepted status codes or ranges, e.g. 2xx, 301, 400-404 (repeat or comma-separate; default 2xx)
--from-fileRead the request body as JSON from this file (- for standard input), in the API's shape; no other setting flags then
--headerHTTP: a request header "Name: value" (repeatable; replaces the plain headers on update)
--hostSSL: host whose certificate to check
--insecureHTTP: don't verify the TLS certificate (it is still reported)
--interval0sHow often to check, e.g. 30s, 5m, 1h (default 1m for HTTP, 1h for SSL, 12h for domains; your organization's limit sets the minimum)
--keywordHTTP: text to look for in the response body (the first 256 KiB)
--keyword-case-sensitiveHTTP: match the keyword's case
--keyword-modeHTTP: whether the keyword must be present (default) or absent
--max-redirectsHTTP: redirects to follow at most (default 5)
--methodHTTP: request method (default GET)
--no-cert-watchHTTP: don't watch the certificate
--no-domain-watchHTTP: don't watch the domain's registration
--no-follow-redirectsHTTP: judge the first response instead of following redirects
--portSSL: port (default 443)
--secret-headers-fileHTTP: read secret headers ("Name: value" per line) from this file (- for standard input); stored encrypted, never shown again
--server-nameSSL: SNI name to send, when it differs from --host
--slow0sHTTP: warn when a response takes longer than this
--timeout0sHTTP: give up on a request after this long, 1s to 30s (default 10s)
--typeMonitor type: http, keyword, ssl or domain
--urlHTTP: the URL to request

Every command also takes the global flags: --profile, --org, -o, --query, --debug and more.

See also

On this page