zabbix利用mutt和msmtp配置邮件报警
- Mutt安装
yum –y install mutt
- msmtp安装
yum –y install openssl openssl-devel libntlm libntlm-devel cyrus-sasl-ntlm
cd /root/msmtp-1.6.3
./configure --prefix=/usr/local/msmtp --with-tls=openssl
make && make install
- Mutt配置
vim /etc/Muttrc
set sendmail="/usr/local//msmtp/bin/msmtp"
set from="zabbix@uce.cn"
- msmtp配置
mkdir /usr/local//msmtp/etc
vim /usr/local/msmtp/etc/msmtpc
account default
host smtp.uce.cn
port 25
from zabbix@uce.cn
auth login
tls off
user zabbix@uce.cn
password xxxxx@it.mo
logfile /var/log/msmtp.log
touch /var/log/msmtp.log
chown zabbix.zabbix /var/log/msmtp.log
msmtp测试
echo "zabbix test" | mutt -s "test" limugen@uce.cn
- 邮件报警脚本
vim /usr/local/zabbix/alertscripts/msmtp.sh
#!/bin/bash
echo "$3" | mutt -s "$2" "$1"
chmod 755 /usr/local/zabbix/alertscripts/msmtp.sh