June 3, 2013
一、monit 配置邮件发送频率
1.1 增加心跳周期 默认为60s 改为120s,可适当在增加
set daemon 120
1.2 增加进程检测周期 将默认的:
check system 192.168.16.204
if loadavg (1min) > 6
if loadavg (5min) > 4
if memory usage > 95%
if swap usage > 95%
if cpu usage (user) > 95%
if cpu usage (system) > 95%
if cpu usage (wait) > 95%
改为如果三次(或更多)都达到警报条件则报警
check system 192.168.16.204
if loadavg (1min) > 6 for 3 cycles then alert
if loadavg (5min) > 4 for 3 cycles then alert
if memory usage > 95% for 3 cycles then alert
if swap usage > 95% for 3 cycles then alert
if cpu usage (user) > 95% for 3 cycles then alert
if cpu usage (system) > 95% for 3 cycles then alert
if cpu usage (wait) > 95% for 3 cycles then alert
二、monit发短信警报
2.1 服务器安装curl
yum install curl
查看rpm -qa|grep curl
2.2 发送短信脚本
#!/bin/bash
/usr/bin/curl -s -d api_id=XXXX -d user=XXXX -d password=**** -d to=86130******** -d "text=$*" "http://api.clickatell.com/http/sendmsg?"
配置例子:
check host localhost with address 192.168.16.204
if failed port 25 type tcp with timeout 10 seconds for 2 times within 3 cycles then exec "/opt/sendsms localhost 192.168.16.204:25 connect failed!"
当senmail 关掉后 会收到短信:localhost 192.168.16.204:25 connect failed!
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有