Dear Icinga team.
I’m trying to find a solution so that a check-function can initialize, set a service variable which can be seen outside the function, that is be visible to REST api query and Icinga Web console.
Is there a way to initialize the variable condition_text for host/service as i try to describe in below code pragma ?
There might be namespace/scope issue or i simply miss the working variable accessor …
Any hint would be highly welcome.
Best regards
Michael
apply Service "irpc-scenario-" for ( instance => conf in host.vars.scenarios ) {
check_command = "dummy"
/* preset condition variables */
vars.condition_state=0
vars.condition_text="No condition is not met"
oPtrServiceSelf = get_service(host.name, service.name )
vars.dummy_state = {{
oPtrServiceSelf = get_service(host.name, service.name )
... doing a lot...
/* Try to update a service variable to indicate that condition is met*/
if (lCondition) {
this.vars.condition_text="Yes, that condition was found TRUE"
this.vars.condition_state=1
/* also tried
vars.condition_text="Yes, that condition was found TRUE"
vars.condition_state=1
*/
/* also tried
oPtrServiceSelf.vars.condition_text="Yes, that condition was found TRUE"
oPtrServiceSelf.vars.condition_state=1
*/
}
}}
...
assign where host.vars.scenarios
}