Check a value, not just "is it up": JSON value checks on web endpoints
A web check can read a value out of a JSON answer (power.now, state, data.result[0].value[1]) and judge it: below, above, equal to, contains, is there. The value read is shown on the Endpoints page, charted under History, exported as homelab_endpoint_value and in the read API. A check can also send one header (a token), stored encrypted, never returned, and not forwarded to another host on a redirect. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e114567d64
commit
3cb3e4988f
21 files changed
+6804
-47
No files matched your search
@@ -141,6 +141,13 @@ export const endpointChecks = sqliteTable("endpoint_checks", {
|
||||
expectStatus: text("expect_status"), // http: "200-299, 301"; null = 200-399
|
||||
keyword: text("keyword"), // http: text the page must contain
|
||||
insecure: integer("insecure", { mode: "boolean" }).notNull().default(false), // accept a certificate that isn't trusted (self-signed, a private CA)
|
||||
valuePath: text("value_path"), // http: where in a JSON answer the value to judge is ("data.result[0].value[1]")
|
||||
valueOp: text("value_op"), // http: "<" "<=" ">" ">=" "=" "!=" "contains" "exists"
|
||||
valueExpected: text("value_expected"), // http: what it is compared with (a number, or text for "=", "!=" and "contains")
|
||||
valueUnit: text("value_unit"), // http: shown after the value ("W", "%", "°C")
|
||||
headerName: text("header_name"), // http: a header to send with the request ("Authorization")
|
||||
headerValue: text("header_value"), // its value, encrypted at rest like the notification channels' secrets; never returned by the API
|
||||
lastValue: text("last_value"), // http: what was read the last time, as text
|
||||
intervalMinutes: integer("interval_minutes").notNull().default(5),
|
||||
timeoutSeconds: integer("timeout_seconds").notNull().default(10),
|
||||
failuresBeforeAlert: integer("failures_before_alert").notNull().default(2),
|
||||
@@ -170,6 +177,7 @@ export const endpointResults = sqliteTable(
|
||||
ok: integer("ok", { mode: "boolean" }).notNull(),
|
||||
ms: integer("ms"),
|
||||
message: text("message"),
|
||||
value: real("value"), // the number read from the answer, for a check that judges a value
|
||||
},
|
||||
(t) => [index("endpoint_results_check_idx").on(t.checkId, t.at)],
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user