[英]ICINGA2 API Not making host modification
我對ICINGA2的API有問題。
我正在嘗試通過POST調用添加新變量,我正在獲得所需的結果,
但是ICINGA2沒有添加新的變量。
根據文檔: http : //docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/icinga2-api
使用以下API,我在vienna中創建了所有主機:
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
雖然這部分按預期工作,
問題是一旦主機創建,我需要為不同的服務器添加各種變量。
例如,添加變量:“ vars.servicename”:“ DHCP_Servers”
如果我要返回文檔,則需要執行以下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
當我運行API時,正如預期的那樣,我回來了:
{
"results": [
{
"code": 200.0,
"name": "server.example.com",
"status": "Attributes updated.",
"type": "Host"
}
]
}
但是在ICINGA /主機文件上沒有發生任何更改。
顯然與我的收件箱和論壇( https://monitoring-portal.org/index.php?thread/37160-adding-vars-with-api/&postID=234885#post234885 )中的用戶相同。 將此留在此處作為注釋,因為它可能有助於其他人了解為什么它不起作用。 該功能只是未實現,因為它涉及存儲已應用的更改,進行回滾並重新應用。 聽起來並不簡單。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.