A new project I’ve just deployed onto live uses the fast and lightweight beanstalkd work queue. ¬†As part of putting it into live I wanted to get at least some basic monitoring on the beanstalkd daemon. ¬†All my servers run monit for keeping an eye on processes I care about, so that seemed a good place to start.

I had a bit of a look around the interwebs but couldn’t find any examples, so I set about putting something together myself. As it turns out beanstalkd has a nice simple text protocol, detailed in protocol.txt which is included in the source, and monit has the ability to send and expect¬†arbitrary¬†strings to a given port. ¬†For starters I’ve set it up to issue a stats command and check for the expected response which is: