Nagios Monitoring of Directories

I had a recent occurrence at work that caused me to look around for a tool to monitor a directory for any changes made. Since there didn’t seem to be anything out there, I created a check called dirchanged. It looks at all the files in a directory and creates an sha256 has of the names and contents of the files. That hash is compared to a known value to determine if there have been any changes made.

There are a couple of issues with this check specifically that it doesn’t look into subdirectories and that the hash for comparison is passed on the command line from within the Nagios configuration files. I think the first issue will be fixed soon enough w/ a flag to indicate if the directory tree is to be traversed. The second issue is more cumbersome in that the hash value has to be stored somewhere. I’m not yet certain that putting it in the Nagios configuration files is better than putting it somewhere on the target file system. From the security standpoint, having the check not stored on the target file system is better, much less chance of it being changed by bad guys.

I’ll let it run for a while and see how it behaves and if changes are warranted.

Down, moved and back once again

I didn’t realize that the site was down, that’s not good.

I discovered this when I started to migrate to a new server on Digital Ocean. I like their service level, server configurations, and very reasonable costs. Plus the fact that they run everything on SSD makes it all nice and blazingly fast ;-)

With the site now fully migrated, hopefully things will be back to normal. And that I’ll be posting again. So many ideas and projects to share! And I need to get a Nagios monitor in place to let me know the next time the site goes sideways.

Chasing a Rollover Crash

I was reminded recently that when writing code in C, you have to take care to understand how variable are going to be used when declaring them. I was had just finished working on the code used to control the fire effects at The Crucible‘s Maker Faire 2013 booth when the system just seemed to come to a halt. That’s not quite what it was supposed to do.

The system was designed to have 3 24′ towers as the central part of the booth. On top of the towers would be accumulator based fire effects – a 24″ round sphere w/ a 2″ exhaust port, a 9″ x 24″ oblong tank w/ a massive 3″ pneumatic solenoid / exhaust and three smaller accumulators based on old fire extinguishers. The solenoids on the fire effects would all be controlled with an Arduino. The idea was that there would be no direct user interaction this year but the system would run automatically. Plug in the Arduino and away we go.

The code would run one of a number of possible sequences, pause between 30 and 90 seconds, randomly run the next sequence, pause . . . And it did that, most of the time. A couple of times after starting up the Arduino, several sequences would run and then nothing else would happen. Made me wonder if I had crashed the Arduino.

I added some Serial.print statements to the code to dump out details on what was happening internally and ran the code again. This time it ran without issue for almost 2 hours before coming to a halt. Looking at the output on the serial console showed that that pause value was -31438. Of course everything came to a halt, the system was attempting to pause negative 31,438 milliseconds! This didn’t make much sense until I reread the Arduino docs and saw that ints are 16 bit values. Of course it rolled over into a negative number.

Digging into the code I realized that I had used int’s in several places where an unsigned long was needed. Once fixed, all was right with the world and the system went on to work just fine for both days of the Maker Faire.

Perhaps I need to start writing these systems on a Raspberry Pi where I can use Python ;-)

Fire Cauldron

For the Crucible’s 2013 Soirée, I created a medium sized fire cauldron that was part of the performance.

Fire CauldronThe cauldron was created from an old halon tank from a fire suppression system. A ring was welded around the outside as a handle to allow the dancers to manipulate it without coming in contact with the fire. And a ring over the top allows the cauldron to be hung from a 19′ cable.

Inside the center of the cauldron is a kevlar wick sitting in a small pill box. The kevlar is doused with a measured amount of white gas and lit.

After the first light, I was concerned about the cable and connections living inside the fire. The cable was shortened and a  4′ chain added in its place. This moved the cable out of the fire and made the effect much safer.