Downtime Problem

We have 2 master nodes in master zone and 1 satellite node in satellite zones, the masters monitors the principal site and the satellite (with some agents) monitors a secondary site situated in another location. Master1-2 point to galera mysql cluster, satellite have a locally mysql installed. In the satellite dashboard are showed only satellite’s host monitored, in masters dashboard are showed master’s hosts and satellite’s hosts monitored.The checks works fine but we have problems with ScheduledDowntimes: downtimes are applied and showed only on satellite zone.
Below the config files
Master1 and Master2 (SRVMSTR01-02) --> /etc/icinga2/zones.conf:

object Endpoint "SRVMSTR01" {
host = "ip of master1"
}
object Endpoint "SRVMSTR02" {
host = "ip of master2"
}
object Endpoint "SRVSTLT" {
}
object Zone "master" {
endpoints = [ "SRVMSTR01","SRVMSTR02" ]
}
object Zone "global-templates" {
global = true
}
object Zone "director-global" {
global = true
}
object Zone "global-commands" {
global = true
}
object Zone "satellitezone" {
endpoints = [ "SRVSTLT*****" ]
parent = "master"
}

Satellite (SRVSTLT) --> /etc/icinga2/zones.conf:

object Endpoint "SRVMSTR01" {
host = "ip of master1"
port = "5665"
}
object Endpoint "SRVMSTR02" {
host = "ip of master2"
port = "5665"
}
object Zone "master" {
endpoints = [ "SRVMSTR01","SRVMSTR02" ]
}
object Endpoint "SRVSTLT" {
}
object Zone "satellitezone" {
endpoints = [ "SRVSTLT" ]
parent = "master"
}
object Zone "global-templates" {
global = true
}
object Zone "director-global" {
global = true
}
object Zone "global-commands" {
global = true
}

SRVMSTR01 api.conf–> /etc/icinga2/features-enabled/api.conf

object ApiListener "api" {
accept_config = true
accept_commands = true
ticket_salt = TicketSalt
}
SRVMSTR02 api.conf--> /etc/icinga2/features-enabled/api.conf
object ApiListener "api" {
accept_config = true
accept_commands = true
}

SRVSTLT api.conf--> /etc/icinga2/features-enabled/api.conf
object ApiListener "api" {
cert_path = "/var/lib/icinga2/certs/" + NodeName + ".crt"
key_path = "/var/lib/icinga2/certs/" + NodeName + ".key"
ca_path = "/var/lib/icinga2/certs/ca.crt"
accept_config = true
accept_commands = true
}

We use ScheduledDowntime apply rules to downtime host: /etc/icinga2/zones.d/master/downtimes.conf

apply ScheduledDowntime "backup-downtime2" to Host {
author = "icingaadmin"
comment = "Scheduled downtime for backup"
ranges = {
monday = "22:15-24:00"
tuesday = "22:15-24:00"
wednesday = "22:15-24:00"
thursday = "22:15-24:00"
friday = "22:15-24:00"
saturday = "22:15-24:00"
sunday = "22:15-24:00"
}
assign where host.zone == "master" && assign where host.vars.hosttype == "Veeam"
}

in satellite zone:
/etc/icinga2/zones.d/satellitezone/downtimes.conf

apply ScheduledDowntime "satellitebackup-downtime2" to Host {
author = "icingaadmin"
comment = "Scheduled downtime for backup"
ranges = {
monday = "22:15-03:00"
tuesday = "22:15-03:00"
wednesday = "22:15-03:00"
thursday = "22:15-03:00"
friday = "22:15-03:00"
saturday = "22:15-03:00"
sunday = "22:15-03:00"
}
assign where host.zone == "satellitezone" && assign where host.name == "agent01***"
}

If run object list ScheduledDowntime, i can see the Downtimes but are not applyed:

from SRVMSTR01–> icinga2 object list --type ScheduledDowntime

Object 'agent01***!backup-downtime2'** of type 'ScheduledDowntime':
% declared in '/etc/icinga2/zones.d/master/downtimes.conf', lines 1:0-1:49

