|
|
@ -2,23 +2,13 @@ const { MonitorType } = require("./monitor-type");
|
|
|
|
const { UP } = require("../../src/util");
|
|
|
|
const { UP } = require("../../src/util");
|
|
|
|
const childProcessAsync = require("promisify-child-process");
|
|
|
|
const childProcessAsync = require("promisify-child-process");
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
export class TailscalePing extends MonitorType {
|
|
|
|
* A TailscalePing class extends the MonitorType.
|
|
|
|
|
|
|
|
* It runs Tailscale ping to monitor the status of a specific node.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
class TailscalePing extends MonitorType {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
name = "tailscale-ping";
|
|
|
|
name = "tailscale-ping";
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Checks the ping status of the URL associated with the monitor.
|
|
|
|
* @inheritdoc
|
|
|
|
* It then parses the Tailscale ping command output to update the heatrbeat.
|
|
|
|
|
|
|
|
* @param {object} monitor The monitor object associated with the check.
|
|
|
|
|
|
|
|
* @param {object} heartbeat The heartbeat object to update.
|
|
|
|
|
|
|
|
* @returns {Promise<void>}
|
|
|
|
|
|
|
|
* @throws Error if checking Tailscale ping encounters any error
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
async check(monitor, heartbeat) {
|
|
|
|
async check(monitor, heartbeat, _server) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
let tailscaleOutput = await this.runTailscalePing(monitor.hostname, monitor.interval);
|
|
|
|
let tailscaleOutput = await this.runTailscalePing(monitor.hostname, monitor.interval);
|
|
|
|
this.parseTailscaleOutput(tailscaleOutput, heartbeat);
|
|
|
|
this.parseTailscaleOutput(tailscaleOutput, heartbeat);
|
|
|
@ -81,7 +71,3 @@ class TailscalePing extends MonitorType {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
|
|
|
|
TailscalePing,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|