您好,登錄后才能下訂單哦!
1、安裝相關組建
yum install mailx sendmail*
chkconfig sendmail on
service sendmail start
2、測試郵件
echo "Hello World" | mail abc@abc.com
3、設置發(fā)件人
[root@localhost]#vi /etc/mail.rc
set from=skykws@163.com smtp=smtp.163.com set smtp-auth-user=skykws smtp-auth-password=000000 smtp-auth=login
4、編輯command.cfg
# 'notify-host-by-email' command definition
define command{
command_namenotify-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" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}
# 'notify-service-by-email' command definition
define command{
command_namenotify-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" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
4、重啟nagios
service nagios restart
5、后記
關于報警發(fā)送間隔等等設置不做詳細介紹
免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權內容。