fixed uptime calculation
This commit is contained in:
parent
f43a46b20a
commit
3ca2226494
|
@ -66,15 +66,18 @@ async function checkPM2Services() {
|
|||
|
||||
// Update PM2 services status
|
||||
list.forEach(process => {
|
||||
// Calculate uptime correctly - pm_uptime is a timestamp, not a duration
|
||||
const uptimeMs = process.pm2_env.pm_uptime ?
|
||||
Date.now() - process.pm2_env.pm_uptime :
|
||||
null;
|
||||
|
||||
pm2ServicesStatus[process.name] = {
|
||||
name: process.name,
|
||||
id: process.pm_id,
|
||||
status: process.pm2_env.status,
|
||||
cpu: process.monit ? process.monit.cpu : null,
|
||||
memory: process.monit ? process.monit.memory : null,
|
||||
uptime: process.pm2_env.pm_uptime ?
|
||||
Date.now() - process.pm2_env.pm_uptime :
|
||||
null,
|
||||
uptime: uptimeMs, // Store the uptime in milliseconds
|
||||
restarts: process.pm2_env.restart_time,
|
||||
lastChecked: new Date().toISOString()
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue