Deleting Timeperiod for object is not adopted by database

Hi there,

we are currently experiencing some problems in Icinga when we want to remove the timeperiods from an object.
In Icinga Director we have defined a few templates for our timeperiods that set the check_period attribute (e.g. 5x9). If we want to apply a timperiod to a host we just import this template and we then can see the changes in the database (column check_timeperiod_object_id has a new value). However, if we remove this template again from the host the table does not seem to adopt and still have the old value.
Is this some kind of a bug or are we doing something wrong?

Regards,

brehman

1 Like

Good catch, I can reproduce this in my testing environment.
Quickly created a host template that only sets the check period to “9-to-5”.

After deploying, removing the template and deploying again the IcingaWeb2 interface sill lists the 9to5 period as Check timeperiod.

I assume this is due to the (our) generic host template not importing any time period, which normally leads to being checked 24x7.

template Host "generic-host" {
    check_command = "icmp"
    max_check_attempts = "3"
    check_interval = 5m
    retry_interval = 1m
}
template Host "9-to-5" {
    check_period = "9to5"
}

The “Inspect” function of the Director lists no check period though:

Object Properties
__name	"dc1"
acknowledgement	0
acknowledgement_expiry	0
action_url	""
active	true
address	"192.168.63.53"
address6	""
check_attempt	1
check_command	icmp
check_interval	300
check_period	""
check_timeout	null

Will see what is the correct information (Director or Icinga Web 2) and if the hosts is checked this evening or not.

That’s a known bug with Icinga 2’s DB IDO backend, where config hashes do not differ and as such no update event is created. I’m not sure whether this problem will be addresses any time soon though.

Cheers,
Michael

We came up with an idea as a workaround and would like to know what you think of it.
Basically we want to attach our 7x24 timeperiod to the base-ping template. That means if we would delete e.g. 5x9 for a host the check_period would automatically switch again to 7x24 (which is defined in base-ping).
Is this a good approach or are there better alternatives?
tempsnip

I don’t think there is a “right” or “wrong” way when it comes to template structure.
Whatever you work best with is good :slight_smile:

I, for example, have a "good old "generic-host/generic-service template that defines

  • check interval
  • retry interval
  • max check attempts
  • timeperiod (since yesterday :wink: )
    image

And then other templates that configure/change things like variables, check intervals and so on.

1 Like

Alright thanks for the explanation :slight_smile:

Hi @All,

we switched now to the basic-ping 7x24 timeperiod and are defining the timeperiods on all hosts seperatly - thanks this works well.

But while adding this solution i came accross the fact that it is not possible to add more then 1 timeperiod to a hosts.

Is there any solution to put more than 1 timeperiod per host/service?

we need to accomplish the following solution:
Host A is defined as be monitored 5x9 but also has the timeperiod vacation_berlin and a special which could be 7x24_october_second_week

I’d say you should open a new thread, as this has nothing to do with the initial problem of this one.
Maybe @brehman can set this one to solved?

Cheers