Nagios指定用户进行发邮件配置

  

 

主要修改以下4个文件

 

(一)contacts.cfg文添加admin

 

define contactgroup {

      contactgroup_name    sap ; #联系人组名称

      alias                sap ; #联系人组描述

      members              wangmin,wangli; #联系人组成员,其中“s就是上面定义的联系人

}

 

 

 

(二)添加templates.cfg

    

 

1 主机组定义

 

# SAP  host definition template - This is NOT a real host, just a template!

 

define host{

        name                            sap-server    ; The name of this host template

        use                             generic-host    ; This template inherits other values from the generic-host template

        check_period                    24x7            ; By default, Linux hosts are checked round the clock

        check_interval                  2               ; Actively check the host every 5 minutes

        retry_interval                  2               ; Schedule host check retries at 1 minute intervals

        max_check_attempts              10              ; Check each Linux host 10 times (max)

        check_command                   check-host-alive ; Default command to check Linux hosts

        notification_period             workhours       ; Linux admins hate to be woken up, so we only notify during the day

                                                        ; Note that the notification_period variable is being overridden from

                                                        ; the value that is inherited from the generic-host template!

        notification_interval           120             ; Resend notifications every 2 hours

        notification_options            d,u,r           ; Only send notifications for specific host states

        contact_groups                  sap             ; Notifications get sent to the admins by default

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

        }

 

 

2 服务组定义

 

 

define service{

        name                            sap-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          1                       ; 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              3                       ; Re-check the service up to 3 times in order to determine its final (hard) state

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

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

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

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

        notification_interval           720                     ; 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!

        }

 

 

()修改hosts.cfg

 

#定义sap应用服务器10.86.87.185

 

define host{

        use                     sap-server,hosts-pnp    ;引用主机linux-server的属性信息,linux-server主机在templates.cfg文件中进

      host_name                 10.86.87.185   ;主机名

        alias                   10.86.87.185  ;主机别名

        address                 10.86.87.185 ;被监控的主机地址,这个地址可以是ip,也可以是域名。

          }

 

()修改services.cfg

 

 

#################   SAP生产机应用服务器  #####################

 

 

 define service{

        use                             sap-service,services-pnp  ;引用sap-service服务的属性值,sap-servicetemplates.cfg文件

 

        host_name                       10.86.87.185         ;指定要监控哪个主机上的服务,“web”在hosts.cfg文件中进行了定义。

 

        service_description             SAPPROD_PING       ;对监控服务内容的描述,以供维护人员参考。

 

        check_command                   check_ping!100.0,20%!500.0,60%  ;指定检查的命令,check_ping命令在commands.cfg中定义,后跟两>个参数,命令与参数间用!分割。

        }

define service{

        use                             sap-service,services-pnp

        host_name                       10.86.87.185

        service_description               SAPPROD_users

        check_command                   check_nrpe!check_users_1

        }

define service{

        use                             sap-service,services-pnp

        host_name                       10.86.87.185

        service_description               SAPPROD_load

        check_command                   check_nrpe!check_load_1

        }

 

define service{

        use                             sap-service,services-pnp

        host_name                         10.86.87.185

        service_description               SAPPROD_disk

        check_command                   check_nrpe!check_sda1_1

        }

 

  define service{

        use                             sap-service,services-pnp

        host_name                         10.86.87.185

        service_description               SAPPROD_swap

        check_command                   check_nrpe!check_swap_1

  }

 

define service{

        use                             sap-service,services-pnp

        host_name                         10.86.87.185

        service_description               SAPPROD_procss

        check_command                   check_nrpe!check_total_procs_1

  }

 

 

  define service{

        use                             sap-service,services-pnp

        host_name                       10.86.87.185

        service_description             SAPPROD_SSHD

        check_command                   check_tcp!22

        }

 

   define service{

        use                             sap-service,services-pnp

        host_name                       10.86.87.185

        service_description             SAPPROD_3600

        check_command                   check_tcp!3600

        }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值