Custom vars value from function call instead of function definition


I need to make dashboard in icingaweb2 which shows only hosts in problem condition for some period (2 hours for example). So I hope to make a function, which will return True for such a host and I will filter it out in icingaweb2 filters.

But I am not able to make the first step. Let’s start with the simplest function:

template Host “mygeneric-host” {
vars.state_overdue = {{ return “Test” }}

It seems work, but the vars.state_overdue has no “Test” value, it has Object of type ‘Function’ value in icingaweb2

icinga2 object list --type Host --name mytest

  • vars
    • state_overdue
      % = modified in ‘/etc/icinga2/zones.d/global-templates/templates.conf’, lines 33:4-33:44
      • arguments =
      • deprecated = false
      • name = “”
      • side_effect_free = false
      • type = “Function”

I am missing probably some very basic info how to call the function, but I am not able to figure it out.

Thank you

leave the config, use icingaweb2:
doe you use ido or icingadb?

does this help?


Thank you so much. I didn’t see the simplest solution, this filter works great: