node-os-utils
node-os-utils copied to clipboard
CPU Utilization not properly reported in K8s env
My application is containerized and runs in a K8S pod, here is the snippet:
var osu = require('node-os-utils')
var cpu = osu.cpu
let cpuUtilization: number = -1;
setInterval(async function () {
cpu.usage()
.then((cpuPercentage: number) => {
cpuUtilization = cpuPercentage;
logger.info(`Updating cpu utilization to cpuUtil=${cpuUtilization}`);
});
}, 10 * 1000); // invoke every 10 seconds
Unfortunately, the library doesn't return correct value for POD utilization, the values never go over 35%, whereas on grafana dashboard Pods CPU utilization is reported to reach 100% with the CPU throttling taking place.
Is this a known issue?
@imochurad have you made any progress since your post?