Nagios使用mutt發用報警郵件
公司主營業務:網站制作、成都網站設計、移動網站開發等業務。幫助企業客戶真正實現互聯網宣傳,提高企業的競爭能力。創新互聯是一支青春激揚、勤奮敬業、活力青春激揚、勤奮敬業、活力澎湃、和諧高效的團隊。公司秉承以“開放、自由、嚴謹、自律”為核心的企業文化,感謝他們對我們的高要求,感謝他們從不同領域給我們帶來的挑戰,讓我們激情的團隊有機會用頭腦與智慧不斷的給客戶帶來驚喜。創新互聯推出赫章免費做網站回饋大家。
mkdir -p /usr/local/msmtp/etc
vi /root/.msmtprc
host smtp.163.com
tls off
auth plain
from 15614119390@163.com
user 15614119390
password 123456
vi /root/.muttrc
set sendmail="/usr/local/msmtp/bin/msmtp"
set use_from=yes
set from=15614119390@163.com
set envelope_from=yes
vi /usr/local/msmtp/etc/msmtprc
defaults
account 15614119390
host smtp.163.com
from 15614119390@163.com
auth login
port 25
tls off
user 15614119390@163.com
password 123456
account default: 15614119390
logfile /usr/local/msmtp/log/msmtp.log
echo 'setsendmail="/usr/local/msmtp/bin/msmtp"' >>/etc/Muttrc
echo "set use_from=yes" >>/etc/Muttrc
echo 'set realname="15614119390@163.com"'>>/etc/Muttrc
echo 'set editor="vim"' >>/etc/Muttrc
https://sourceforge.net/projects/msmtp/
tar xf msmtp-1.6.3.tar.gz
cd msmtp-1.6.3
./configure --prefix=/usr/local/msmtp
make
make install
ln -s /usr/local/msmtp/bin/msmtp /usr/bin
http://www.linuxfromscratch.org/blfs/view/7.8/basicnet/mutt.html
wget ftp://ftp.mutt.org/pub/mutt/mutt-1.5.24.tar.gz
tar xf mutt-1.5.24.tar.gz
cd mutt-1.5.24
./configure --prefix=/usr/local/mutt
make
make install
ln -s /usr/local/mutt/bin/mutt /usr/bin
echo "test" | mutt -s "test" 1075841124@qq.com
vi command.cfg
define command{
command_name notify-host-by-email
command_line /usr/bin/printf"%b" "***** Nagios *****\n\nNotification Type:$NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo:$HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mutt -s "**$NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **"$CONTACTEMAIL$
}
define command{
command_name notify-service-by-email
command_line /usr/bin/printf"%b" "***** Nagios *****\n\nNotification Type:$NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState:$SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n"| /usr/bin/mutt -s "** $NOTIFICATIONTYPE$ Service Alert:$HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
service nagios stop
serivce nagios start
當前題目:Nagios使用mutt發用報警郵件
網站網址:http://vcdvsql.cn/article0/pephio.html
成都網站建設公司_創新互聯,為您提供網站排名、自適應網站、網站設計、面包屑導航、標簽優化、Google
聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