简体   繁体   English

如何获取Sensu服务器事件数据

[英]How to fetch sensu servers events data

I have set the threshold value to get the events in sensu server for infrastructure. 我已设置阈值以获取sensu服务器中用于基础架构的事件。 Events are coming on sensu UI but how to fetch this all event data through API call either using JAVA or python. sensu UI上出现了事件,但是如何通过使用JAVA或python的API调用来获取所有事件数据。 I need only event data. 我只需要事件数据。

You'll need to ensure you have a Sensu API up and running correctly, which I'm assuming you do if you're running the UI. 您需要确保已正确安装并运行了Sensu API ,如果您正在运行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 ). 此时,您可以使用Java中的简单HTTP客户端与/events端点上的Sensu API通信( 相关文档 )。

For example, if you have a client called test-client and a check called check-test , you can do something like: 例如,如果您有一个名为test-client和一个名为check-test ,则可以执行以下操作:

$ curl http://mysensu.com:4567/events/test-client/check-test

and that will follow the documented spec above to return the event information (or 404 if there is no event for that client/check combination). 并且将遵循上面记录的规范以返回事件信息(如果该客户/支票组合没有事件,则返回404)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM