您好,登錄后才能下訂單哦!
Centos默認(rèn)是安裝sendmail的,我們可以用sendmail發(fā)送郵件。
mail -s "test" shan1987shan@126.com < sendmail.cf //測(cè)試郵件發(fā)送 Vi /usr/local/nagios/etc/object/contacts.cfg //添加郵箱
Vi /usr/local/nagios/etc/object/commad.cfg //增加郵箱命令
define command{
command_name notify-host-by-sendEmail
command_line /usr/bin/printf "%b" "***** Nagios-BJ *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "host $HOSTSTATE$ alter for $HOSTNAME$!" $CONTACTEMAIL$ -l /var/log/sendEmail.log
}
define command{
command_name notify-service-by-sendEmail
command_line /usr/bin/printf "%b" "***** Nagios-BJ *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTNAME$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTNAME$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$ -l /var/log/sendEmail.log
}
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg //
Service nagios restart
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。