Zabbix邮箱告警关键配置

技术
【1】
root@longof:~# cat /etc/mail.rc
# This is the configuration file for Heirloom mailx (formerly
# known under the name “nail”.
# See mailx(1) for further options.
# This file is not overwritten when ‘make install’ is run in
# the mailx build process again.
set from=邮箱账号@163.com smtp=smtp.163.com
set smtp-auth-user=邮箱账号@163.com  smtp-auth-password=邮箱密码
set smtp-auth=login
……
【2】
root@longof:~# whereis zabbix
zabbix: /etc/zabbix /usr/share/zabbix
【3】
root@longof:~# cat /etc/zabbix/zabbix_server.conf | grep alertscripts
# AlertScriptsPath=${datadir}/zabbix/alertscripts
AlertScriptsPath=/usr/share/zabbix/alertscripts
【4】
root@longof:~# cat /usr/share/zabbix/alertscripts/sendmail.sh
#!/bin/bash
export LANG=zh_CN.UTF-8
FILE=/tmp/mailtmp.txt
echo “$3” >$FILE
dos2unix -k $FILE
mail -s “$2” $1 < $FILE
export LANG=zh_CN.UTF-8

 

发表回复