I am trying to get info's of host xxx in Check_Mk using this docu: Command reference
The example call for getting host information looks like this:
curl "http://myserver/mysite/check_mk/webapi.py?action=get_host&_username=automation&_secret=myautomationsecret&output_format=python&request_format=python" -d 'request={"hostname":"myserver123"}'
Adapted to my credentials etc. I am getting the following error message:
{"result": "Check_MK exception: Missing required key(s): hostname", "result_code": 1}
I tried all combinations of "
and '
that I could think of in the request
part but always end up with this error. Calls that don't need a request
part like get_all_hosts
work just fine so I either I am doing something horribly wrong with the syntax or some other conditions are not met.
Here is an example call from me:
curl "https://CMK_SERVER/CMK_SITE/check_mk/webapi.py?action=get_host&_username=AUTO&_secret=ABC" -d 'request={"hostname":"XXX"}'
If I don't use any special characters around the request
part, I get this error:
{"result": "Check_MK exception: Failed to parse JSON request: '{hostname:XXX}': Expecting property name: line 1 column 2 (char 1)", "result_code": 1}
Any ideas what I am doing wrong?
EDIT: Interestingly, it works just fine in Linux, but not in Windows.