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 Linux
pushover
Jordan Geoghegan 2020-01-21 08:09:04 +00:00
parent 5f0ed0a486
commit 5a3bf96845
1 changed files with 1 additions and 1 deletions

View File

@ -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}\''