ICINGA2 API不进行主机修改

时间:2016-08-23 12:55:31

标签: api post

我对ICINGA2的API有疑问。

我正在尝试使用POST调用添加新变量, 我得到了所需的结果,

但是ICINGA2没有添加新的var。

根据文件: http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/icinga2-api

使用以下API,我在维也纳创建了所有主机:

hdfs dfs -cat hdfs://10.253.11.10:8020/tmp/user/vid2.avi | exiftool -

虽然这部分按预期工作,但

问题是一旦主机创建,我需要为不同的服务器添加各种变量。

例如,

添加变量:“vars.servicename”:“DHCP_Servers”

如果我要回到文档,则需要执行下面的API:

curl -k -s -u root:icinga -H 'Accept: application/json' -X PUT 'https://localhost:5665/v1/objects/hosts/server.example.com' \
-d '{ "templates": [ "generic-host" ], "attrs": { "zone": "Vienna", "address": "180.33.1.123", "check_command": "hostalive", "vars.os" : "Linux", "vars.agent" : "ssh" } }' \
| python -m json.tool

当我运行API时,正如预期的那样我回来了:

curl -k -s -u root:icinga -H 'Accept: application/json' -X POST 'https://localhost:5665/v1/objects/hosts/server.example.com' \
-d '{ "templates": [ "generic-host" ], "attrs": { "zone": "Vienna", "address": "180.33.1.123", "check_command": "hostalive", "vars.os" : "Linux", "vars.agent" : "ssh", "vars.servicename" : "DHCP_Servers" } }' \
| python -m json.tool

但ICINGA /主机文件没有发生任何变化。

1 个答案:

答案 0 :(得分:0)

显然,与我的收件箱和论坛(https://monitoring-portal.org/index.php?thread/37160-adding-vars-with-api/&postID=234885#post234885)中的用户相同。将此作为一个注释留在这里,因为它可能有助于其他人看到它为什么不起作用。该功能尚未实现,因为它涉及存储应用的更改,执行回滚和重新应用。并不像听起来那么简单。

https://dev.icinga.org/issues/11501