-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.js.dist
35 lines (31 loc) · 999 Bytes
/
config.js.dist
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
const urlWebserver = "https://myserver.com";
module.exports = {
notifiers: {
pushover: {
type: 'pushover',
token: 'xxx',
user: 'xxx'
}
},
checks: [
{
name: "Ping web server",
every: { rule: "*/10 * * * * *"},
execute: async (axios, context, notify) => {
const lastContext = context.get();
let online;
try {
await axios.get(urlWebserver);
online = true;
} catch(e) {
online = false;
}
const alert = (lastContext && lastContext.online != online) || (!lastContext && !online);
if (alert) {
await notify('*', `${online ? "End alert" : "Start alert"} Web server`, `Webserver is ${online ? "online" : "offline"}`);
}
return { online };
}
}
]
}