zabbix实现163邮件报警

Zabbix 邮件报警

电脑登录网易邮箱配置,把自己的授权码看一下,并写入配置文件

server端安装配置邮件服务器

[[email protected] ~]# yum -y install mailx dos2unix

[[email protected] ~]# mailx -V

12.5 7/5/10

[[email protected] ~]# vim /etc/mail.rc

set [email protected] smtp=smtp.163.com

set [email protected]

set smtp-auth-password=zc1741845455

set smtp-auth=login

[[email protected] ~]# echo "test mail from zabbix.server.com" |mail -s "test mail" [email protected]

 

然后163邮箱就会收到信息

 

 

编辑zabbix_server.conf引用邮件脚本

[[email protected] alertscripts]# vim /usr/local/zabbix/etc/zabbix_server.conf

AlerScriptsPath=/usr/local/zabbix/share/zabbix/alertscripts

[[email protected] alertscripts]# cd

[[email protected] ~]#

[[email protected] ~]#

[[email protected] ~]#

[[email protected] ~]# cd /usr/local/zabbix/share/zabbix/alertscripts/

[[email protected] alertscripts]# vim mail.sh

#!/bin/bash

#export.UTF-8

bt=$2

sjr=$1

FILE=/tmp/mailtmp.txt

echo "$3" >$FILE

/usr/bin/dos2unix -k $FILE

/bin/mail -s "$bt" "$sjr" <$FILE

 

[[email protected] alertscripts]# chmod 777 mail.sh

[[email protected] alertscripts]# chown zabbix:zabbix mail.sh

[[email protected] alertscripts]# touch /tmp/mailtmp.txt

[[email protected] alertscripts]# chmod 777 /tmp/mailtmp.txt

[[email protected] alertscripts]# chown zabbix:zabbix /tmp/mailtmp.txt

[[email protected] alertscripts]# ./mail.sh [email protected] "test mail2" "test mail from server.zabbix.com test2"

dos2unix: converting file /tmp/mailtmp.txt to Unix format ...

配置zabbix web 监控项邮件报警

 

{ALERT.SENDTO}

{ALERT.SUBJECT}

{ALERT.MESSAGE}

猜你喜欢

转载自www.cnblogs.com/zc1741845455/p/10884697.html
0条评论
添加一条新回复
  
今日推荐