大网数据广告活动
服务器运维问答

How to set icinga2 downtime across midnight

· 52CE 我爱测

Our backup is running between 22:00 and about 05:00 the next day. I could not figure out how to set this in a scheduled downtime with "apply ScheduledDowntime" in icinga2 (r2.4.1-1 on opensuse 42.1). Just setting 22:00-05:00 give…

问题原文

原帖链接 · B. Walger · CC BY-SA 3.0

Our backup is running between 22:00 and about 05:00 the next day. I could not figure out how to set this in a scheduled downtime with "apply ScheduledDowntime" in icinga2 (r2.4.1-1 on opensuse 42.1).

Just setting 22:00-05:00 gives me an error:

Invalid time range definition '22:00-05:00': Time period segment ends before it begins

The current mechanism uses a service variable backup_downtime which in turn triggers the "apply" rule when not empty:

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 != ""
}

Somebody an idea? Thanks

已采纳解答

原帖链接 · jijinp · CC BY-SA 3.0

You could assign the service.vars.backup_downtime value "22:00-24:00,00:00-05:00" so that you get downtime from 22:00 to 05:00 the next day.

ie. service definition will be:

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"
}

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-02-05)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。