如何获取 sensu 服务器事件数据
How to fetch sensu servers events data
我已经设置了阈值以获取基础设施的 sensu 服务器中的事件。事件即将发生 UI,但如何使用 JAVA 或 python 通过 API 调用获取所有事件数据。我只需要事件数据。
你需要确保你有 Sensu API up and running correctly, which I'm assuming you do if you're running the UI. At that point, you can use a simple HTTP client in Java to communicate with the Sensu API on the /events
endpoint (related documentation).
例如,如果您有一个名为 test-client
的客户端和一个名为 check-test
的支票,您可以这样做:
$ curl http://mysensu.com:4567/events/test-client/check-test
这将遵循上面记录的规范 return 事件信息(如果该 client/check 组合没有事件,则为 404)。
我已经设置了阈值以获取基础设施的 sensu 服务器中的事件。事件即将发生 UI,但如何使用 JAVA 或 python 通过 API 调用获取所有事件数据。我只需要事件数据。
你需要确保你有 Sensu API up and running correctly, which I'm assuming you do if you're running the UI. At that point, you can use a simple HTTP client in Java to communicate with the Sensu API on the /events
endpoint (related documentation).
例如,如果您有一个名为 test-client
的客户端和一个名为 check-test
的支票,您可以这样做:
$ curl http://mysensu.com:4567/events/test-client/check-test
这将遵循上面记录的规范 return 事件信息(如果该 client/check 组合没有事件,则为 404)。