标签:告警 spl ring abc name 内存 事件 you 很多
#!/bin/env python #coding:utf-8 import smtplib from email.mime.text import MIMEText from sys import argv mailto_list=[] mail_host="hwsmtp.qiye.163.com" #邮箱服务器地址 mail_user="邮箱地址" mail_pass="邮箱密码" debug_level=0 def send_mail(to_list,sub,content): me=mail_user msg = MIMEText(content,_subtype=‘plain‘,_charset=‘utf-8‘) msg[‘Subject‘] = sub msg[‘From‘] = me msg[‘To‘] = ";".join(to_list) try: server = smtplib.SMTP() server.set_debuglevel(debug_level) server.connect(mail_host) server.login(mail_user,mail_pass) server.sendmail(me,to_list,msg.as_string()) server.close() return True except Exception, e: print str(e) return False if __name__ == ‘__main__‘: try: mailto_list=argv[1].split(‘;‘) sub=argv[2] content=argv[3] except: print "python send_mail.py ‘user1@xx.com;user2@xx.com‘ sub content" exit() if send_mail(mailto_list,sub,content): print "发送成功" else: print "发送失败"
{ALERT.SENDTO}
{ALERT.SUBJECT}
{ALERT.MESSAGE}
故障{TRIGGER.STATUS},服务器:{HOSTNAME1}发生:{TRIGGER.NAME}故障!
告警主机:{HOSTNAME1}
告警时间:{EVENT.DATE} {EVENT.TIME}
告警等级:{TRIGGER.SEVERITY}
告警信息: {TRIGGER.NAME}
告警项目:{TRIGGER.KEY1}
问题详情:{ITEM.NAME}:{ITEM.VALUE}
当前状态:{TRIGGER.STATUS}:{ITEM.VALUE1}
事件ID:{EVENT.ID}
恢复{TRIGGER.STATUS},服务器:{HOSTNAME1}: {TRIGGER.NAME}已恢复!
告警主机:{HOSTNAME1}
恢复时间:{EVENT.RECOVERY.DATE} {EVENT.RECOVERY.TIME}
#这里注意了,很多教程都是复制故障通知消息,这里时间需要设置为EVENT.RECOVERY.DATE 才会发送正确的故障恢复时间,否则会发送故障发生时的时间。
告警时间:{EVENT.DATE} {EVENT.TIME}
告警等级:{TRIGGER.SEVERITY}
告警信息: {TRIGGER.NAME}
告警项目:{TRIGGER.KEY1}
问题详情:{ITEM.NAME}:{ITEM.VALUE}
当前状态:{TRIGGER.STATUS}:{ITEM.VALUE1}
事件ID:{EVENT.ID}
标签:告警 spl ring abc name 内存 事件 you 很多
原文地址:https://www.cnblogs.com/xuewenlong/p/12881865.html