linux下监控cpu、memo、io、swap性能数据

直接贴脚本:
1、cpu
#!/bin/bash
CurrentDate=`date -d today '+%Y%m%d'`
CurrentTime=`date -d today '+%Y%m%d%H%M'`
mytext="$CurrentTime\t`top -b -n 1 | grep Cpu\(s\)`"
echo -e $mytext >> /home/www/monitor/log/cpu$CurrentDate.log
2、memo
#!/bin/bash
CurrentDate=`date -d today '+%Y%m%d'`
CurrentTime=`date -d today '+%Y%m%d%H%M'`
mytext="$CurrentTime\t`top -b -n 1 | grep Mem:`"
echo -e $mytext >> /home/www/monitor/log/memo$CurrentDate.log
3、io
#!/bin/bash
CurrentDate=`date -d today '+%Y%m%d'`
CurrentTime=`date -d today '+%Y%m%d%H%M'`
mytext="$CurrentTime\t`iostat -p sda | grep -w sda`"
echo -e $mytext >> /home/www/monitor/log/io$CurrentDate.log
4、swap
#!/bin/bash
CurrentDate=`date -d today '+%Y%m%d'`
CurrentTime=`date -d today '+%Y%m%d%H%M'`
mytext="$CurrentTime\t`top -b -n 1 | grep Swap:`"
echo -e $mytext >> /home/www/monitor/log/swap$CurrentDate.log

相关文章:

  • 2022-01-16
  • 2021-12-24
  • 2022-12-23
  • 2022-12-23
  • 2021-11-23
  • 2021-08-16
  • 2021-12-28
  • 2022-12-23
猜你喜欢
  • 2021-12-21
  • 2021-09-29
  • 2021-12-26
  • 2021-10-09
相关资源
相似解决方案