On Sunday 17 March 2019 at 23:01:27, Antony Stone wrote:

> Can anyone point me at the correct syntax for de-referencing the variable
> host.vars.neighbour so that I can get the display_name attribute for that
> object?

Thanks to Edgar, Václav and Ivo for all the assistance.

I took a step backwards, to think about where else I might be able to solve 
this.

Instead of fiddling about with anything in the NotificationCommand object, I 
decided to look at the Notification object which assigns that command to 
various hosts and services (specifically:
  assign where host.vars.notification.mail )

So, I tried adding in to the Notification object definition:

  vars += { notification_neighb = get_host(host.vars.neighbour).display_name }

And, referencing $notification_neighb$ in my NotificationCommand object now 
works!

I can access all the attributes of host.vars.neighbour and pass them as 
variables to be used in the NotificationCommand.

I have no idea why it works in the Notification object, and the exact same 
thing doesn't work in the NotificationCommand object, but I'm happy I've got 
something working at last.


I'm sure I'd still like to know one day how correctly to use the log() 
function and end up with something in the log file, though...


Antony.

-- 
Why is "dylexia" so difficult to spell, and why can I never remember "aphasia" 
when I want to?

                                                   Please reply to the list;
                                                         please *don't* CC me.
_______________________________________________
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to