mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-03 20:14:21 -04:00
Feat: Add json-query to MQTT monitor type (#3857)
* Feat: Add json-query MQTT monitor type * Fix: Allow result to be null * Fix: Remove unused parameter * Chore: Update JSDoc * Fix: Add default if checkType is not set --------- Co-authored-by: Louis Lam <louislam@users.noreply.github.com>
This commit is contained in:
parent
35479c7690
commit
46432618e1
8 changed files with 170 additions and 82 deletions
|
@ -4,7 +4,7 @@ const { Prometheus } = require("../prometheus");
|
|||
const { log, UP, DOWN, PENDING, MAINTENANCE, flipStatus, MAX_INTERVAL_SECOND, MIN_INTERVAL_SECOND,
|
||||
SQL_DATETIME_FORMAT
|
||||
} = require("../../src/util");
|
||||
const { tcping, ping, checkCertificate, checkStatusCode, getTotalClientInRoom, setting, mssqlQuery, postgresQuery, mysqlQuery, mqttAsync, setSetting, httpNtlm, radius, grpcQuery,
|
||||
const { tcping, ping, checkCertificate, checkStatusCode, getTotalClientInRoom, setting, mssqlQuery, postgresQuery, mysqlQuery, setSetting, httpNtlm, radius, grpcQuery,
|
||||
redisPingAsync, mongodbPing, kafkaProducerAsync, getOidcTokenClientCredentials, rootCertificatesFingerprints, axiosAbortSignal
|
||||
} = require("../util-server");
|
||||
const { R } = require("redbean-node");
|
||||
|
@ -134,6 +134,7 @@ class Monitor extends BeanModel {
|
|||
maintenance: await Monitor.isUnderMaintenance(this.id),
|
||||
mqttTopic: this.mqttTopic,
|
||||
mqttSuccessMessage: this.mqttSuccessMessage,
|
||||
mqttCheckType: this.mqttCheckType,
|
||||
databaseQuery: this.databaseQuery,
|
||||
authMethod: this.authMethod,
|
||||
grpcUrl: this.grpcUrl,
|
||||
|
@ -757,14 +758,6 @@ class Monitor extends BeanModel {
|
|||
} else {
|
||||
throw Error("Container State is " + res.data.State.Status);
|
||||
}
|
||||
} else if (this.type === "mqtt") {
|
||||
bean.msg = await mqttAsync(this.hostname, this.mqttTopic, this.mqttSuccessMessage, {
|
||||
port: this.port,
|
||||
username: this.mqttUsername,
|
||||
password: this.mqttPassword,
|
||||
interval: this.interval,
|
||||
});
|
||||
bean.status = UP;
|
||||
} else if (this.type === "sqlserver") {
|
||||
let startTime = dayjs().valueOf();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue