Nagions记录监控日志脚本

 #!/bin/bash

while ;
do
vmr='vmstat | tail -l \
| awk '{print $1}'
if [ ${vmr} -gt 4 ]          R的阀值为4
then
date  >> /root/monitor.txt
vmstat >> /root/monitor.txt
netstat -anp >> /root/monitor.txt
ps -aux >> /root/moitor.txt
last  >> /root/monitor.txt
tail -10 /var/log/messages >> \
 /root/monitor.txt
fi
sleep 60
done
 
 
 
 
 
此脚本可放至后台运行
sh /root/moitor.sh &

你可能感兴趣的:(记录,监控)