v1.2.8 Heartbeat Monitoring #6
@ -5,5 +5,4 @@ WORKDIR /usr/src/app
|
|||||||
COPY package.json ./
|
COPY package.json ./
|
||||||
RUN npm install
|
RUN npm install
|
||||||
COPY . .
|
COPY . .
|
||||||
# CMD ["/bin/sh", "-c", "node main.js 2> /logs/silvanus.err 1> /logs/silvanus.log"]
|
CMD ["/bin/sh", "-c", "node main.js 2>&1 > /logs/$(date +%Y-%m-%d_%H-%M-%S).txt"]
|
||||||
CMD ["/bin/sh", "-c", "node main.js 2> /logs/error/$(date +%Y-%m-%d_%H-%M-%S).txt 1> /logs/status/$(date +%Y-%m-%d_%H-%M-%S).txt"]
|
|
||||||
|
2
main.js
2
main.js
@ -52,6 +52,8 @@ client.once('ready', async () => {
|
|||||||
fn.sendHeartbeat(heartbeatUrl);
|
fn.sendHeartbeat(heartbeatUrl);
|
||||||
}, 30000);
|
}, 30000);
|
||||||
if (isDev) console.log("Heartbeat interval set.");
|
if (isDev) console.log("Heartbeat interval set.");
|
||||||
|
} else {
|
||||||
|
if (isDev) console.log("No heartbeat URL set, will not send heartbeats for uptime monitoring.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1146,11 +1146,13 @@ const functions = {
|
|||||||
},
|
},
|
||||||
async sendHeartbeat(url) {
|
async sendHeartbeat(url) {
|
||||||
https.get(url, async (response) => {
|
https.get(url, async (response) => {
|
||||||
|
if (isDev) console.log("Sent Heartbeat Request: " + url);
|
||||||
let data = '';
|
let data = '';
|
||||||
|
|
||||||
response.on('data', (chunk) => data += chunk);
|
response.on('data', (chunk) => data += chunk);
|
||||||
|
|
||||||
response.on('end', () => {
|
response.on('end', () => {
|
||||||
|
if (isDev) console.log("Received Heartbeat Response: " + data);
|
||||||
parsedData = JSON.parse(data);
|
parsedData = JSON.parse(data);
|
||||||
if ( !(parsedData.ok) ) console.error("Heartbeat failed");
|
if ( !(parsedData.ok) ) console.error("Heartbeat failed");
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user