Skip to content

REST (JSON) (rest_json) ​

Requests a JSON document and reads the values you point at into channels. Text states can be mapped to numbers, and a value can be required to equal an expected one. Use it for status endpoints of appliances and services that have no sensor of their own.

Channels ​

KeyNameUnitDefault limits
response_msResponse timemswarning above 5000
one per entry of channelsits name, or its keyits unit, or nonenone. Set limits on the sensor.

Parameters ​

ParameterDefaultMeaning
schemehttpshttp or https.
port80 or 443TCP port.
pathrequiredRequest path and query, starting with /.
verify_tlstrueCheck the server certificate.
tls_fingerprintnoneTrust exactly the certificate with this SHA-256 fingerprint (colon-separated or plain hex, either case) and no other, whatever its chain, dates or name say; verify_tls is then not needed. See pinning a certificate.
headersnoneExtra request headers. Not for credentials.
authnonebearer, basic or header, with the secret credential, see HTTP content.
max_body_bytes1048576The most response body to read, 1024 to 8388608. A larger response fails the poll.
channelsrequired1 to 50 entries, below.

A channel:

FieldDefaultMeaning
keyrequiredLower case letters, digits and _, at most 40 characters. response_ms is reserved. History is stored under it.
pathrequiredWhere the value is. A JSON Pointer starting with / (/status/cpu/0, with ~1 for a slash and ~0 for a tilde in a name), or a simple path (status.cpu[0]). Use a pointer for names that contain dots.
scale1A numeric value is multiplied by this.
value_mapnone{"from": "running", "to": 1} entries turn strings, numbers or booleans into numbers. Checked before numeric conversion. A text or boolean from is also the label shown for the whole number it maps to (running for 1) in the sensor page, the tree, incident pages and notifications; the stored number does not change.
expectednoneThe raw value must equal this (a string, a number or a boolean; "5" equals 5). Anything else makes the sensor Down.
requiredtrueA missing value makes the sensor Down.
namethe keyThe name shown for the channel, up to 80 characters, as plain text.
unitnoneThe unit of the reported value (after scale), for example ms, B, %, s, °C. seconds, milliseconds, bytes, percent and celsius are read as those, which the interface formats as times and sizes; any other unit is shown as written.

The template cannot know a document's values, so the name and unit of a channel come from its entry here, before any poll. The key stays the channel's identity: renaming a channel or changing its unit never touches the history.

Numbers, numeric strings and booleans (1 and 0) become numbers. A value that is none of these and has no map entry makes the sensor Down, naming the path, because a quiet "unknown" would hide the problem. Give a text state an expected value, or map it.

Suggested interval: 60 seconds. Credential: an optional secret, used when auth is set.

Failures ​

MessageMeaning
<path> not found in the responseDown.
<path> is "x" but "y" was expectedDown.
<path> is "x", which is not a number; add a value map entry for itDown.
the response is not valid JSON (kind protocol), the endpoint answered HTTP N (kind protocol)The endpoint is not what you think it is.
the server answered HTTP 401 (kind auth_failed)The credential is wrong.

Verification ​

AGPL-3.0-only