On Monday 18 March 2019 at 20:30:58, Antony Stone wrote:

> On Monday 18 March 2019 at 19:58:19, Ivo Kidze wrote:
> 
> > You can try this:
> ...
> 
> > 6. use can now use get_display_name("hostname")
> 
> Hm, interesting solution to the debugging problem - I shall try that
> tomorrow.

It didn't seem too hard, so I thought I'd try it tonight...

I've added a parameter "-a" to the "mail-service-notification" object.

I know it works, because if I add to the NotificationCommand:

  arguments += { "-a" = "Additional Info" }

I do indeed get that string passed to the script, and included in the 
notification email.

So, trying more useful things than a static string...

  "-a" = "AddInfo: $host.name$"

results in "AddInfo: first.server.com"

  "-a" = "AddInfo: " + get_host("first.server.com").name

results in "AddInfo: "

  "-a" = "AddInfo: " + get_display_name("first.server.com")

results in "AddInfo: None"
(which at least proves that the function is being called, albeit with a 
parameter it can't use).

So, if I can't even get a fixed hostname to work with these functions, I don't 
expect success with things like:

  get_host(host).name

result: Error: Error while evaluating expression: Tried to access undefined 
script variable 'host'

  get_host($host$).name

result: Error: syntax error, unexpected $undefined, expecting ')'

  get_host("$host$").name

result: No syntax error, but also no output in the parameter.

> Thanks also for the helpful clue regarding what parameters to pass to log()
> in general.

Still no joy with that part :(


Antony.

-- 
"In fact I wanted to be John Cleese and it took me some time to realise that 
the job was already taken."

 - Douglas Adams

                                                   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