Improve Linux CPU usage monitoring. Add support for Busybox based distros. Tested on Ubuntu, CentOS and Alpine Linux.
Required as part of ongoing work to officially support Alpine Linuxpushover
parent
5f0ed0a486
commit
5a3bf96845
|
@ -16,7 +16,7 @@ module.exports = function(s,config,lang,io){
|
|||
k.cmd="ps -A -o %cpu | awk '{s+=$1} END {print s}'";
|
||||
break;
|
||||
case'linux':
|
||||
k.cmd='LANG=C top -b -n 2 | grep "^'+config.cpuUsageMarker+'" | awk \'{print $2}\' | tail -n1';
|
||||
k.cmd='top -b -n 2 | awk \'{IGNORECASE = 1} /^.?CPU/ {gsub("id,","100",$8); gsub("%","",$8); print 100-$8}\' | tail -n 1';
|
||||
break;
|
||||
case'freebsd':
|
||||
k.cmd='vmstat 1 2 | awk \'END{print 100-$19}\''
|
||||
|
|
Loading…
Reference in New Issue