Finding CPU usage , Disk Utilization by using mongosh or nodejs

How to Fetch MongoDB CPU usage and Disk utilization using Node.js or mongosh

Welcome to the MongoDB Community @Santosh_Salvaji !

Metrics like CPU usage and disk utilisation come from the host environment MongoDB processes are running in, so you will have to look into npm packages or external tools you can invoke.

For example:

I can’t vouch for how well these packages work, but they might be helpful starting points.

If you happen to be using MongoDB Atlas, it surfaces many available metrics via UI (including historical charts) as well as the Atlas Administration API. The Atlas control plane collects host resource metrics including CPU, disk, memory, and network utilisation as well as MongoDB metrics such as connections, replication, and operation execution time.

For more relevant suggestions on monitoring process resources via Node.js, I suggest searching or asking on StackOverflow: Newest 'node.js' Questions - Stack Overflow.

Regards,
Stennie

1 Like

Hi @Stennie_X
How to get the status of CPU usage and Disk utilisation through query/command for the cluster running on Mongodb Atlas.
I just want to make sure that CPU & Disk utilisation are under threshold before hitting Query/Command.