vineri, 8 iulie 2016

Linux: Display the usage of processors and memory without provisioning values (the real usage)

Procs (two alternatives):

top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1"%"}'

grep 'cpu ' /proc/stat | awk '{usage=($2+$4)*100/($2+$4+$5)} END {print usage "%"}'


Memory:
 
ps aux | awk '{sum+=$6} END {print sum / 1024}'

Niciun comentariu:

Trimiteți un comentariu