邮件报警脚本 vi alertscripts/sendmail.sh #!/bin/bash export LANG=en_US.UTF-8 #解决中文乱码故障 to=$1 subject=$2 echo "$3" > /tmp/zabbix_mailbody_$$ dos2unix /tmp/zabbix_mailbody_$$ #解决邮件正文变成附件形式 mail -s "$subject" "$to" < /tmp/zabbix_mailbody_$$ rm -f /tmp/zabbix_mailbody_$$
微信报警脚本 vi alertscripts/weixin.py #!/usr/bin/env python #coding:utf-8 import socket,sys if len(sys.argv) == 1: print "参数错误!" sys.exit(1) else: message = sys.argv[1] s = socket.socket(socket.AF_INET,socket.SOCK_STREAM) host = '116.62.20.104' port = 1111 try: s.connect((host,port)) s.send('0,,,,'+message) date = s.recv(1024) print date.decode('utf-8') except Exception as err: print err print "api连接错误" sys.exit(1) s.close()
告警信息:
默认接收人: 故障!!![{HOSTNAME1}]:{TRIGGER.NAME}
默认信息: 告警主机:{HOSTNAME1} 主机IP:{HOST.IP} 告警时间:{EVENT.DATE} {EVENT.TIME} 告警等级:{TRIGGER.SEVERITY} 告警信息:{TRIGGER.NAME} 告警项目:{TRIGGER.KEY1} 问题详情:{ITEM.NAME}:{ITEM.VALUE} 当前状态:{TRIGGER.STATUS}:{ITEM.VALUE1} 事件ID:{EVENT.ID}
zabbix邮件报警
https://www.cnblogs.com/chenmh/p/7253052.html