RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


When JMX Is Overkill, Build a Lightweight Monitoring Framework : Page 4

A monitoring server is critical to any server-side infrastructure, be it an e-commerce or a telecom solution. Learn how to build a DIY (do-it-yourself) monitoring system using an extensible object-oriented framework.


Extending the Framework

You can extend the framework in many ways. One way is to implement new Info objects for monitoring various components like remote process, CPU load, bandwidth usage, etc. These new Info objects can be configured in a XML configuration file Monitor.xml (see Listing 4).

Listing 4. XML Configuration (Monitor.xml)

<MonitorServer interval="1" > <!-- The interval determines unit value of counter in seconds, if this value is 60 then minimum
frequency of monitoring is 60 sec or 1 min !--> <MONITORABLE name = "Apache Webserver" class = "ProcessInfo" counter = "1000" criticality = "HIGH"> <!-- ProcessInfo specific configuration !--> <process name="apache.exe" exec="C:/Apache.exe"/> </MONITORABLE> <MONITORABLE name = "Tomcat" class = "ProcessInfo" counter = "1000" criticality = "HIGH"> <process name="tomcat.exe" exec="path../tomcat.exe"/> </MONITORABLE> <MONITORABLE name = "C Drive" class = "FileSystemInfo" counter = "100000" criticality = "HIGH"> <filesystem path="C:" threshold="80" exec="C:/../diskcleanup.exe"/> </MONITORABLE> <MONITORABLE name = "app server" class = "ConnectivityInfo" counter = "1000" criticality = "HIGH"> <connectivity host=""/> </MONITORABLE> <MONITORABLE name = "LocalMachine" class = "CPUInfo" counter = "10000" criticality = "LOW"> <Threshold value="80"/> </MONITORABLE> </MonitorServer>

Here, each monitorable object is an XML node with common attributes like name, counter, criticality, and class. The class attribute is used for instantiating the Info object. The elements or nodes under each monitorable node are used to configure the corresponding Info object. You can implement new Info objects and add them to the Monitor.xml, which allows you to add new components without modifying the framework source.

You can further extend the framework to interface with third-party applications for generating reports and statistics. StatusManager can also provide a HTTP interface so that the components can be administered from a Web browser.

A Lightweight JMX Alternative

The monitoring framework is easy to extend and comes very handy especially in monitoring server-side applications. The lightweight framework is not a replacement for existing management tools. In fact, it is complimentary and easily can be integrated with high-end management software like HP OpenView.

Narendra Venkataraman is a senior developer in Hewlett-Packard's telecom division.
Email AuthorEmail Author
Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date