Hi all,
Is it possible to read the output of a specific service and pass it as argument to
a script (event handler or not itβs the same I believe) ?
Cheers,
Mike
Hi all,
Is it possible to read the output of a specific service and pass it as argument to
a script (event handler or not itβs the same I believe) ?
Cheers,
Mike
yes e.g.:
vars.icinga_last_output = {{get_service(ββ, ββ).last_check_result.output}}
Thank you!
Is this somewhere in the docs?
Yes e.g. in the table Runtime Attributes of Service Objects.
Can these functions work in the director too?
Because I am trying to pass what you posted above in a var but I am not
sure if it works. I tried getting the state of the service even and it still returns the output.
Edit: They can if you set the value type as Icinga DSL
You can pass the service output to the command by using β$service.output$β.
This also is possible in the director and even with more vars, we are doing that, too
We also use these ones, so you might give it a shot: $host.name$ $host.address$ $service.name$ $service.state$ $service.state_type$ $service.check_attempt$ $service.output$
Ah yes I had forgot about that even though I used it many times.
Thanks for the reminder!