On Monday 18 March 2019 at 16:09:27, Václav Mach wrote:

> Hi,
> 
> have you tried debugging this using the icinga2 console?

Yes.

> 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/'

Right.  You can also do

icinga2 console --connect 'https://your_user:your_pass@localhost:5665/'
so long as you don't mind the password being visible in a process listing to 
other users on the machine.

> After connecting you can interact with your running configuration. I
> think this can help you a lot while using the icinga2 library reference.

Agreed (in principle, anyway).

> You can try to start by running 'get_host("your_host")' and then
> continue with more complex stuff based on properties you get.

Yes, I can do everything I want to there:

<1> => a=get_host("first.server.com").vars.neighbour
null
<2> => a
"second.server.com"
<3> => b=get_host(get_host("first.server.com").vars.neighbour).display_name
null
<4> => b
"HA Pair: Berlin"

And, "HA Pair: Berlin" is indeed the display_name for "second.server.com", 
which you can see is the value in vars.neighbour for "first.server.com"

So, I can get what I want in the console; it just doesn't work inside the 
code.

> Hope this helps, cheers.

Nice idea, but I'm still stuck about how to implement these commands where 
Ineed them to work :(


Antony.

-- 
Schrödinger's rule of data integrity: the condition of any backup is unknown 
until a restore is attempted.

                                                   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