Skip to content

Commit 10ae335

Browse files
committed
Update monitor.js for 2.0.2
Signed-off-by: Sid Sun <sid@sidsun.com>
1 parent cee4ef0 commit 10ae335

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

server/model/monitor.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const { CookieJar } = require("tough-cookie");
2828
const { HttpsCookieAgent } = require("http-cookie-agent/http");
2929
const https = require("https");
3030
const http = require("http");
31+
const os = require("os");
3132

3233
const rootCertificates = rootCertificatesFingerprints();
3334

@@ -1330,7 +1331,7 @@ class Monitor extends BeanModel {
13301331
text = "🔴 Down";
13311332
}
13321333

1333-
let msg = `[${monitor.name}] [${text}] ${bean.msg}`;
1334+
let msg = `[${os.hostname()}] [${monitor.name}] [${text}] ${bean.msg}`;
13341335

13351336
for (let notification of notificationList) {
13361337
try {
@@ -1343,6 +1344,8 @@ class Monitor extends BeanModel {
13431344
// Prevent if the msg is undefined, notifications such as Discord cannot send out.
13441345
if (!heartbeatJSON["msg"]) {
13451346
heartbeatJSON["msg"] = "N/A";
1347+
} else {
1348+
heartbeatJSON["msg"] = `[${os.hostname()}] ${heartbeatJSON["msg"]}`;
13461349
}
13471350

13481351
// Also provide the time in server timezone
@@ -1444,7 +1447,7 @@ class Monitor extends BeanModel {
14441447
for (let notification of notificationList) {
14451448
try {
14461449
log.debug("monitor", "Sending to " + notification.name);
1447-
await Notification.send(JSON.parse(notification.config), `[${this.name}][${this.url}] ${certType} certificate ${certCN} will expire in ${daysRemaining} days`);
1450+
await Notification.send(JSON.parse(notification.config), `[${os.hostname()}] [${this.name}][${this.url}] ${certType} certificate ${certCN} will expire in ${daysRemaining} days`);
14481451
sent = true;
14491452
} catch (e) {
14501453
log.error("monitor", "Cannot send cert notification to " + notification.name);

0 commit comments

Comments
 (0)