[icinga-users] Question about icinga2 api dynamically added hosts and hostgroups

Gunnar Beutner Gunnar.Beutner at netways.de
Wed Nov 11 08:35:32 CET 2015






On 11/11/15 00:20, "icinga-users on behalf of Madhusmita Gochhait" <icinga-users-bounces at lists.icinga.org on behalf of mgochhait at juniper.net> wrote:

>I am using the snapshot version of icinga2 for the api feature . Dynamically add hosts and host groups.
>Here is what i am doing :
>To add hostgroup : curl -k -s -u icingaadmin:icinga 'https://localhost:5665/v1/objects/hostgroups/testgrp' -X PUT -d '{ "attrs": { "name" : "testgrp" ,"display_name" : "testgrp"
> , "state_loaded" :true }}'

You really shouldn’t set „state_loaded“ - that’s an internal attribute (in fact, the latest snapshot isn’t even showing that attribute for /v1/objects/<type> anymore). I’ve created a ticket for this: https://dev.icinga.org/issues/10601

>To add host :
>curl -k -s -u icingaadmin:icinga 'https://localhost:5665/v1/objects/hosts/ <https://localhost:5665/v1/objects/hosts/8.8.8.8>testhost' -X PUT -d '{ "templates": [ "generic-host" ], "attrs": { "address": "8.8.8.8" , "groups" : [
> "testgrp" ]} }'
>It gets successfully added  and I am also able to  query them through the api .
>But in UI , I am seeing only the host and no hostgroup .

Can you create a ticket for this problem please?

>The host group gets displayed once I restart/reload icinga .
>Since , we have a large setup (>1000 hosts ) , we don’t want to reload /restart everytime we add hostgroups .
>Is there any way it can be done in same way as the host , so that both host and host groups shows in UI without restart everytime ?
>
>
>Thanks,
>Mgochhait

Kind regards,
Gunnar Beutner

>
>
>
> <http://stackoverflow.com/questions/tagged/icinga>
>
>

-- 
Gunnar Beutner
Senior Developer

NETWAYS GmbH | Deutschherrnstr. 15-19 | D-90429 Nuernberg
Tel: +49 911 92885-0 | Fax: +49 911 92885-77
GF: Julian Hein, Bernd Erk | AG Nuernberg HRB18461
http://www.netways.de | Gunnar.Beutner at netways.de

** OSMC 2015 - November - netways.de/osmc **
** OSDC 2016 - April – netways.de/osdc **


More information about the icinga-users mailing list