title: Generic JSON API: monitor fields from any HTTP/JSON endpoint
agents: json_api
catalog: app
license: GPLv2
distribution: https://github.com/otAAAh/checkmk-json-agent
description:
 This check works together with the {Generic JSON API} special agent. The
 agent fetches one or more JSON documents over HTTP(S) and extracts the fields
 configured in the rule's endpoints. Each configured field becomes one service.

 A numeric value with configured levels is checked against those levels and
 exposed as a metric. A field may also carry an arithmetic transform (an
 expression on the variable {value}, e.g. {value / 1024 / 1024}) that is applied
 to the numeric value first, so the levels, the metric and the summary all use
 the transformed value; a broken expression or a non-finite result makes the
 service {UNKNOWN}. A field may instead be configured to count the number of
 elements at its path: when the path resolves to an array or object the service
 monitors the element count (array length or number of object keys) as a
 number, to which the unit, levels, transform and metric all apply, and it goes
 {UNKNOWN} if the path is neither an array nor an object. A {[*]} wildcard or a
 count may additionally be restricted with a filter, so that only the elements
 whose sub-field matches a condition (equals, does not equal, matches or does
 not match a regular expression) become services or are counted. String matching
 offers two modes: a value can be required
 to fully match a regular expression, with a configurable state (default {CRIT})
 when it does not; or the value can be mapped to a state by matching it against
 separate OK, WARN and CRIT regular expressions, tried in that order with the
 first full match winning and a configurable state (default {OK}) when none
 matches. Otherwise the value is shown in the service summary, and a metric is
 added when it is numeric.

 The service goes {UNKNOWN} if the configured path is not present in the
 response, or if its endpoint could not be reached or did not return JSON. By
 default only 2xx responses are read; additional HTTP status codes can be
 accepted per endpoint in the rule (so a health endpoint that answers with a
 non-2xx status and a JSON body can still be monitored). An endpoint failure is
 confined to that endpoint's own services.

 Configure it in Setup with the rule {Generic JSON API}. The levels and string
 matching a field carries there become the service's defaults; you can override
 them per folder, host or service with the check parameters rule {Generic JSON
 API} (Setup > Service monitoring rules > Applications) without touching the
 agent's connection settings.

item:
 The service name configured for the extracted field.

discovery:
 One service is created for each field configured in the special agent rule.
