溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

centos6.5 nagios-4.0.8   系統(tǒng)自帶sendmail郵件報警設置

發(fā)布時間:2020-05-15 02:46:01 來源:網(wǎng)絡 閱讀:1600 作者:火星小劉 欄目:移動開發(fā)

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ā)送間隔等等設置不做詳細介紹

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權內容。

AI