Director - use function for timebased threshold

Hi guys,

I would like to use a time-dependent threshold for some checks, like it is described for Icinga 2 core here:

https://icinga.com/docs/icinga2/latest/doc/08-advanced-topics/
-> Time Dependent Thresholds

This looks pretty easy in a configuration file, but can I use a function for an Icinga Director attribute/field?

Best regards
Volker

The director does only allow to use functions instead of strings in the command definition for the arguments. So yes it can be done, but has to be done differently.

I have no access to one of the customer environments were I did this in the past at the moment, but if needed I can try to create an example.

Hi Dirk,

any hint would be great.

One question, as you did such stuff in the past: is this a peformance killer?

Best regards
Volker

Here is the example I came up with. Not exactly what I have used at the customer but similar to the one in the docs.

First I created a wrapper command timedependent-load which imports load.

Then I could override the arguments with a bit of DSL.

Afterwards simply create a service that uses the command and if not already existing you need to create the timeperiod.

Hi Dirk,

thanks for your reply, I think, I got it.

Best regards
Volker