Adding ram and cpu stats commands for freebsd
parent
4253ae8c4d
commit
33a9152b17
|
@ -7536,6 +7536,9 @@ s.cpuUsage=function(e){
|
||||||
case'linux':
|
case'linux':
|
||||||
k.cmd='LANG=C top -b -n 2 | grep "^'+config.cpuUsageMarker+'" | awk \'{print $2}\' | tail -n1';
|
k.cmd='LANG=C top -b -n 2 | grep "^'+config.cpuUsageMarker+'" | awk \'{print $2}\' | tail -n1';
|
||||||
break;
|
break;
|
||||||
|
case'freebsd':
|
||||||
|
k.cmd='vmstat 1 2 | tail -1 | awk \'{print $17}\''
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if(config.customCpuCommand){
|
if(config.customCpuCommand){
|
||||||
exec(config.customCpuCommand,{encoding:'utf8',detached: true},function(err,d){
|
exec(config.customCpuCommand,{encoding:'utf8',detached: true},function(err,d){
|
||||||
|
@ -7564,6 +7567,9 @@ s.ramUsage=function(e){
|
||||||
case'darwin':
|
case'darwin':
|
||||||
k.cmd = "vm_stat | awk '/^Pages free: /{f=substr($3,1,length($3)-1)} /^Pages active: /{a=substr($3,1,length($3-1))} /^Pages inactive: /{i=substr($3,1,length($3-1))} /^Pages speculative: /{s=substr($3,1,length($3-1))} /^Pages wired down: /{w=substr($4,1,length($4-1))} /^Pages occupied by compressor: /{c=substr($5,1,length($5-1)); print ((a+w)/(f+a+i+w+s+c))*100;}'"
|
k.cmd = "vm_stat | awk '/^Pages free: /{f=substr($3,1,length($3)-1)} /^Pages active: /{a=substr($3,1,length($3-1))} /^Pages inactive: /{i=substr($3,1,length($3-1))} /^Pages speculative: /{s=substr($3,1,length($3-1))} /^Pages wired down: /{w=substr($4,1,length($4-1))} /^Pages occupied by compressor: /{c=substr($5,1,length($5-1)); print ((a+w)/(f+a+i+w+s+c))*100;}'"
|
||||||
break;
|
break;
|
||||||
|
case'freebsd':
|
||||||
|
k.cmd = "echo \"scale=4; $(vmstat -H | tail -1 | awk '{print $5}')*1024*100/$(sysctl hw.physmem | awk '{print $2}')\" | bc"
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
k.cmd = "LANG=C free | grep Mem | awk '{print $4/$2 * 100.0}'";
|
k.cmd = "LANG=C free | grep Mem | awk '{print $4/$2 * 100.0}'";
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue