sensu-java-api is a Java API for the Sensu monitoring framework. Specifically, it provides Java bindings for the Sensu API provided by Sensu itself. It currently uses Feign as the HTTP client.
It provides bindings for the following functionality:
- Reading information about checks
- Reading information about clients
- Reading information about events
- Reading information about stashes
- Issuing check requests
- Deleting clients
- Resolving events
- Creating/updating/deleting stashes
It does not yet have bindings for:
- Dealing with aggregates
- Checking Sensu's health
- Inspecting Sensu's info
The following functionality is not provided by the Sensu API, and thus cannot be included (unless it's first added to Sensu):
- Creating checks
- Creating clients
- Creating events
Binaries are published to JCenter. To use the library from Gradle, use something like this (substitute latest version):
repositories {
jcenter()
}
dependencies {
compile "com.commercehub.sensu:sensu-java-api:VERSION"
}Examples below are in Groovy. First, build an instance of SensuApi using SensuApiBuilder:
def api = SensuApiBuilder.builder()
.authentication(username, password)
.build(apiUrl)Then, use its methods to interact with the Sensu API:
println "Current checks: ${api.checks}"
println "Current clients: ${api.clients}"
println "Current events: ${api.events}"
println "Current stashes: ${api.stashes}"