Unitech / Unitech/pm2

Monitoring : Cpu usage stuck at 0% even if real cpu usage is at ~30%-40%

Open
#4,838 10 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
43.3k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

What's going wrong?

After updating to last pm2 version command pm2 ls display cpu at 0% usage but command pm2 monit display real cpu usage for ~30-40%

I use pm2-metrics which collect the 0% cpu from pm2 ls apparently.

How could we reproduce this issue?

Good question i dont know, for me it happened after updating pm2 to last version.

Supporting information

image
image

--- PM2 report ----------------------------------------------------------------
Date                 : Thu Sep 03 2020 15:10:43 GMT+0200 (UTC+02:00)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version         : 4.4.1
node version         : 14.4.0
node path            : /home/ouraios/.npm-packages/bin/pm2
argv                 : /usr/bin/node,/home/ouraios/.npm-packages/lib64/node_modules/pm2/lib/Daemon.js
argv0                : node
user                 : ouraios
uid                  : 1001
gid                  : 100
uptime               : 12min
===============================================================================
--- CLI ----------------------------------------------------
local pm2            : 4.4.1
node version         : 14.4.0
node path            : /home/ouraios/.npm-packages/bin/pm2
argv                 : /usr/bin/node,/home/ouraios/.npm-packages/bin/pm2,report
argv0                : node
user                 : ouraios
uid                  : 1001
gid                  : 100
===============================================================================
--- System info --------------------------------------------
arch                 : x64
platform             : linux
type                 : Linux
cpus                 : Intel(R) Xeon(R) E-2136 CPU @ 3.30GHz
cpus nb              : 8
freemem              : 27916460032
totalmem             : 42949672960
home                 : /home/ouraios
===============================================================================
--- PM2 list -----------------------------------------------
┌─────┬────────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id  │ name           │ namespace   │ version │ mode    │ pid      │ uptime │ ↺    │ status    │ cpu      │ mem      │ user     │ watching │
├─────┼────────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 1   │ API_PROD       │ default     │ 0.0.0   │ cluster │ 19615    │ 59s    │ 1    │ online    │ 47%      │ 287.6mb  │ ouraios  │ disabled │
│ 4   │ API_PROD       │ default     │ 0.0.0   │ cluster │ 19650    │ 57s    │ 1    │ online    │ 59.8%    │ 377.3mb  │ ouraios  │ disabled │
└─────┴────────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
Module
┌────┬───────────────────────────────────────┬────────────────────┬───────┬──────────┬──────┬──────────┬──────────┬──────────┐
│ id │ module                                │ version            │ pid   │ status   │ ↺    │ cpu      │ mem      │ user     │
├────┼───────────────────────────────────────┼────────────────────┼───────┼──────────┼──────┼──────────┼──────────┼──────────┤
│ 5  │ pm2-metrics                           │ 1.0.38             │ 16739 │ online   │ 0    │ 0%       │ 60.0mb   │ ouraios │
└────┴───────────────────────────────────────┴────────────────────┴───────┴──────────┴──────┴──────────┴──────────┴──────────┘
===============================================================================
--- Daemon logs --------------------------------------------
/home/ouraios/.pm2/pm2.log last 20 lines:
PM2        | 2020-09-03T14:57:55: PM2 log: App [API_PROD:1] starting in -cluster mode-
PM2        | 2020-09-03T14:57:55: PM2 log: App [API_PROD:1] onlinee-
PM2        | 2020-09-03T14:57:55: PM2 log: App [API_PROD:4] starting in -cluster mode-
PM2        | 2020-09-03T14:57:55: PM2 log: App [API_PROD:4] online
PM2        | 2020-09-03T14:57:55: PM2 log: App [pm2-metrics:5] starting in -fork mode-
PM2        | 2020-09-03T14:57:55: PM2 log: App [pm2-metrics:5] online
PM2        | 2020-09-03T15:09:44: PM2 log: App [API_PROD:1] starting in -cluster mode-
PM2        | 2020-09-03T15:09:44: PM2 log: App [API_PROD:1] online
PM2        | 2020-09-03T15:09:46: PM2 log: -reload- New worker listening
PM2        | 2020-09-03T15:09:46: PM2 log: Stopping app:API_PROD id:_old_1
PM2        | 2020-09-03T15:09:46: PM2 log: App name:API_PROD id:_old_1 disconnected
PM2        | 2020-09-03T15:09:46: PM2 log: App [API_PROD:_old_1] exited with code [0] via signal [SIGINT]
PM2        | 2020-09-03T15:09:46: PM2 log: pid=16610 msg=process killed
PM2        | 2020-09-03T15:09:46: PM2 log: App [API_PROD:4] starting in -cluster mode-
PM2        | 2020-09-03T15:09:46: PM2 log: App [API_PROD:4] online
PM2        | 2020-09-03T15:09:47: PM2 log: -reload- New worker listening
PM2        | 2020-09-03T15:09:47: PM2 log: Stopping app:API_PROD id:_old_4
PM2        | 2020-09-03T15:09:47: PM2 log: App name:API_PROD id:_old_4 disconnected
PM2        | 2020-09-03T15:09:47: PM2 log: App [API_PROD:_old_4] exited with code [0] via signal [SIGINT]
PM2        | 2020-09-03T15:09:48: PM2 log: pid=16643 msg=process killed

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the CPU values shown by pm2 ls, pm2 monit, and the pm2-metrics exporter, using the supplied PM2 report and the update to version 4.4.1 as context. Trace how each command obtains CPU usage; done means the reported values agree with the real process usage and the regression has coverage, although no source file or test is named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli, observability
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.