lmgsanm

每天学习一点,每天进步一点点…… Tomorrow is another beatifull day

导航

zabbix利用mutt和msmtp配置邮件报警

  1. Mutt安装

yum –y install mutt

  1. 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

  1. Mutt配置

vim /etc/Muttrc

set sendmail="/usr/local//msmtp/bin/msmtp"

set from="zabbix@uce.cn"

  1. 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

  1. 邮件报警脚本

vim /usr/local/zabbix/alertscripts/msmtp.sh

 

#!/bin/bash

echo "$3" | mutt -s "$2" "$1"

 

chmod 755 /usr/local/zabbix/alertscripts/msmtp.sh

posted on 2016-04-24 21:48  lmgsanm  阅读(405)  评论(0编辑  收藏  举报