關(guān)于nagios郵件報警問題

使用郵件報警

為靈壽等地區(qū)用戶提供了全套網(wǎng)頁設計制作服務,及靈壽網(wǎng)站建設行業(yè)解決方案。主營業(yè)務為網(wǎng)站設計、做網(wǎng)站、靈壽網(wǎng)站設計,以傳統(tǒng)方式定制建設網(wǎng)站,并提供域名空間備案等一條龍服務,秉承以專業(yè)、用心的態(tài)度為用戶提供真誠的服務。我們深信只要達到每一位用戶的要求,就會得到認可,從而選擇與我們長期合作。這樣,我們也可以走得更遠!

1、我安裝了sendemail,并測試發(fā)送郵件成功

2、修改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" | /usr/bin/sendemail -f zx@zx.com -t $CONTACTEMAIL$ -s 192.168.1.88 -u "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" -xu zx@zx.com -xp 123456

}

# '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" | /usr/bin/sendemail -f zx@zx.com -t $CONTACTEMAIL$ -s 192.168.1.88 -u "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" -xu zx@zx.com -xp 123456

 

3、templates.cfg模版我使用的通用服務的設置

define service{

        name                            generic-service ; The 'name' of this service template

        active_checks_enabled           1       ; Active service checks are enabled

        passive_checks_enabled          1       ; Passive service checks are enabled/accepted

        parallelize_check               1       ; Active service checks should be parallelized (disabling this can lead to major performance problems)

        obsess_over_service             1       ; We should obsess over this service (if necessary)

        check_freshness                 0       ; Default is to NOT check service 'freshness'

        notifications_enabled           1       ; Service notifications are enabled

        event_handler_enabled           1       ; Service event handler is enabled

        flap_detection_enabled          0       ; Flap detection is enabled

        failure_prediction_enabled      1       ; Failure prediction is enabled

        process_perf_data               1       ; Process performance data

        retain_status_information       1       ; Retain status information across program restarts

        retain_nonstatus_information    1       ; Retain non-status information across program restarts

        is_volatile                     0       ; The service is not volatile

        check_period                    24x7; The service can be checked at any time of the day

        max_check_attempts              1; Re-check the service up to 3 times in order to determine its final (hard) state

        normal_check_interval           2; Check the service every 10 minutes under normal conditions

        retry_check_interval            2; Re-check the service every two minutes until a hard state can be determined

        contact_groups                  admins; Notifications get sent out to everyone in the 'admins' group

notification_optionsw,u,c,r; Send notifications about warning, unknown, critical, and recovery events

        notification_interval           10; Re-notify about service problems every hour

        notification_period             24x7; Notifications can be sent out at any time

         register                        0       ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE!

        }

 

4、contacts.cfg模版配置修改

define contact{

        contact_name                    nagiosadmin; Short name of user

usegeneric-contact; Inherit default values from generic-contact template (defined above)

        alias                           Nagios Admin; Full name of user

        email                           zqy@zx.com; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******

        }

###############################################################################

###############################################################################

#

# CONTACT GROUPS

#

###############################################################################

###############################################################################

# We only have one contact in this simple configuration file, so there is

# no need to create more than one contact group.

define contactgroup{

        contactgroup_name       admins

        alias                   Nagios Administrators

        members                 nagiosadmin

        }

 

5、nagios剛做好,把遠程主機給關(guān)閉,發(fā)現(xiàn)服務全部都收到郵件報警,再開機,發(fā)現(xiàn)報OK的郵件(所有service加上一個主機都正常)

但是我想再關(guān)機進行測試的時候,就發(fā)現(xiàn)不報警了,只有一個service報警郵件。這到底是怎么回事呢,如果要是模版里面進行設置的,那我要修改什么才能達到每次開關(guān)都報警,不管頻率有多頻繁。

當前題目:關(guān)于nagios郵件報警問題
網(wǎng)址分享:http://muchs.cn/article10/piddgo.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站制作、App開發(fā)、品牌網(wǎng)站設計、Google、企業(yè)網(wǎng)站制作、網(wǎng)站設計公司

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

搜索引擎優(yōu)化