码迷,mamicode.com
首页 > 其他好文 > 详细

ZABBIX之邮件报警

时间:2016-06-02 00:46:19      阅读:166      评论:0      收藏:0      [点我收藏+]

标签:

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!