来自 技术 2019-04-17 00:00 的文章

monit设置邮件频率和短信警报

八年Java开发的感悟:什么才是程序员的立身之本>>>   

monit设置邮件频率和短信警报

June 3, 2013

一、monit 配置邮件发送频率

1.1 增加心跳周期 默认为60s 改为120s,可适当在增加

set daemon 120

1.2 增加进程检测周期 将默认的:

check system 192.168.16.204if 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.204if loadavg (1min) > 6 for 3 cycles then alertif loadavg (5min) > 4 for 3 cycles then alertif memory usage > 95% for 3 cycles then alertif swap usage > 95% for 3 cycles then alertif cpu usage (user) > 95% for 3 cycles then alertif cpu usage (system) > 95% for 3 cycles then alertif 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.204if 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!

添加新评论

称呼

邮箱

网站

提交评论

搜索

最新文章 使用dnspod api更改域名解析 再见2017! 基本ab命令的cc攻击shell脚本 使用PROXY protocol获取客户IP linux下手动产生kernel panic 用shell脚本反查搜索引擎蜘蛛IP nginx动态添加访问白名单 使用ssl加密Nginx与uptream servers之间的流量 使用saltstack初始化系统 linux下配置和安装KVM虚拟机 最近回复 Nginx内置模块简介 R11; 前端开发,JQUERY特效,全栈开发,vue开发: [...]参考: n... OpenVPN推送默认路由表 R11; B&W: [...]https... Nginx内置模块简介 R11; AWebMan: [...]参考: n... willis: No route t... william: autossh -M... william: 最后在内网主机上使用... yixiu: 有趣。哈哈 willis: 测试可以正常使用 Ketop: tmux为什么执行了... Ubuntu利用Django框架快速搭建网站 R11; x: [...]使用命令安... 分类 生活(7) 网络安全(9) linux(111) Windows(5) 归档 January 2018 December 2017 August 2017 June 2017 March 2017 January 2017 December 2016 November 2016 October 2016 August 2016 May 2016 March 2016 February 2016 January 2016 December 2015 November 2015 October 2015 September 2015 August 2015 July 2015 May 2015 April 2015 March 2015 January 2015 December 2014 October 2014 September 2014 August 2014 July 2014 June 2014 May 2014 September 2013 August 2013 July 2013 June 2013 May 2013 其它 登录 文章 RSS 评论 RSS Typecho