nagios+sendmail配置

以下爲自己安裝測試過的,如果有問題,大家一起討論

 系統環境:centos6.2 64位 最小化安裝

一 安裝nagios

見附件:nagios官方文檔(nagios_nrpe20120929_web.pdf)

二 安裝配置sendmail

我用hotmail郵箱接收nagios報警郵件

 

yum install sendmail m4 mailx

vim /etc/mail/access

添加

 

Connect:http://www.hotmail.com          RELAY

Connect:192.168                         RELAY(不知道什麼用處)

Connect:1.1.1                           RELAY(不知道什麼用處)

Connect:[email protected]    RELAY

 

保存後運行

makemap -v hash /etc/mail/access.db < /etc/mail/access

service sendmail restart

測試sendmail

echo 123 | mail -s test1 ***@hotmail.com(我的郵箱)

echo 456 | sendmail -v ***@hotmail.com(我的郵箱)

兩封郵件都收到了

三 整合nagios和sendmail

修改/usr/local/nagios/etc/objects/contacts.cfg

 

define contact{

        contact_name                    nagiosadmin

        use                             generic-contact

        alias                           Nagios Admin

        email                           ***@hotmail.com(我的郵箱) 

        service_notification_period     24x7

        host_notification_period        24x7

        service_notification_options    w,u,c,r,f,s

        host_notification_options       d,u,r,f,s

        service_notification_commands   notify-service-by-email

        host_notification_commands      notify-host-by-email

        host_notifications_enabled      1

        service_notifications_enabled   1

        }

 

 

define contactgroup{

        contactgroup_name       admins

        alias                   Nagios Administrators

        members                 nagiosadmin

        }

重啓nagios

service nagios restart

至此配置結束

我這樣配置後,可以收到nagios發來的報警郵件。這只是個粗略配置,具體細節還在學習中。

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章