Centos默認(rèn)是安裝sendmail的,我們可以用sendmail發(fā)送郵件。Service sendmail start
成都地區(qū)優(yōu)秀IDC服務(wù)器托管提供商(創(chuàng)新互聯(lián)公司).為客戶(hù)提供專(zhuān)業(yè)的托管服務(wù)器,四川各地服務(wù)器托管,托管服務(wù)器、多線服務(wù)器托管.托管咨詢(xún)專(zhuān)線:18980820575mail -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 //檢測(cè)語(yǔ)法
Service nagios restart
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性?xún)r(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專(zhuān)為企業(yè)上云打造定制,能夠滿(mǎn)足用戶(hù)豐富、多元化的應(yīng)用場(chǎng)景需求。