|
|
|
@ -7,7 +7,7 @@ dayjs.extend(timezone);
|
|
|
|
|
const axios = require("axios");
|
|
|
|
|
const { Prometheus } = require("../prometheus");
|
|
|
|
|
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 { BeanModel } = require("redbean-node/dist/bean-model");
|
|
|
|
|
const { Notification } = require("../notification");
|
|
|
|
@ -87,7 +87,9 @@ class Monitor extends BeanModel {
|
|
|
|
|
mqttUsername: this.mqttUsername,
|
|
|
|
|
mqttPassword: this.mqttPassword,
|
|
|
|
|
mqttTopic: this.mqttTopic,
|
|
|
|
|
mqttSuccessMessage: this.mqttSuccessMessage
|
|
|
|
|
mqttSuccessMessage: this.mqttSuccessMessage,
|
|
|
|
|
databaseConnectionString: this.databaseConnectionString,
|
|
|
|
|
databaseQuery: this.databaseQuery,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (includeSensitiveData) {
|
|
|
|
@ -447,6 +449,14 @@ class Monitor extends BeanModel {
|
|
|
|
|
interval: this.interval,
|
|
|
|
|
});
|
|
|
|
|
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 {
|
|
|
|
|
bean.msg = "Unknown Monitor Type";
|
|
|
|
|
bean.status = PENDING;
|
|
|
|
|