主要修改以下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-service在templates.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
}