Author Archives: Bruce


We use PagerDuty where I work at to manage on-call notifications, escalations, etc. It’s a great tool to manage alerts from tools and services like Nagios, New Relic, and dozens of others. They also provide a handy dandy REST API, and it should be no surprise that somebody then wrote a Python module to encapsulate it (thanks DropBox!).  Thanks to that I wrote a handy-dandy command line tool called pdmaint for my company to schedule maintenance windows in PagerDuty. Since we’ve found it incredibly useful I was able to get the powers-that-be to let us open source it.  So you can find pdmaint over at Github if you’re interested.  There’s a full set of documentation there as well.


Here’s a handy little IMAP utility people may find useful. IMAPrunner was an excuse for me to learn a little more about Python programming and to also throw together something useful at the same time.  It’s a Python script that lets you associate scripts/commands with mail messages in individual mail folders.

I now have a cron job set up that checks for any e-mails I add to a “spam” folder.  If I receive any spam I just move it to that folder.  IMAPrunner will then pass the spam e-mail onto SpamAssassin, razor, pyzor, etc. and then delete the e-mail automatically. There’s really no limit to what you can trigger in response to an e-mail with it.  And I already have a few thoughts for improvements to it…

Instant Nagios Starter

I was recently contacted by Packt Publishing and asked to review their book Instant Nagios Starter, by Michael Guthrie.  I’ve actively used Nagios (and forks) for well over a decade now, and have even contributed some code development to it, so I’m intimately familiar with installing, configuring, and managing Nagios environments.

Nagios is an extremely powerful and flexible monitoring platform, and those two attributes also result in it also being a fairly complex piece of software to configure if you’ve never dealt with it before.  This book does an excellent job of walking you through the steps of installation and basic configuration of Nagios on a CentOS/RHEL system.

Nagios, as with just about any complex piece of software, relies on a number of system configuration settings, files in multiple locations, etc. to run properly.  Instant Nagios Starter does an excellent job of walking you through each and every dependency so that you can get a basic Nagios server up and running in no time at all.  If you’re new to Nagios, or need to spin up a new Nagios server and may have only ever worked with existing Nagios setups in the past, then this guide will save you a lot of time and potential aggravation in getting started.

The title of this book is extremely accurate – it will get you started with Nagios in almost no time at all.  If you’re looking for anything beyond the basics of setting up Nagios then you’ll want something a bit more in depth, and Packt Publishing has you covered there as well since they also have a number of other books on the subject.

Perhaps the only thing that would make this book more valuable would be if Packt Publishing offered a download of a VMWare CentOS instance with Nagios pre-installed (or partially installed) for those who don’t want to waste any time installing linux first.

nagios-plugins patch to check_dig

I use Nagios (actually Icinga) at work and do a lot of tinkering with it.  I recently needed to modify the check_dig command to allow for verifying whether a response is authoritative or not.  This is apparently something that’s asked for a lot according to some Google searching that I’ve done, so I wrote a quick patch, and I’ve submitted it to the Nagios Plugin project on Sourceforge.  Hopefully they’ll accept it, but in the meantime I thought I’d post it here as well so others can make use of it if the have a need for it.

The patch is available two ways depending on your preference.  You can just download a patched version of nagios-plugins-1.4.15.tar.gz, build the plugins as you normally would, and be on your way.  Or you can download the official version of nagios-plugins-1.4.15.tar.gz from Sourceforge and just apply this check_dig patch.  To apply the patch:

[brucep@carbon:~/tmp] tar xvzf nagios-plugins-1.4.15.tar.gz
[brucep@carbon:~/tmp] gunzip check_dig.patch.gz
[brucep@carbon:~/tmp] patch -p0 < check_dig.patch # Note, that’s a zero, not the letter o.

Assuming the patch command doesn’t report any problems you should be all set.  Just rebuild the plugins and you’re good to go.  This adds a ‘-e’ option to the command line.  If you use -e then check_dig will verify that the flags header from dig contains the ‘aa’ flag.  If the ‘aa’ flag isn’t found then check_dig will return a CRITICAL error.

If you’d like to keep track of the status of the patch on Sourceforge you can check it here.


My brush with greatness (aka Penn & Teller)

Heather & I were on vacation in Las Vegas the last few days, and one of the highlights was seeing the Penn & Teller magic show at The Rio.  In fact I was picked from the audience to assist with the very first trick they performed.  Here’s a rundown of what happened, first from my point of view and then a full description of what actually happened.

From my point of view

Penn started explaining that they needed somebody from the audience with a smart phone for their first trick, and that they were going to let that person use the phone to record video of the trick so they could see exactly how it was done.  I, along with hundreds of others in the audience held our phones up as Teller started walking up the isle.  He spotted my iPhone, came over, and asked if somebody else in the audience could call the phone while I was on stage.  I told him that Heather could do this, so he asked me to take my iPhone out of the case and come up on stage with him.  Penn asked me my name and also verified that somebody in the audience could call me.  I told him my girlfriend Heather could, so he asked Heather to make a quick call to verify it.  After my phone rang (and Penn made sure the audience heard it by holding it up to his microphone) they first started playing around with me a little.  They had me turn the video recorder on then held the phone up to record themselves and introduced themselves, introduced me, then panned across the audience.  They then said that as I’m on stage with some Vegas magicians that I undoubtedly wanted video of me and a famous magician.  At that point they brought out a short cardboard cutout of Kriss Angel and had me pose with it, which got lots of laughs from the audience.  After that bit of fun they had the cardboard Kriss Angel carried off stage and proceeded with the full illusion.

