天兔(Lepus)监控邮件推送安装配置

好吧,我承认官网的邮件配置教程我又没看懂,这里记录下我的配置方法

[root@HE3]# vi /usr/local/lepus/test_send_mail.py

#!/usr/bin/envpython
# -*- coding: utf8-*-
from datetime import*
import sys
path='./include'
sys.path.insert(0,path)
import functions asfunc
 
#mail_to_list = func.get_option('mail_to_list')
send_mail_to_list =func.get_option('send_mail_to_list')
mailto_list=send_mail_to_list.split(';')
 
result =func.send_mail(mailto_list," I hope you can learn","BeautifulDay")
print result
if result:
    send_mail_status = "success"
else:
    send_mail_status = "fail"
print"send_mail_status:"+send_mail_status

注释掉原有的mail_to_list,添加一行send_mail_to_list =func.get_option('send_mail_to_list')

原有的mailto_list=mail_to_list.split(';')改为mailto_list=send_mail_to_list.split(';')


 去申请一个新的126邮箱,选择设置-POP3/SMTP/IMAP-客户端授权密码

wKioL1d2OR_SIGhVAAE0Z7_3vVY857.jpg-wh_50


wKiom1d2OR-AtuGWAAC2NIRwTTg090.jpg-wh_50

1处填写你刚刚申请的126邮箱账号

2处填写你刚刚开启的客户端授权密码

3处填写你的126邮箱地址


[root@HE3]# python test_send_mail.py
True
send_mail_status:success

编译通过


wKiom1d2OR-RKwyaAACVFbkAgaI203.jpg-wh_50

OK,turn on your lepus alert button!~  适当调低报警阈值,不出10s,你的收件箱应该就收到告警邮件了~

wKioL1d2OnuSANOCAABh2ZpXjPk805.jpg-wh_50








------------------------------慢查询推送配置-------------------------

[root@HE3 lepus]# yum install links
[root@HE3 lepus]# links http://mysqlmtop1.ikongjian.com/index.php/task/send_mysql_slowquery_mail


执行上述命令进行测试,这里的web的页面是你自己的监控页面地址请勿直接复制

wKioL1g_7yDAWssEAAVn8Ij0Jmw352.jpg

然后将该命令加入执行计划即可

00 08 * * * links http://mysqlmtop1.ikongjian.com/index.php/task/send_mysql_slowquery_mail  > /dev/null 2>&1


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值