Search code examples
javamonitoringsensu

How to fetch sensu servers events data


I have set the threshold value to get the events in sensu server for infrastructure. Events are coming on sensu UI but how to fetch this all event data through API call either using JAVA or python. I need only event data.


Solution

  • 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. At that point, you can use a simple HTTP client in Java to communicate with the Sensu API on the /events endpoint (related documentation).

    For example, if you have a client called test-client and a check called check-test, you can do something like:

    $ 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).