Sunday, 2 May 2010

Introducing JtSysMon

I spend a lot of time on the train travelling to work. Working from home has not really taken off in this part of the world - so, what better to do with that time than practice my craft? Its not comfortable, its hard to concentrate, but progress can be made. I have successfully used this tool to observe real performance problems, and confirm they've been resolved.

JtSysMon is a very simple monitoring tool which will poll resources and time the response. The response time is logged to a database, and from there, you can see which resources are either slow or failing/erroring.

I wrote this because I needed a way to make sure that various resources were available and responsive during development, so that we could respond quickly (proactively) to problems and have them fixed before developers or testers noticed or wasted time fault finding.

Existing solutions (Nagios, Zenoss etc) seemed too complex for such a simple requirement, with too much of a learning curve and setup required for essentially what is polling HTTP and SQL (please correct me if I am wrong).


Checkout from Use maven to build it and extract the binary archive so that you have a directory structure like:

- jtsysmon
|- bin
|- conf
|- lib

By default, an embedded instance of the DERBY database will be used to store the configuration and poll results. If you want, you can edit conf/ to point to another database. If you do, you will have to add the database driver jar file to the lib dir.


JtSysMon currently comes with 2 monitor types - SqlMonitor and HttpMonitor.

To configure a monitor, specify the class, a name, and then properties of the class as required. Reflection is used to set the properties of the class:
sh add name=sql1 class=com.javathinking.jtsysmon.core.monitor.SqlMonitor driverClass=org.hibernate.dialect.DerbyDialect connectionString=jdbc:derby://localhost:1527/jtsysmon "sql=select count(*) from APP.MONITORCONFIG"

sh add name=http1 class=com.javathinking.jtsysmon.core.monitor.HttpMonitor url=http://localhost/ checkFor=Hello
To list the monitors, use:
sh -list

Listing monitors

1048576 sql1
class = class com.javathinking.jtsysmon.core.monitor.SqlMonitor
connectionString = jdbc:derby://localhost:1527/jtsysmon
driverClass = org.hibernate.dialect.DerbyDialect
sql = select count(*) from APP.MONITORCONFIG
To delete a monitor, use delete, with the ID of the monitor (shown in the listing above):
sh -delete 1048576
To start monitoring, use:
sh -start
Use CTRL-C to stop.

To view alarms (where the time taken to perform poll exceeds a specified value) or problems (where the poll failed or errored) use:
sh -alarms -threshold 5 -period 20

Listing events over last 20 minutes

ALARMS (duration > 5)

19:08:18 paul-laptop1 sql1 28ms SUCCESS

PROBLEMS (non-successful events)

19:08:21 paul-laptop1 http1 90ms  ERROR

So there you have it - a bare bones way to check connectivity, response times, and availability of resources in your environment. This is meant only as a development tool, NOT for monitoring production resources.


If there is any interest from the community in using this tool, you could easily imagine:

  • multiple agents logging to a central database
  • more monitors
    • snmp
    • ssh
    • scripts
  • a web client
    • to display alarms and graphs of response times
    • to configure the monitors
  • notifiers to alert users of problems

For the latest information, see the source code (and README.TXT) at:

Week in Review - 2010-17

Ubuntu 10.04 is here! I've been running Ubuntu exclusively (my wife has the only Windows machine in the house) since (I think) around 6.XX and it just keeps getting better. Last year I converted my parents to Ubuntu 9.10 and every now and then they boot into windows because they don't know how to do something, but thats just because I'm in a different country - otherwise I'd be able to help them a lot more, and show them around. I've got remote control working well now (Remmina has an option to drop the colours to 256 which means it performs fine across the Tasman) so that means I can show them how to do things easily.

I'm looking forward to the new social network aspect of Ubuntu 10, with tight integration into chat and social networks - hopefully this will keep me in touch with my family much more. By the way, I really like Gwibber, and look forward to seeing that evolve.

If you like the sound of Linux and/or Ubuntu, I encourage you to try it out. It can make an old PC feel young, and trying it out is pretty easy. I like the way Ubuntu can be installed on a USB stick so that you can boot from it AND you can save to it - better than booting a live CD - which is also cool, but lets face it, CDs and DVDs are obsolete. You can buy a 1T drive for $100 so you wouldn't even use them for backups would you?

I'm also set up on which has been steadily improving over the last couple of months.

If you are looking for games on Linux, have a look at This is a great directory of games for Linux. Also see:

If you want to learn more about Ubuntu, check out:

Don't forget, there is a NetBook edition of Ubuntu, which may make your PC feel even younger - with a simplified interface its probably a good option for older PCs or non-power users. When all you need to do is surf the web, organise your photos, edit home videos and process documents, maybe the NetBook edition makes all that a little easier.

I've heard comments about gyms not being able to use commercial music without paying royalties. This sounds insane to me, but maybe it will help promote creative commons music. RhythmBox is a music player that comes with Ubuntu, and is integrated with Jamendo, Magnatune and Ubuntu One music store:

  • Jamendo: On Jamendo artists allow anyone to download and share their music. It's free, legal and unlimited.

  • Magnatune: We select the most amazing independent musicians and offer you unlimited downloading and listening for only $15/month.

  • UbuntuOne music store: Ubuntu users have access to purchase popular music from all of their favorite artists that make up an expanding catalog of millions of songs available in the Ubuntu One Music Store.

This makes finding music and buying music fantastically easy, and after my experiences with BigPond music and with iTunes being so closed, I say bring it! Any artists putting music out there that would be good for gym tracks should be getting in touch with these gyms and making themselves known!