mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-07-24 07:21:09 -04:00
Merge pull request #2541 from long2ice/master
feat: support redis monitor
This commit is contained in:
commit
6437ef198f
5 changed files with 198 additions and 2 deletions
|
@ -19,6 +19,7 @@ const { Settings } = require("./settings");
|
|||
const grpc = require("@grpc/grpc-js");
|
||||
const protojs = require("protobufjs");
|
||||
const radiusClient = require("node-radius-client");
|
||||
const redis = require("redis");
|
||||
const {
|
||||
dictionaries: {
|
||||
rfc2865: { file, attributes },
|
||||
|
@ -354,6 +355,30 @@ exports.radius = function (
|
|||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Redis server ping
|
||||
* @param {string} dsn The redis connection string
|
||||
*/
|
||||
exports.redisPingAsync = function (dsn) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const client = redis.createClient({
|
||||
url: dsn,
|
||||
});
|
||||
client.on("error", (err) => {
|
||||
reject(err);
|
||||
});
|
||||
client.connect().then(() => {
|
||||
client.ping().then((res, err) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
resolve(res);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieve value of setting based on key
|
||||
* @param {string} key Key of setting to retrieve
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue