拥有帝国一切,皆有可能。欢迎访问phome.net
上面监控了ping值,ftp服务,ssh服务还有http服务,我拿一个例子来说明
define host{
use linux-server
host_name 192.168.1.211
alias 192.168.1.211
address 192.168.1.211
}
define service{
use generic-service
host_name 192.168.1.211
service_description check_ping
check_command check_ping!100.0,20%!200.0,50%
max_check_attempts 5
normal_check_interval 1
} |
例如这一段, define host定义了这台被监控主机,它所用的模板是linux-server这个,那这个模板又是在哪里定义的呢,就是在刚才nagios里不是有一行模板配置信息吗,就是那个文件,我打开templates.cfg 文件并找到linux-server模板,这模板的信息是这样的:
define host{
name linux-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 5 ; Actively check the host every 5 minutes
retry_interval 1 ; 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 admins ; Notifications get sent to the admins by default
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
}
|
拥有帝国一切,皆有可能。欢迎访问phome.net
这里的信息后面都有说明,把他们拿上谷歌翻译一下便是,
其中check_period 这个是定义监控的时间
check_interval这个是每多少时间执行一次命令
max_check_attempts这个是多少次异常就 |