The Simplest Way to Build a Java Custom Monitor

Monitis’s existing Java SDK provides you with almost all possible ways to create any internal monitoring agent that a user wants. But, unfortunately, Java gives you no simple way to build a custom monitor. Adding a couple of simple classes into the existing API opens the simplest way to build, in fact, almost any type of custom monitor. Below we describe the additions to the existing API that allow you to do so, and we’re also providing a corresponding example.

How Monitis’s Existing Java SDK Has Been Enhanced

Basically, we added two classes:

With this class, we added a new custom monitor to the existing scope of Monitis monitors. The necessary parameters and values should be provided by user class that extends the IGenericCustomMonitor abstract class.

This is an abstract class that provides all definitions for a Generic Custom Monitor. Users should make use of it for implementing their own custom monitor (see attachments).

The corresponding JAR file was created for the new API that was used during tests. Note that users should provide only one simple class and the desired custom monitor will be created instantly.

Example of Creating The Memcached Custom Monitor by Using The Above Described Concept

The Memcached simple custom monitor was created by using the aforementioned concept, and we named it MemcachedMonitor (see attachments).
Note: this monitor was created only as a sample for illustration purposes, that is, how simply a custom monitor on Java can be created, but not for creating a suitable and powerful memcached monitor.

Testing The Custom Memcached Monitor

The created Memcached custom monitor was activated for a 15-minute test duration, and data was sent every one minute. Notice that the memcached server was under load (send and receive records about an 84 mes/sec rate). It was run under Linux Ubuntu 11.04 and the machine had the following parameters: Intel Pentium Dual Core 2.4GHz, 2GB RAM.

To view the results, add a Custom Monitor widget to your Monitis account by using the Monitors menu: Select Manage Monitors -> Custom Monitors. Next, select the newly created Custom Monitor and click “Add to Window” (see results in attachments).


Below is the screenshot grabbed from the Monitis site:

It is also possible to show any measured columns in a graphic view.

The above measurements show that the monitored Memcached server is in the perfect working state, with missed and evictions items equal to minimum possible values through zero — though it has enough load capacity to reach up to 160 requests per second.

Source code:

[gist] [/gist]