1

我正在尝试使用此文档在 Check_Mk 中获取主机 xxx 的信息:命令参考

获取主机信息的示例调用如下所示:

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"}'

适应我的凭据等。我收到以下错误消息:

{"result": "Check_MK exception: Missing required key(s): hostname", "result_code": 1}

我尝试了所有我能想到的"和组合,但总是以这个错误告终。不需要像这样的部分的调用工作得很好,所以我要么我在语法上做了一些可怕的错误,要么没有满足其他一些条件。'requestrequestget_all_hosts

这是我的一个示例电话:

curl "https://CMK_SERVER/CMK_SITE/check_mk/webapi.py?action=get_host&_username=AUTO&_secret=ABC" -d 'request={"hostname":"XXX"}'

如果我不在request零件周围使用任何特殊字符,我会收到此错误:

{"result": "Check_MK exception: Failed to parse JSON request: '{hostname:XXX}': Expecting property name: line 1 column 2 (char 1)", "result_code": 1}

任何想法我做错了什么?

编辑:有趣的是,它在 Linux 中工作得很好,但在 Windows 中却不行。

4

0 回答 0