nagios监控国外主机超时

项目上在国外(新加坡)有个主机,由于和谐墙的原因,用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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值