zabbix实现163邮件报警

Zabbix 邮件报警

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

server端安装配置邮件服务器

[root@server ~]# yum -y install mailx dos2unix

[root@server ~]# mailx -V

12.5 7/5/10

[root@server ~]# vim /etc/mail.rc

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

set [email protected]

set smtp-auth-password=zc1741845455

set smtp-auth=login

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

然后163邮箱就会收到信息

编辑zabbix_server.conf引用邮件脚本

[root@server alertscripts]# vim /usr/local/zabbix/etc/zabbix_server.conf

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

[root@server alertscripts]# cd

[root@server ~]#

[root@server ~]#

[root@server ~]#

[root@server ~]# cd /usr/local/zabbix/share/zabbix/alertscripts/

[root@server 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

[root@server alertscripts]# chmod 777 mail.sh

[root@server alertscripts]# chown zabbix:zabbix mail.sh

[root@server alertscripts]# touch /tmp/mailtmp.txt

[root@server alertscripts]# chmod 777 /tmp/mailtmp.txt

[root@server alertscripts]# chown zabbix:zabbix /tmp/mailtmp.txt

[root@server 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