首页 > 代码库 > 监控系统子脚本
监控系统子脚本
一、监控系统负载
[root@localhost ~]# vim mon/shares/load.sh
#!/bin/bashload=`uptime |awk -F ‘average:‘ ‘{print $2}‘|cut -d‘,‘ -f1|sed ‘s/ //g‘ |cut -d. -f1`if [ $load -gt 20 ] && [ $send -eq "1" ]then echo "$addr `date +%T` load is $load" >../log/load.tmp /bin/bash ../mail/mail.sh $addr\_load $load ../log/load.tmpfiecho "`date +%T` load is $load"
二、监控 502
[root@localhost ~]# vim mon/shares/502.sh#!/bin/bashd=`date -d "-1 min" +%H:%M`c_502=`grep :$d: $log |grep ‘ 502 ‘|wc -l`if [ $c_502 -gt 10 ] && [ $send == 1 ]; then echo "$addr $d 502 count is $c_502">../log/502.tmp /bin/bash ../mail/mail.sh $addr\_502 $c_502 ../log/502.tmpfiecho "`date +%T` 502 $c_502"
三、监控磁盘
[root@locahost ~]# vim mon/shares/disk.sh
#! /bin/bashrm -f ../log/disk.tmpfor r in `df -h |awk -F ‘[ %]+‘ ‘{print $5}‘|grep -v Use`do if [ $r -gt 90 ] && [ $send -eq "1" ]then echo "$addr `date +%T` disk useage is $r" >>../log/disk.tmpfiif [ -f ../log/disk.tmp ]then df -h >> ../log/disk.tmp /bin/bash ../mail/mail.sh $addr\_disk $r ../log/disk.tmp echo "`date +%T` disk useage is nook"else echo "`date +%T` disk useage is ok"fi
监控系统子脚本
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。