一、free
1、安装绘图工具
sudo apt-get install python-matplotlib
2、开启dump采集系统监控数据
./dump.sh &
3、数据导入图形界面
python plot.py
dump.sh
#!/bin/bash i=0; while true do i=`expr $i + 1`; time=$(date "+%Y-%m-%d %H:%M:%S") free | sed -n '2p;2q' | sed -e "s/Mem:/$time/g" >> mem.log free | sed -n '2p;2q' | sed -e "s/Mem:/$i/g" >> mem1.log sleep 1 done
plot.py
import matplotlib.pyplot as plt import numpy as np data = np.loadtxt('mem1.log') plt.plot(data[:,0],data[:,3]) plt.show()
二、top
三、cat /proc/pid/status