Tuesday, February 21, 2012

Stop nagios downtime alert spam

If you're like me and find the nagios alerts declaring when scheduled downtime starts and ends annoying, try wrapping your notify command in an if block:

command_line if [ "$NOTIFICATIONTYPE$" = "PROBLEM" -o "$NOTIFICATIONTYPE$" = "RECOVERY" -o "$NOTIFICATIONTYPE$" = "ACKNOWLEDGEMENT" ]; then /usr/bin/printf "%b" "***** Nagios  *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $DATETIME$\n\nAdditional Info:\n\n$OUTPUT$" | /bin/mail -s "** $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$; fi

Thursday, February 2, 2012

rails gotcha

Rails has improved my web development experience, no doubt but not without a few gotcha's. Somehow I missed this one, so hope this helps if anyone else did too:

One of the useful features of rails is the asset pipeline. Very flexible and designed to improve performance of rails apps overall - good stuff!

My preference is to pre-compile assets in my dev environment and simply copy these static resources to the proper destination (presumably to a cached store in your environment, CDN, mod_cache, etc). What wasn't apparent (obvious) from the docs is that you need to clean after compilation

rake assets:precompile
rake assets:clean

in your dev environment, otherwise bad things will happen. In my case, a javascript event handler was installed twice for the same event and caused some very odd behavior but difficult to troubleshoot. I wasted an entire afternoon fishing this one out, hopefully will save you some trouble - clean after precompile!

Thursday, January 26, 2012

meta-blog

Dear ethos,

As this is my first blog, I thought it appropriate to blog about blogging. Firstly, introductions, my name is Reed Sandberg, I code and engineer systems for a living - hello ethos!
I hope to participate in the amazing tech community out there who take the time to shine a light in dark places they've been, where few others will venture and even less will write to tell about it. They've been invaluable to me at many a deadline where I just needed to get something to work and simply didn't have another two hours to RTFM (in many cases, poor/no docs or sometimes not even knowing WHAT to RTFM). So hopefully my random posts (mostly technical subjects) will help some other poor slob at 4am who's against a deadline or recovering a database/system supporting millions of customers/user and who's next actions may affect hundred of jobs at their company and all they need is that one magic configuration directive or block of code that will keep everything afloat. Thanks to all who've been there for me, and thanks to the (creators of the) bots that will organize/index these words...