Penn picked up a large Starbucks coffee cup that had been sitting on the stage.  He placed my iPhone in the cup and had me look inside to verify it was there.  He put the top on the coffee cup but it fell so I bent to pick it up.  At this point I heard a loud roar of laughter from the audience but didn’t know why.  I gave the top back to him, he put it on the cup, then placed it on the stage floor in front of us.  After saying one or two things he promptly stomped on the cup with all his might, crushing it into a pancake.  Obviously the phone wasn’t in the cup any more.  Teller also walked up and tapped the crushed cup with his foot for good measure.

After a minute or so of vamping Penn asked Heather to call my phone, which she promptly did.  When the phone started ringing Penn asked the audience to point where the ringing was coming from.  Most of the audience was pointing towards the stage but I heard the phone back in the house somewhere so I pointed towards the audience. At that point the audience realized the ringing was coming from the house as well so they started pointing towards the center of the audience as well.  Penn drew everyone’s attention to an empty seat in the middle of the center section and asked the people sitting on either side to look under the seat since that’s where the ringing was coming from.  They pulled a styrofoam box  out from under the seat and passed it up through the audience to the stage and handed it to me.  Penn asked me to read the label on the box, which indicated it came from a seafood restaurant next door to the theater.  It was sealed with tape, which Penn asked me to pull off.  I opened up the box and found a fresh fish lying in a pile of ice.  Penn asked me what kind of fish it was but I didn’t recognize it so I just said something like “I don’t know.  A dead fish.” which got a great reaction from the audience.  Penn said it was a tilapia.  As Teller showed the fish in the box to the audience Penn handed me a microphone.  Teller placed the fish on a table that had been wheeled out as Penn had Heather call my phone.  Sure enough I heard the phone ringing from inside the fish and I held the microphone up close to the fish so that the audience could hear it as well.  Teller picked up a knife, cut the head off the fish, and there inside was a sealed plastic bag with my phone inside.

Penn & Teller have named this illusion “Cell fish”.

What the audience saw

The audience saw a little bit more than I did in one sense.  When Penn dropped the lid to the coffee cup he already had my iPhone inside the cup.  As I bent down to pick up the lid for him he apparently threw his hand up, causing the iPhone to fly up out of the cup behind us where Teller caught it in a big red plastic bucket.  This is what caused the audience to roar with laughter and why the phone wasn’t in the cup when Penn stomped on it.  Teller took the red bucket and suspended it from a cable that was raised up over my head, so the phone was suspended ten feet or so above me inside this bucket.

When Penn prompted Heather to call my phone this is why a lot of the audience pointed at the stage, assuming that the ringing was coming from the bucket suspended over my head.  But it was obvious that the sound was coming from the empty seat in the audience, so that’s the crux of the illusion as far as the audience goes – how did the phone magically move from the red bucket that was suspended above my head the entire time to inside the styrofoam box that they pulled out from underneath that seat?

I was actually able to find a couple videos on YouTube of this trick as the audience saw it.  Here are two of them – one has good video but lousy volume and the other has better volume than video so check them both out if you want:

How it worked (spoiler!)

If you don’t want to know how they did it then stop reading here as this explains exactly how it was all done.

When the Kriss Angel cardboard cutout was brought out on stage both Penn & Teller pulled out some fake jewelry to add to the cutout.  As they attached this fake jewelry (a large necklace and a glittery cross) Penn apparently slipped my iPhone into a pocket on the back of the cutout.  He swapped it for a fake iPhone that I think was already attached to the back of the cutout.  When the cutout was carried off stage my iPhone went with it.  Penn put the fake iPhone into the Starbucks cup then tossed that one into the red bucket as I was misdirected by the lid that he “accidentally” dropped onto the floor in front of me.  The audience thought it was my iPhone that flew through the air into the bucket, but it was obviously just a prop.

As Penn & Teller explained what they were going to do to the audience, a stagehand off stage retrieved my iPhone from the Kriss Angel cutout, put it in a plastic bag, and then put it inside the fish, which had been slit open on one side.  I never saw that side of the fish until after Teller had cut the head off, so I wouldn’t have known that the cut was already there. This fish simply was laid flat in the tray that was wheeled out to Penn & Teller.  It wouldn’t have been visible to the audience while in the tray.  The box that was found under an audience members seat and brought up on stage had a similar looking fish packed in ice, but that fish was physically attached to the box.  When Teller flips over the box as if he’s dumping the fish out onto the table he’s only dumping the ice out for effect. The prop fish in the box remains (and he hides it in the way he puts the box & lid down), and the fish containing the phone is left on the cutting board with all the ice.

They’ve obviously been doing this trick for a while since there’s a ton of video of it up on YouTube.  Just search for “Penn & Teller cell fish” and you’ll find them all.  Well here’s mine to add to the mix: