Hi,

have you tried debugging this using the icinga2 console? If I'm correct the documentation suggests something like:

ICINGA2_API_USERNAME=your_user ICINGA2_API_PASSWORD=your_pass icinga2 console --connect 'https://icingaweb2@localhost:5665/'

After connecting you can interact with your running configuration. I think this can help you a lot while using the icinga2 library reference. You can try to start by running 'get_host("your_host")' and then continue with more complex stuff based on properties you get.

Hope this helps, cheers.
Vaclav

On 3/18/19 3:12 PM, Antony Stone wrote:
On Monday 18 March 2019 at 14:17:57, Edgar Fuß wrote:

EF> get_host(host.vars.neighbour)

[2019-03-18 09:24:55 +0000] critical/config: Error: Error while
evaluating expression: Tried to access undefined script variable 'host'

What context is that in?

It's in a NotificationCommand object.

I can use things like $host.name$ and $host.display_name$ perfectly okay to
get properties of the machine the notification is about.

What I want to do is include in the Notification the name of a "partner"
machine to this one (it's in a load-balanced pair).

If I reference $host.vars.neighbour$, I get the name of the partner machine,
no problem.

Now I need to reference other properties of _that_ host, to find out its
display_name and a couple of other details to include in the notification
report.

Depending on the context (function, Service Object, Host Object) you may
need host.vars, vars or this.vars.

Yep, I've been trying all sorts of combinations :)


Thanks for the help so far...


Antony.


--
Václav Mach
tel: +420 234 680 206
CESNET, z.s.p.o.
www.cesnet.cz

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to