The joys of doing it right

A while back, I wrote a post about why it’s not always possible to DoItRight™, and that sometimes you just have to accept it.  Today I’m here to talk about a time that I did something right and how good it felt.  Now, that’s not to say that I’m eternally screwing up (although a good quarter of my Subversion commits are fixes of a commit I previously made), but there’s a difference between making something work and making it work well.

I decided that since we have a Nagios server, I might as well have it check on the health of our Condor services.  From what I could tell, no such checks currently exist, so I decided to write my own.  Nagios checks can be very simple: run a command or two, and then return a number that means something to Nagios.  Many checks are written in bash or another shell script because they are so simple.  For my checks, I wanted to do some parsing of the command outputs to determine the state of job queues, etc.  Since that kind of work is a little heavy for a shell script, I opted to write it in Perl.  Yay Perl!

Since there aren’t any checks available, I thought my work might be useful to others in the community.  As a result, I wanted to make sure my code was respectable.  This meant I spent some time designing, coding, and testing options that we don’t want but others might find useful.  It meant putting extra documentation into the code (and eventually writing some pod before I share the code publicly).  It meant mostly following the coding style of the Linux kernel (I chose that because “why not?”).

Some readers will (correctly) note that the Linux kernel coding style does not guarantee good code.  I don’t mean to suggest that it does, but I’ve found that it forced me to think about my code more deeply than I otherwise would.  Not being a programmer, most of the code I write is to fit a small need of mine and the quality is defined as “does it do what I want it to?”  Writing something with the intent of sharing it publicly and forcing yourself to not cut corners can make the work more difficult, but the end result is a beauty to behold.

One thought on “The joys of doing it right

  1. Good job! Glad to hear your hard work paid off. As a sysadmin that struggles with scripting, I empathize with the “Wow! It works and I did a good job!” feeling after working hard on something. Getting everything just right isn’t easy (at least for me), and getting it good enough to share is an accomplishment. We don’t use Condor, but we use Nagios, so thanks for you’re effort. Another tool is always a great thing.

Leave a Reply

Your email address will not be published. Required fields are marked *