|
|
@ -7,7 +7,7 @@ dayjs.extend(timezone);
|
|
|
|
const axios = require("axios");
|
|
|
|
const axios = require("axios");
|
|
|
|
const { Prometheus } = require("../prometheus");
|
|
|
|
const { Prometheus } = require("../prometheus");
|
|
|
|
const { log, UP, DOWN, PENDING, flipStatus, TimeLogger } = require("../../src/util");
|
|
|
|
const { log, UP, DOWN, PENDING, flipStatus, TimeLogger } = require("../../src/util");
|
|
|
|
const { tcping, ping, dnsResolve, checkCertificate, checkStatusCode, getTotalClientInRoom, setting, mqttAsync } = require("../util-server");
|
|
|
|
const { tcping, ping, dnsResolve, checkCertificate, checkStatusCode, getTotalClientInRoom, setting, mssqlQuery, mqttAsync } = require("../util-server");
|
|
|
|
const { R } = require("redbean-node");
|
|
|
|
const { R } = require("redbean-node");
|
|
|
|
const { BeanModel } = require("redbean-node/dist/bean-model");
|
|
|
|
const { BeanModel } = require("redbean-node/dist/bean-model");
|
|
|
|
const { Notification } = require("../notification");
|
|
|
|
const { Notification } = require("../notification");
|
|
|
@ -87,7 +87,9 @@ class Monitor extends BeanModel {
|
|
|
|
mqttUsername: this.mqttUsername,
|
|
|
|
mqttUsername: this.mqttUsername,
|
|
|
|
mqttPassword: this.mqttPassword,
|
|
|
|
mqttPassword: this.mqttPassword,
|
|
|
|
mqttTopic: this.mqttTopic,
|
|
|
|
mqttTopic: this.mqttTopic,
|
|
|
|
mqttSuccessMessage: this.mqttSuccessMessage
|
|
|
|
mqttSuccessMessage: this.mqttSuccessMessage,
|
|
|
|
|
|
|
|
databaseConnectionString: this.databaseConnectionString,
|
|
|
|
|
|
|
|
databaseQuery: this.databaseQuery,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
if (includeSensitiveData) {
|
|
|
|
if (includeSensitiveData) {
|
|
|
@ -447,6 +449,14 @@ class Monitor extends BeanModel {
|
|
|
|
interval: this.interval,
|
|
|
|
interval: this.interval,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
bean.status = UP;
|
|
|
|
bean.status = UP;
|
|
|
|
|
|
|
|
} else if (this.type === "sqlserver") {
|
|
|
|
|
|
|
|
let startTime = dayjs().valueOf();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await mssqlQuery(this.databaseConnectionString, this.databaseQuery);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bean.msg = "";
|
|
|
|
|
|
|
|
bean.status = UP;
|
|
|
|
|
|
|
|
bean.ping = dayjs().valueOf() - startTime;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
bean.msg = "Unknown Monitor Type";
|
|
|
|
bean.msg = "Unknown Monitor Type";
|
|
|
|
bean.status = PENDING;
|
|
|
|
bean.status = PENDING;
|
|
|
|