Macro warning threshold? director

Hi
Is it possible to simply way specify to as a warning threshold use macro in the director ?

load_wload1 = {{
if (get_time_period (“backup-time”). is_inside) {
return 16
} else {
return 14
}

I’m still trying to increase thresholds through a macro in director. Unfortunately to no avail. Please indicate what I am doing wrong.

I created new command load_extend with fields

I added arguments:
Argument name -c
Value type Icinga DSL

Value var load_cload1 = {{
    if (get_time_period("backup").is_inside) {
      return macro("load_backup_cload1")
    } else {
      return macro("load_normal_cload1")
    }
  }},
var load_cload5 = {{
    if (get_time_period("backup").is_inside) {
      return macro("load_backup_cload5")
    } else {
      return macro("load_normal_cload5")
    }
  }},
var load_cload15 = {{
    if (get_time_period("backup").is_inside) {
      return macro("load_backup_cload15")
    } else {
      return macro("load_normal_cload15")
    }
  }}

Argument name -w
Value type Icinga DSL

var load_wload1 = {{
if (get_time_period(“backup”).is_inside) {
return macro(“load_backup_wload1”)
} else {
return macro(“load_normal_wload1”)
}
}},
var load_wload5 = {{
if (get_time_period(“backup”).is_inside) {
return macro(“load_backup_wload5”)
} else {
return macro(“load_normal_wload5”)
}
}},
var load_wload15 = {{
if (get_time_period(“backup”).is_inside) {
return macro(“load_backup_wload15”)
} else {
return macro(“load_normal_wload15”)
}
}}

Every time I see Warning threshold must be float or float triplet!
usage:
check_load [-r] -w WLOAD1, WLOAD5, WLOAD15 -c CLOAD1, CLOAD5, CLOAD15 [-n NUMBER_OF_PROCS]

Thanks for help

Hello!
Are you sure your function return correct type and result?

My function not return anything. Why?
host_name = “*"
icon_image_alt = “”
last_check = 1583753320.450145
last_check_result = {
active = true
check_source = "

command = [ “/usr/lib/nagios/plugins/check_load”, “-c”, “”, “-w”, “” ]
execution_end = 1583753320.450094
execution_start = 1583753320.448312
exit_status = 3.000000
output = “Warning threshold must be float or float triplet!\n\nUsage:\ncheck_load [-r] -w WLOAD1,WLOAD5,WLOAD15 -c CLOAD1,CLOAD5,CLOAD15”
performance_data = [ ]
schedule_end = 1583753320.450145
schedule_start = 1583753320.450145
state = 3.000000
ttl = 0.000000
type = “CheckResult”
vars_after = {
attempt = 1.000000
reachable = true
state = 3.000000
state_type = 1.000000
}
vars_before = {
attempt = 1.000000
reachable = true
state = 3.000000
state_type = 1.000000
}
}
last_hard_state = 3.000000
last_hard_state_change = 1583753030.440409
last_hard_state_raw = 3.000000
last_reachable = true
last_state = 3.000000
last_state_change = 1583751185.490748
last_state_critical = 0.000000
last_state_ok = 0.000000
last_state_raw = 3.000000
last_state_type = 1.000000
last_state_unknown = 1583753320.453873
last_state_unreachable = 0.000000
last_state_warning = 0.000000
max_check_attempts = 5.000000
name = “linux-load_extend”
next_check = 1583753610.463886
notes = “”
notes_url = “”
original_attributes = null
package = “director”
pause_called = false
paused = false
previous_state_change = 1583751185.490748
problem = true
resume_called = true
retry_interval = 60.000000
severity = 72.000000
source_location = {
first_column = 1.000000
first_line = 673.000000
last_column = 34.000000
last_line = 673.000000
path = “/var/lib/icinga2/api/packages/director/cd0cc956-05a1-41ca-9f3e-288478a00f77/zones.d/master/services.conf”
}
start_called = true
state = 3.000000
state_loaded = true
state_raw = 3.000000
state_type = 1.000000
stop_called = false
suppressed_notifications = 0.000000
templates = [ “linux-load_extend”, “linux-load_extend” ]
type = “Service”
vars = {
load_backup_cload1 = “20”
load_backup_cload15 = “8”
load_backup_cload5 = “12”
load_backup_wload1 = “15”
load_backup_wload15 = “6”
load_backup_wload5 = “10”
load_cload1 = “10”
load_cload15 = “4”
load_cload5 = “6”
load_wload1 = “5”
load_wload15 = “3”
load_wload5 = “4”
time_period = “time_day-6-18”
}

I have not used funciton for a while, but when I used, icingacli helped me a lot with debugging.
try to run your function via cli.

How to run function from icingacli?

this topic should helps
https://icinga.com/docs/icinga2/latest/doc/18-library-reference/#global-functions