Vibe is a simplistic approach to Java application monitoring.
Licensed under Apache 2.0.
There is currently no release available. See Other Notes for how you can use snaphots.
Using Maven:
<dependency>
<groupId>se.l4.vibe</groupId>
<artifactId>vibe-api</artifactId>
<version>version</version>
</dependency>
First create a Vibe instance:
Vibe vibe = DefaultVibe.builder()
.setSampleInterval(10, TimeUnit.SECONDS)
.build();
Export a few things:
vibe.timeSeries(JvmProbes.cpuUsage())
.at("jvm/cpu")
.export();
Events<UnauthorizedAccess> events = vibe.events(UnauthorizedAccess.class)
.severity(EventSeverity.WARN)
.create();
events.register(new UnauthorizedAccess(someImportantInfo));
Time series can have triggers:
vibe.timeSeries(JvmProbes.cpuUsage())
.at("jvm/cpu")
.when(averageOver(5, TimeUnit.MINUTES), above(0.9))
.sendEvent(EventSeverity.CRITICAL)
.export();
This will trigger a critical event (at the same path as the series) if the average CPU usage over five minutes exceeds 90%.
It is possible to use a trigger on an automatically calculated value:
vibe.timeSeries(JvmProbes.totalUsedMemory())
.at("jvm/mem/total")
.when(changeAsFraction(), on(averageOver(5, TimeUnit.MINUTES)), above(0.1))
.sendEvent(EventSeverity.WARN)
.export();
This will create a trigger that will be activated if the average value over 5 minutes changes more than 10%.
Vibe supports timing of actions, such as monitoring the time it takes for your application to handle a request.
To create a timer:
Timer timer = vibe.timer()
.at("web/requests")
.withBuckets(0, 50, 100, 200, 500, 1000) // for calculating percentiles
.export();
To use a timer:
Stopwatch stopwatch = timer.start();
try {
// Code to measure here
} finally {
stopwatch.stop();
}
Vibe can monitor the system it runs on via the use of Sigar.
<dependency>
<groupId>se.l4.vibe</groupId>
<artifactId>vibe-sigar</artifactId>
<version>current version</version>
</dependency>
Create probes for the system via SigarProbes
When you have configured a set of time series and triggers for those you can configure an e-mail backend so that you will receive notifications when things go wrong.
First include the backend:
<dependency>
<groupId>se.l4.vibe</groupId>
<artifactId>vibe-backend-mail</artifactId>
<version>current version</version>
</dependency>
Build a backend with the builder:
MailBackend backend = MailBackend.builder()
.setSender("[email protected]")
.setSmtpServer("smtp.example.org")
.setSubject("{severity} event for {path}")
.setMinimumSeverity(EventSeverity.WARN)
.addRecipient("[email protected]")
.build();
The current development version can also be accessed via a Maven snapshot repository. Include the following in your POM:
If you want to you can include this repository to use snapshot releases:
<repository>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>