|
|
|
@ -2,23 +2,13 @@ const { MonitorType } = require("./monitor-type");
|
|
|
|
|
const { UP } = require("../../src/util");
|
|
|
|
|
const childProcessAsync = require("promisify-child-process");
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A TailscalePing class extends the MonitorType.
|
|
|
|
|
* It runs Tailscale ping to monitor the status of a specific node.
|
|
|
|
|
*/
|
|
|
|
|
class TailscalePing extends MonitorType {
|
|
|
|
|
|
|
|
|
|
export class TailscalePing extends MonitorType {
|
|
|
|
|
name = "tailscale-ping";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks the ping status of the URL associated with the monitor.
|
|
|
|
|
* 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
|
|
|
|
|
* @inheritdoc
|
|
|
|
|
*/
|
|
|
|
|
async check(monitor, heartbeat) {
|
|
|
|
|
async check(monitor, heartbeat, _server) {
|
|
|
|
|
try {
|
|
|
|
|
let tailscaleOutput = await this.runTailscalePing(monitor.hostname, monitor.interval);
|
|
|
|
|
this.parseTailscaleOutput(tailscaleOutput, heartbeat);
|
|
|
|
@ -81,7 +71,3 @@ class TailscalePing extends MonitorType {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
|
TailscalePing,
|
|
|
|
|
};
|
|
|
|
|