forked from ChrisChrome/weather-bot
Add heartbeat functionality to Uptime Kuma monitoring
This commit is contained in:
parent
e70cdd972c
commit
6fada9d3fc
7
index.js
7
index.js
|
@ -433,10 +433,17 @@ xmpp.on("stanza", (stanza) => {
|
||||||
|
|
||||||
xmpp.on("online", async (address) => {
|
xmpp.on("online", async (address) => {
|
||||||
if (config["uptime-kuma"].enabled) {
|
if (config["uptime-kuma"].enabled) {
|
||||||
|
fetch(config["uptime-kuma"].url, {
|
||||||
|
method: 'POST'
|
||||||
|
}).then(() => {
|
||||||
|
console.log(`${colors.cyan("[INFO]")} Sent heartbeat to Uptime Kuma`)
|
||||||
|
})
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
// Send POST request to config["uptime-kuma"].url
|
// Send POST request to config["uptime-kuma"].url
|
||||||
fetch(config["uptime-kuma"].url, {
|
fetch(config["uptime-kuma"].url, {
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
|
}).then(() => {
|
||||||
|
console.log(`${colors.cyan("[INFO]")} Sent heartbeat to Uptime Kuma`)
|
||||||
})
|
})
|
||||||
}, config["uptime-kuma"].interval * 1000) // Every X seconds
|
}, config["uptime-kuma"].interval * 1000) // Every X seconds
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue