Skip to main content

Posts

Showing posts from June, 2012

Monitoring QNAP devices with OpenNMS

QNAP devices have snmp support out-of-the-box, unfortunately the agent they ship with is almost unusable. At first it seems it supports lots of cool features (like fans, temperature, smart, etc) but if you take a little time to dig deeper you will notice that almost all key entries are, what?!, octetStrings.

So good luck estimating disk usage when it is reported as a string: '1.8TB' (I quote exactly as it is shown by mibbrowser).

Without wasting any more of your (and mine) time let's fix that by installing the Optware QPKG and then installing net-snmp from the ipkg web console. The whole process is traightforward, just make sure to have a recent firmware:
log in to the QNAP admin web interfaceopen Applications servers and then select QPKG Centerfrom the Available tab install Optware and the enable it from the Installed tabnow access the Optware web interface and search for net-snmp, then click the install button on the net-snmp package At this point net snmp is running, we …

The best configuration manager for Nagios: Google Docs, of course!

Now, I'm not a fan of Nagios and I always recommend OpenNMS over Nagios, but when a client is fixated with Nagios I take a deep breath and get work done with it too.

Now it just happened that I couldn't convince a customer to use OpenNMS so I decided that if I really had to use Nagios I would do it in a way as innovative as possibile.
The first phase in this kind of projects is usually gathering requirements, that is hosts/appliances to be monitored. So I opened up a Google Document spreadsheet and started typing. At a certain point it hit me, what if I could make this doc the source for all configuration and just be done with it?
My spider sense were tingling and I knew I had just found a way to make a dull project an interesting and blog-worthy one.
I created a spreadsheet like the one in the picture with only 4 columns: ip, name/description, location, groups.
After that I shared the spreadsheet as csv and grabbed the url. From the shell I could now fetch the csv file as sho…

An alternative auditing strategy for Grails apps

In some applications it is useful, and in some case required, that the application audits some or all database operations: for instance to track when a user updates, deletes or inserts a record.

In Grails this is often handled by a plugin, like the Audit Logging plugin, which hooks into the Hibernate events and then logs the details to an audit table, including a timestamp, the user (if available) who initiated the operation and the type of operation.

Unfortunately the Audit Logging plugin suffers from some issues and if you, like me, have to ship today then you can only roll your own solution.

In this post I will lay out a solution which is simple, efficient and should work in most scenarios. The general requirements are:
only one datasourcethe underlying dbms must have triggers and some kind of session variables (most do, but I'll focus on Oracle)quartz jobs, background operations and other activities not necessarily initiated by an http request must properly initialize the conne…

TileDrawer: change bright style background color

More from my adventures in TileDrawer: the bright style comes with the wrong color for the map background (blue?), so I decided to replace it with a more sober shade of pale brown like most slippy maps seem to use.

The change is a one liner: go to /usr/local/tiledrawer/gunicorn, edit the second line of style.xml and change the bgcolor attribute to whatever you like. I used rgb(241,238,232).
Diff:
Other TileDrawer posts.

Improving TileDrawer rendering speed

I have been playing with TileDrawer recently. After a first rapid successful test on a throw-away EC2 instance I decided to deploy one on a vm for intranet use.

The installation process is pretty straightforward, just run the script copied from the TileDrawer page as root. FYI make sure you have installed curl and python-cssutils before launching the script.

After the script completed I started browsing the map and noticed that tiles took a looong time to render.
A look at top from the server console showed that postgres was hogging the cpu. Memory was fine with no signs of swapping (it is a 1GB instance which I promptly upgraded to 2, running on server class hardware with Xeon CPU). Even after the memory upgrade tile rendering was so slow that the browser would sometime give up and show a white tile.

I decided to look into it a little further and started by using the technique I have already described in another article. The database cache looked fine though as most relationships wer…