Tuesday, September 22, 2009

Snarl Smalltalk client

After basically hacking a simple Smalltalk Snarl client I decided to put it to use.

First of all a quick status on the client:
  • it covers the bare minimum functionality,
  • uses the network protocol because it was easy to do,
  • has no error handling because most of the time it just works.
To monitor our systems (we have about 9 servers) we use simple web interfaces to query their status. Normally we would log in to each app via HTTP and use the web interface, so I decided it would be easier to use Snarl to notify us as soon as something goes wrong (we have monitoring software but there are some issues ... anyway). I created a simple Seaside app to register/de-register a Snarl service running on our client PC's, and also start a background process to interrogate the HTTP interfaces of the PC's we were monitoring.

So far it has been working really well without any issues. As this was an interim measure I didn't want to spend too much time creating a monitoring tool but so far am impressed with how simple it was to hook everything up.

Some technical details on the solution: use SUnit to test the REST-ful services, announce the results (using Announcements) so that either the TestCase runs standalone if there isn't an announcer registered or it notifies all subscribers. Set up UpsideDownSnarl client to process the announcements. Used Seaside to create a management interface.

The sweetest section of code in all of this: Using Process>>allSubInstances and then using the enumeration protocol to find and terminate any processes that were registered on the clients behalf.

Smalltalk makes it so easy to do something like this :) you gotta love the quick feedback cycles

UpsideDownSnarl - Smalltalk Snarl client

I need to monitor some services at work and they've been misbehaving for a while now. So I saw James Robertson blogging on Snarl/Growl and decided to hack my own Snarl client for Pharo/Squeak.

I uploaded the first version to SqueakSource and I must say Snarl is a nifty little tool. I now can run my Snarl client + service tests and get notified if something goes down.