You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(json-values): add bearer token auth, custom headers, and per-key thresholds
* --token adds HTTP bearer authentication
* --header (curl-style "Name: Value", repeatable) sends arbitrary custom headers
* --warning-key/--warning and --critical-key/--critical alert on a numeric value at a specific JSON key with Nagios range syntax; the overall state is the worst of the JSON state and the two key-level thresholds
* all --*-key parameters now support dot-notation for nested keys (e.g. --state-key=meta.state, --critical-key=detailedInfo.count1)
* empty --state-key is treated as an explicit opt-out so threshold-only monitoring of schema-free JSON responses no longer collapses to UNKNOWN
* add unit tests covering flat/nested fixtures, state coercion edge cases, and the threshold semantics, with a fixture copied verbatim from the issue body
Closes#1005
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,6 +36,7 @@ Monitoring Plugins:
36
36
* infomaniak-swiss-backup-devices: add `--ignore-customer`, `--ignore-name`, `--ignore-tag`, `--ignore-user` parameters to skip devices by regex
37
37
* infomaniak-swiss-backup-products: add `--ignore-customer`, `--ignore-tag` parameters to skip products by regex
38
38
* ipmi-sel: add `--ignore` parameter to filter out SEL entries by regex, e.g. auto-generated "Log area reset/cleared" entries after `ipmitool sel clear` ([#982](https://github.com/Linuxfabrik/monitoring-plugins/issues/982))
39
+
* json-values: add `--token` and `--header` parameters for HTTP bearer-token and custom header authentication when fetching JSON from protected endpoints, add `--warning-key` / `--warning` and `--critical-key` / `--critical` to alert on a numeric value at a specific JSON key (with Nagios range syntax), and support dot-notation for nested keys in all `--*-key` parameters (e.g. `--state-key=meta.state`) ([#1005](https://github.com/Linuxfabrik/monitoring-plugins/issues/1005))
39
40
* librenms-alerts: add device-type `management`
40
41
* librenms-health: add device-type `management`
41
42
* nextcloud-enterprise: provides information about an installed Nextcloud Enterprise subscription
Copy file name to clipboardExpand all lines: check-plugins/json-values/README.md
+92-18Lines changed: 92 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,9 @@ Parses a JSON object from a local file, HTTP/HTTPS URL, or SMB share and extract
11
11
* Extracts the output message from the key specified by `--message-key` (default: `message`)
12
12
* Extracts the perfdata string from the key specified by `--perfdata-key` (default: `perfdata`)
13
13
* Extracts the return state from the key specified by `--state-key` (default: `state`)
14
+
* All `--*-key` parameters support dot-notation for nested keys (e.g. `--state-key=meta.state`)
15
+
* HTTP endpoints can be authenticated with a bearer token (`--token`) and/or custom request headers (`--header`, curl-style `"Name: Value"`, can be specified multiple times)
16
+
* In addition to the state extracted from the JSON itself, the value at a specific JSON key can be alerted on via `--warning-key`/`--warning` and `--critical-key`/`--critical` (Nagios range syntax); the value at the referenced key must be numeric, otherwise the check returns UNKNOWN. The overall check state is the worst of the JSON state and the two key-level thresholds.
14
17
15
18
16
19
## Fact Sheet
@@ -29,41 +32,90 @@ Parses a JSON object from a local file, HTTP/HTTPS URL, or SMB share and extract
* Returns the state value from the JSON object (0=OK, 1=WARN, 2=CRIT, 3=UNKNOWN).
97
-
* UNKNOWN if `--filename` and `--url` are used together, if the URL protocol is unsupported, if JSON parsing fails, or if the state key is missing.
169
+
* Returns the worst of three states: the state extracted from the JSON object (0=OK, 1=WARN, 2=CRIT, 3=UNKNOWN), the state computed from `--warning-key` / `--warning`, and the state computed from `--critical-key` / `--critical`.
170
+
* UNKNOWN if `--filename` and `--url` are used together, if the URL protocol is unsupported, if JSON parsing fails, if the state key is missing or does not resolve to an integer in the range `0..3`, or if a threshold key cannot be resolved or is not numeric.
171
+
*`--warning` / `--warning-key` and `--critical` / `--critical-key` must be specified together (range without a key has nothing to compare, key without a range would silently never alert).
98
172
*`--always-ok` suppresses all alerts and always returns OK.
0 commit comments