我们的备份在 22:00 到第二天 05:00 之间运行。我无法弄清楚如何在 icinga2(opensuse 42.1 上的 r2.4.1-1)中使用“apply ScheduledDowntime”在计划停机时间内进行此设置。
仅设置 22:00-05:00 会出现错误:
时间范围定义“22:00-05:00”无效:时间段结束时间早于开始时间
当前机制使用服务变量备份停机时间当不为空时,它会触发“应用”规则:
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 != ""
}
有人有主意吗?谢谢
答案1
您可以分配该service.vars.backup_downtime
值"22:00-24:00,00:00-05:00"
,以便从 22:00 到第二天 05:00 获得停机时间。
即服务定义将是:
apply Service "foo" {
display_name = "foo process"
import "generic-service"
check_command = "foo-process"
command_endpoint = host.address
vars.backup_downtime = "22:00-24:00,00:00-05:00"
assign where host.vars.type == "bar"
}
答案2
停机时间也可以定义为跨午夜的一段较长时间,例如凌晨 5 点即为 24+5 = 29:00:
vars.backup_downtime = "22:00-29:00"