* __name = "agent01***!backup-downtime2"
* author = "icingaadmin"
% = modified in '/etc/icinga2/zones.d/master/downtimes.conf', lines 2:3-2:24
* child_options = "DowntimeNoChildren"
* comment = "Scheduled downtime for backup"
% = modified in '/etc/icinga2/zones.d/master/downtimes.conf', lines 3:3-3:43
* duration = 0
* fixed = true
* host_name = "agent01***"
% = modified in '/etc/icinga2/zones.d/master/downtimes.conf', lines 1:0-1:49
* name = "backup-downtime2"
* package = "_etc"
% = modified in '/etc/icinga2/zones.d/master/downtimes.conf', lines 1:0-1:49
* ranges
% = modified in '/etc/icinga2/zones.d/master/downtimes.conf', lines 5:3-13:3
  * friday = "22:15-24:00"
  * monday = "22:15-24:00"
  * saturday = "22:15-24:00"
  * sunday = "22:15-24:00"
  * thursday = "22:15-24:00"
  * tuesday = "22:15-24:00"
  * wednesday = "22:15-24:00"
* service_name = ""
* source_location
  * first_column = 0
  * first_line = 1
  * last_column = 49
  * last_line = 1
  * path = "/etc/icinga2/zones.d/master/downtimes.conf"
* templates = [ "backup-downtime2" ]
% = modified in '/etc/icinga2/zones.d/master/downtimes.conf', lines 1:0-1:49
* type = "ScheduledDowntime"
* vars = null
* zone = "master"
% = modified in '/etc/icinga2/zones.d/master/downtimes.conf', lines 1:0-1:49

from SRVMSTR02:

Object 'agent01***!backup-downtime2' of type 'ScheduledDowntime':
% declared in '/var/lib/icinga2/api/zones/master/_etc/downtimes.conf', lines 1:0-1:49

* __name = "agent01***!backup-downtime2"
* author = "icingaadmin"
% = modified in '/var/lib/icinga2/api/zones/master/_etc/downtimes.conf', lines 2:3-2:24
* child_options = "DowntimeNoChildren"
* comment = "Scheduled downtime for backup"
% = modified in '/var/lib/icinga2/api/zones/master/_etc/downtimes.conf', lines 3:3-3:43
* duration = 0
* fixed = true
* host_name = "agent01***"
% = modified in '/var/lib/icinga2/api/zones/master/_etc/downtimes.conf', lines 1:0-1:49
* name = "backup-downtime2"
* package = "_cluster"
% = modified in '/var/lib/icinga2/api/zones/master/_etc/downtimes.conf', lines 1:0-1:49
* ranges
% = modified in '/var/lib/icinga2/api/zones/master/_etc/downtimes.conf', lines 5:3-13:3
  * friday = "22:15-24:00"
  * monday = "22:15-24:00"
  * saturday = "22:15-24:00"
  * sunday = "22:15-24:00"
  * thursday = "22:15-24:00"
  * tuesday = "22:15-24:00"
  * wednesday = "22:15-24:00"
* service_name = ""
* source_location
  * first_column = 0
  * first_line = 1
  * last_column = 49
  * last_line = 1
  * path = "/var/lib/icinga2/api/zones/master/_etc/downtimes.conf"
* templates = [ "backup-downtime2" ]
% = modified in '/var/lib/icinga2/api/zones/master/_etc/downtimes.conf', lines 1:0-1:49
* type = "ScheduledDowntime"
* vars = null
* zone = "master"
% = modified in '/var/lib/icinga2/api/zones/master/_etc/downtimes.conf', lines 1:0-1:49

I’m new in forum and Icinga2, sorry if I have made trivial configuration errors.
Thanks for your help!

Welcome to the community!
I’ve edited your post and put all code snippets in between code tags ```, so the whole post becomes readable :wink:

Please use these options in future posts :slight_smile:
Check this guide for further information:

Best regards!

1 Like

Hello Matteo291291,
When you confirm your configuration (icinga2 daemon -C) do you receive a warning message stating “Apply rule does not match anywhere!” for downtime “backup-downtime2”? The scheduleddowntime object will show in your configuration even if it does not getting applied anywhere.
The apply rule for “backup-downtime2” includes an AND (&&) statement with vars.hosttype. Is this var included in the host object? You did not include the host object in your post.

You could use the match expression in your apply rule.

apply ScheduledDowntime "backup-downtime2" to Host {

// normal apply statement

assign where match ( "SRVMSTR*", host.name )

Regards

Hi Alex,
thanks for your reply, the apply rule is ok, i have solved my problem by following this steps:
-delete /var/lib/icinga2/icinga2.state from master 2.
-rm -rf /var/lib/icinga2/api/ {packages,zones,zones-stage}/* from master 2

Mater 1 have succesfully replicate the icinga2.state and the folders deleted, after that every scheduleddowntime works correctly.
Thanks
Best regards
Matteo