内存使用率统计:
free -k | sed -n '3p' | awk '{print "actually used mem is "$3"KB, total mem is "($3+$4)"KB, used percent is "$3/($3+$4)*100"%"}'
CPU使用率统计:
sar 3 5 | grep Average | awk '{print "The CPU idle percent is "$8"%, The CPU used percent is "(100-$8)"%"}'
测试:
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29734436/viewspace-2148741/
,如需转载,请注明出处,否则将追究法律责任。