天堂1111 发表于 2019-1-17 09:21:24

Nagios遇到的一点问题

关于如何使用timeperiod            
   
前言、问题的产生
    中间件。由于出于安全方面的考虑,这套业务需要在下班以后关闭,并且在第二天上班的时候开启。其实这个实现也没什么复杂的,可以写两个shell服务(也就是kill里,安排好执行时间,让它们定时执行就可以了。
    软件24依然去检查weblogic将critical那么如何解决这种具有时间段要求的监控问题呢?仔细的Nagios关于如何通过Nagios监控Weblogic 2. 2.1.由于配置文件的较多,而且文件的内容过多,我在这里仅列出与文件相关的一些配置。
·      Generic-service的定义
# This defines a timeperiod where all times are valid for checks,
# notifications, etc.The classic "24x7" support nightmare. :-)
define timeperiod{
      timeperiod_name 24x7
      alias         24 Hours A Day, 7 Days A Week
      sunday          00:00-24:00
      monday          00:00-24:00
      tuesday         00:00-24:00
      wednesday       00:00-24:00
      thursday      00:00-24:00
      friday          00:00-24:00
      saturday      00:00-24:00
      }
    和notification_period中明确定义时间范围是从周一到周日,每天24的定义。如果我们把监控服务的监控时间段(check_period,周一到周五),那么问题就可以迎刃而解了。
修改配置文件
·。
# Some P.R.C holidays
# 周一至周五的早八点到晚五点
define timeperiod{
      timeperiod_name cn_work_time_8x5
      alias         CN Work TIme 8x5
      use             cn-holidays   ;使用cn-holidays模板
      
      sunday          00:00-00:00
      monday          08:00-17:00
      tuesday         08:00-17:00
      wednesday       08:00-17:00
      thursday      08:00-17:00
      friday          08:00-17:00
      saturday      00:00-00:00
      
      }
·创建一个新的服务监控模板。   
# 8x5 service definition template - This is NOT a real service, just a template!

define service{
    name                  generic-service-8x5   ; The name of this service template
    use                   generic-service   ; Inherit default values from the generic-service definition
    check_period          cn_work_time_8x5
    notification_period   cn_work_time_8x5
}
·配置修改完了,下一步具体验证一下。
·好,配置没有问题,下一步重启Nagios配置成了SMF       3.以上是我在使用Nagios的整体设计架构比较强大,大部分的问题都能得以解决。当然如果有时间还是仔细看看Nagios
页: [1]
查看完整版本: Nagios遇到的一点问题