26 February, 2013

brief facebook commentary in response to I'm supposed to give a talk on software stuff to college students Wednesday. Kind of a "things that would have helped to know before my first job." What would you put in there?:

possibly they already read "the mythical man month". now they just have to learn to actually believe that most of what he says in that book is relevant; most of what you do in colege is one person doing a project. almost nothing in paid software is that, even when you're the only programmer; use version control goddamnit; if 5 different people/groups have written some thing, and you don't like any of them and are going to write your own thing but "do it right this time", well there's 5 examples of people who tried to do it right and failed so you're feeling pretty cocky, aren't you? when your boss asks you "can we do X" and your answer is "yes (given 10 years and 50 developers)", your boss heards "yes (i can have it tomorrow)".
also, accept that you will not write bugfree code. its not a sign of being a pussy. its how code is. write tests. or, if you think you can write bugfree code, bet someone your next paycheck that its bugfree, if you're so confident. use the machine as your helper for that , and ge tin the habit of 1000 unit tests run while you go take a shit. i mean, before you commit your code.
(run the unit test son the other pussy's commits at least, and find the bugs they committed and make it seem like you are amazing)

18 February, 2013

london traffic pirate announcement

In-car radios in the UK often have a feature called Traffic Announcement, transmitted as part of RDS, which lets the current channel (or another non-radio input such as CD/mp3 player) be interrupted with a traffic programme being broadcast on another channel.

Driving on the M25 and listening to BBC Radio 1 the other week, the traffic flag clicked on and switched me to receiving some dodgy pirate radio station!

I wondered if this was accidental. Maybe not so accidental though - it turns out many of the pirate radio stations round London transmit RDS.

11 February, 2013

nagios and andrews and arnold SMS notification

Andrews and Arnold sells me a VOIP service which also lets me send SMSes over HTTP.

I wanted to make Nagios send out notifications this way, in addition to the existing email-based notification.

First I need a Nagios command definition to send out the notifications:

define command {
  command_name cqx-notify-service-by-sms
  command_line /var/cqxmon/secret-aa-curl 0781234567 "$NOTIFICATIONTYPE$: $HOSTALIAS$/$SERVICEDISPLAYNAME$ is $SERVICESTATE$"
That will invoke my sender script to send a message to phone number 0781234567.

Then we need the sender script. It has my password hardcoded in it (ick! but that could be replaced with a < redirect).





echo $@ > $TMPFILE
curl --get --form-string username=0300300300 \
              --form-string password=XYZ123 --form-string destination=$TARGET \
              --form message=\<$TMPFILE \

The redirect via TMPFILE is because I was having trouble with spaces on the commandline that I couldn't seem to escape around.

Then I need to modify the Nagios contact definition for myself to call the cqx-notify-service-by-sms command in addition to the regular email notifier. In the contact definition for myself:

service_notification_commands cqx-notify-service-by-email, cqx-notify-service-by-sms
That will work for services. For hosts, you'll have to create a cqx-notify-host-by-sms command which does something similar, and add that to the contact notification_commands.

Nagios has a number of other contact fields that could be used to allow the target number to be configured per contact. I'll get round to that at some point; without making those changes, the above will only let you notify a single SMS number.