【发布时间】:2015-11-09 19:09:16
【问题描述】:
我将 icinga2 的快照版本用于 api 功能。 我能够成功地通过 api 动态添加主机组和主机并查询它们。
但是,我无法看到通过 icingaweb2 中的 api 添加的主机组。
这就是我正在做的事情:
添加主机组: 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 }} '
添加主机:
curl -k -s -u icingaadmin:icinga 'https://localhost:5665/v1/objects/hosts/8.8.8.8' -X PUT -d '{ "templates": [ "generic-host" ], "attrs": { "address": "8.8.8.8 " , "组" : [ "testgrp" ]} }'
在 UI 中,我无法看到通过 API 创建的主机组,但是主机在 UI 中是可见的。
【问题讨论】:
-
刚刚发现,通过API添加后,我必须重新启动它才能在UI中看到。有什么办法,我们可以在不重启 icinga2 进程的情况下做到这一点
标签: icinga