标签:
1,安装msmtp
wget http://downloads.sourceforge.net/msmtp/msmtp-1.4.30.tar.bz2
tar jxvf msmtp-1.4.30.tar.bz2
./configure --prefix=/usr/local/msmtp
make
make install
2,msmtprc配置
mkdir /usr/local/msmtp/etc
cat /usr/local/msmtp/etc/msmtprc
defaults
account zabbix
host smtp.exmail.qq.com
user bi_alert@juanpi.com
password 123456
port 25
auth login
tls off
logfile /tmp/msmtp.log
account default: zabbix
chmod 600 /usr/local/msmtp/etc/msmtprc
3,测试
/usr/local/msmtp/bin/msmtp bi_alert@juanpi.com
输入内容
按ctrl+D发出
4, 安装mutt
yum install mutt*
cat /etc/Muttrc
set from="bi_develop@juanpi.com"
set sendmail="/usr/local/msmtp/bin/msmtp"
set use_from=yes
set realname="bi_develop@juanpi.com"
set copy=no
set editor="vim"
set send_charset="UTF-8"
测试一下:echo "邮件报警测试" | mutt -s "测试" bi_alert@juanpi.com
5, 报警脚本
vim /usr/bin/baojing.sh
#!/bin/bash
echo "$3" | mutt -s "$2" $1
$1收件人 $2主题 $3邮件正文
ZABBIX之邮件报警
标签:
原文地址:http://www.cnblogs.com/tankt101/p/5551543.html