如何在 Icinga 的预定停机时间内停止检查?

如何在 Icinga 的预定停机时间内停止检查?

当我在 Icinga 中设置计划停机时间时,程序会继续对远程系统执行检查。如何定义禁用检查的计划停机时间?

答案1

这应该可以通过以下方式实现:

1.在 ./conf.d/downtimes.conf 中创建停机定时器规范,例如:

apply ScheduledDowntime "backup-downtime" to Service { 
 author = "icingaadmin"                               
 comment = "Scheduled downtime for backup"            

 ranges = {                                           
   monday = service.vars.backup_downtime              
   tuesday = service.vars.backup_downtime             
   wednesday = service.vars.backup_downtime           
   thursday = service.vars.backup_downtime            
   friday = service.vars.backup_downtime              
   saturday = service.vars.backup_downtime            
   sunday = service.vars.backup_downtime              
 }                                                    

 assign where service.vars.backup_downtime != ""      
}                                                      

2.在您的服务定义中引用此配置,例如:

apply Service for (disk => config in host.vars.disks) { 

    import "generic-service"                                           

    /* Used by the ScheduledDowntime apply rule in `downtimes.conf`. */
    vars.backup_downtime = "03:00-04:30"                               

    check_command = "by_ssh_disk"                                      
    vars += config                                                     
    assign where host.vars.os == "Linux"                              
    ignore where host.name == NodeName                                 
}                                                                          

相关内容