【发布时间】:2019-02-09 02:50:27
【问题描述】:
我正在尝试使用 CheckMK WebAPI 获取主机的状态。有人可以指出如何获取这些数据的正确方向吗?
我们目前正在使用 CheckMK 企业版 1.4.0。
我试过了:
https://<monitoringhost.tld>/<site>/check_mk/webapi.py?action=get_host&_username=<user>&_secret=<secret>&output_format=json&effective_attributes=1&request={"hostname": "<hostname>"}
但是响应中没有关于主机本身的任何相关信息(例如状态启动/关闭、正常运行时间等)。
{
"result": {
"attributes": {
"network_scan": {
"scan_interval": 86400,
"exclude_ranges": [],
"ip_ranges": [],
"run_as": "api"
},
"tag_agent": "cmk-agent",
"snmp_community": null,
"ipv6address": "",
"alias": "",
"management_protocol": null,
"site": "testjke",
"tag_address_family": "ip-v4-only",
"tag_criticality": "prod",
"contactgroups": [
true,
[]
],
"network_scan_result": {
"start": null,
"state": null,
"end": null,
"output": ""
},
"parents": [],
"management_address": "",
"tag_networking": "lan",
"ipaddress": "",
"management_snmp_community": null
},
"hostname": "<host>",
"path": ""
},
"result_code": 0
【问题讨论】:
-
如果我对文档的理解正确,那么您使用的 API 仅用于管理目的,而非监控。这就是 livestatus API 的目的。
标签: check-mk