Hallo zusammen,
meine Checkmk-Installation läuft soweit schon sehr zufriedenstellend. Ich bin inzwischen bei der API angekommen. Ich möchte meine Hosts inklusive ihrer Parents in bestimmten Ordnern anlegen. Das reine Anlegen von Hosts klappt auch wunderbar, aber ich schaffe es nicht, die Parents zu definieren.
So lege ich die Hosts an:
$Body = @{
action=“add_host”
_username=“automation”
_secret=“mysecret”
request_format=“json”
output_format=“json”
hostname=“myserver”
folder=“myfolder”
}
Invoke-WebRequest -Uri “https://cmkserver/instance/check_mk/webapi.py” -Body $Body
Wenn ich allerdings ein Parent angebe, bekomme ich eine Fehlermeldung.
Mein Aufruf:
$Body = @{
action=“add_host”
_username=“automation”
_secret=“mysecret”
request_format=“json”
output_format=“json”
hostname=“myserver”
folder=“myfolder”
attributes=@{
parents=“myparenthost”
}
}
Fehler:
{“result”: “Unhandled exception: Traceback (most recent call last):\n File “/omd/sites/myinstance/lib/python/cmk/gui/webapi.py”, line 145, in page_api\n response = _execute_action(api_call, request_object)\n File “/omd/sites/myinstance/lib/python/cmk/gui/webap
i.py”, line 230, in _execute_action\n return _execute_action_no_lock(api_call, request_object)\n File “/omd/sites/myinstance/lib/python/cmk/gui/webapi.py”, line 240, in _execute_action_no_lock\n “result”: api_call"handler",\n File
“/omd/sites/myinstance/lib/python/cmk/gui/plugins/webapi/webapi.py”, line 275, in add\n validate_host_attributes(attributes, new=True)\n File “/omd/sites/myinstance/lib/python/cmk/gui/plugins/webapi/utils.py”, line 119, in validate_host_attributes\n dict(
(key, value) for key, value in attributes.items() if not key.startswith("tag”)), new)\nAttributeError: ‘unicode’ object has no attribute ‘items’\n", “result_code”: 1}
Ich habe Checkmk in der Raw-Edition in Version 1.6.0p13 im Einsatz. Habt Ihr eine Idee, was ich falsch mache?
Vielen Dank.