nagios监控国外主机超时
2015-12-24 11:34
363 查看
项目上在国外(新加坡)有个主机,由于和谐墙的原因,用check_ping对其进行监控频繁超时,报错,收了一大堆通知邮件。没办法只能把检测超时时间设置大一点。
1.编辑新的检测命令
vim /etc/nagios/objects/commands.cfg #增加如下内容-p 1 -t 200,意思是发送一个包,超时时间设置为200s
# 'check-mwa-alive' command definition
define command{
command_name check-mwa-alive
command_line $USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,90% -c 5000.0,100% -p 1 -t 200
}
2.增加检测主机是否存活模板
vim /etc/nagios/objects/templates.cfg
define host{
name mwa-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 30 ; Actively check the host every 30 minutes ;每隔30分钟检查一次
retry_interval 1 ; Schedule host check retries at 1 minute intervals ;重试间隔
max_check_attempts 5 ; Check each Linux host 10 times (max);重试次数
check_command check-mwa-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
notification_period 24x7 ; the value that is inherited from the generic-host template!
notification_interval 60 ; Resend notifications every 2 hours
notification_options d,u,r ; Only send notifications for specific host states
contact_groups users ; Notifications get sent to the admins by default
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
}
3.编辑检测项目
vim /etc/nagios/server/mwa.cfg
define host{
use mwa-server ; Name of host template to use ;用第二部定义的模板:mwa-server
host_name mwa
alias mwa
address 128.199.93.212
}
4.检查配置文件是否正确
nagios -v /etc/nagios/nagios.cfg
。
。
。
Checking services...
Checked 54 services.
Checking hosts...
Warning: Host 'mwa' has no services associated with it!
Checked 7 hosts.
Checking host groups...
Checked 1 host groups.
Checking service groups...
Checked 0 service groups.
Checking contacts...
Checked 6 contacts.
Checking contact groups...
Checked 2 contact groups.
Checking service escalations...
Checked 0 service escalations.
Checking service dependencies...
Checked 0 service dependencies.
Checking host escalations...
Checked 0 host escalations.
Checking host dependencies...
Checked 0 host dependencies.
Checking commands...
Checked 26 commands.
Checking time periods...
Checked 5 time periods.
Checking for circular paths between hosts...
Checking for circular host and service dependencies...
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...
Total Warnings: 1
Total Errors: 0
5.重启nagios服务
service nagios restart
1.编辑新的检测命令
vim /etc/nagios/objects/commands.cfg #增加如下内容-p 1 -t 200,意思是发送一个包,超时时间设置为200s
# 'check-mwa-alive' command definition
define command{
command_name check-mwa-alive
command_line $USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,90% -c 5000.0,100% -p 1 -t 200
}
2.增加检测主机是否存活模板
vim /etc/nagios/objects/templates.cfg
define host{
name mwa-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 30 ; Actively check the host every 30 minutes ;每隔30分钟检查一次
retry_interval 1 ; Schedule host check retries at 1 minute intervals ;重试间隔
max_check_attempts 5 ; Check each Linux host 10 times (max);重试次数
check_command check-mwa-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
notification_period 24x7 ; the value that is inherited from the generic-host template!
notification_interval 60 ; Resend notifications every 2 hours
notification_options d,u,r ; Only send notifications for specific host states
contact_groups users ; Notifications get sent to the admins by default
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
}
3.编辑检测项目
vim /etc/nagios/server/mwa.cfg
define host{
use mwa-server ; Name of host template to use ;用第二部定义的模板:mwa-server
host_name mwa
alias mwa
address 128.199.93.212
}
4.检查配置文件是否正确
nagios -v /etc/nagios/nagios.cfg
。
。
。
Checking services...
Checked 54 services.
Checking hosts...
Warning: Host 'mwa' has no services associated with it!
Checked 7 hosts.
Checking host groups...
Checked 1 host groups.
Checking service groups...
Checked 0 service groups.
Checking contacts...
Checked 6 contacts.
Checking contact groups...
Checked 2 contact groups.
Checking service escalations...
Checked 0 service escalations.
Checking service dependencies...
Checked 0 service dependencies.
Checking host escalations...
Checked 0 host escalations.
Checking host dependencies...
Checked 0 host dependencies.
Checking commands...
Checked 26 commands.
Checking time periods...
Checked 5 time periods.
Checking for circular paths between hosts...
Checking for circular host and service dependencies...
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...
Total Warnings: 1
Total Errors: 0
5.重启nagios服务
service nagios restart
相关文章推荐
- 网络监控器Nagios全攻略
- 基于Nagios网络监控平台的实现--具体事例
- Nagios 笔记 Nagios服务端+客户端 + 短信报警 + 性能显示的图形插件
- FreeBSD下解决Nagios不发报警邮件的问题
- 收到新书两本
- nagios 分发文件实现代码
- Shell脚本编写Nagios插件监控程序资源占用
- Nagios监控Windows Server 2008配置方法
- Shell脚本实现批量生成nagios配置文件
- MySQL性能监控软件Nagios的安装及配置教程
- 基于Linux下Nagios的安装与配置说明介绍[图]
- shell脚本监控linux系统内存使用情况的方法(不使用nagios监控linux)
- Nagios远程监控安装与配置详解图文第1/3页
- 利用Nagios调用Python程序控制微信公众平台发布报警信息
- 运维网集成制作发布的Cacti+Nagios(中英文版全自动安装)
- memcached监控的几种方法(nagios等)
- nagios的安装,下载.
- Nagios安装与配置