Magnus Axelqvist

Magnus Axelqvist

No fluff, just stuff

Let TellStick tell you when you’re in trouble

Here follows a crash course how-to visualize the health of your CI server or live system.

  1. Buy a TellStick from Kjell & Company,  http://www.kjell.com/content/templates/shop_main_details.aspx?item=50200&path=&sms_ss=favorites&at_xt=4d336e97c742b49d,1.
  2. Buy a remote switch from Kjell & Company, http://www.kjell.com/content/templates/shop_main_details.aspx?item=50219&path=&sms_ss=favorites&at_xt=4d336ec00712cf8f,0.
  3. Buy your favorite lava lamp/warning light that will indicate the status of your project/live system.
  4. Install the TellStick software as described at http://www.telldus.se.
  5. Add the configuration for your remote switch to /etc/tellstick.conf (see example below). Remember to configure the remote switch in the same way.
  6. Write a program/script that turn on/turn off the remote switch depending on the status of your project (see example below)
  7. Optional, add the program to crontab in order to check the status at regular intervals (see example below).
  8. Done ūüôā


tellstick.conf

deviceNode = "/dev/tellstick"
device {
  id = 1
  name = "enterprise"
  protocol = "risingsun"
  model = "codeswitch"
  parameters {
    house = "1"
    unit = "1"
  }
}



check_enterprise.sh

#!/bin/sh

success=`wget -qO – –http-user=<user> –http-password=<pwd> –auth-no-challenge https://<base>/hudson/job/enterprise/lastBuild/  | grep ‘Success’`
failed=`wget -qO – –http-user=<user> –http-password=<pwd> –auth-no-challenge https://<base>/hudson/job/enterprise/lastBuild/  | grep ‘Failed’`

if [ ! -z "${success}" ]; then
        tdtool –on ‘enterprise’
fi

if [ ! -z "${failed}" ]; then
        tdtool –off ‘enterprise’
fi



crontab entry:

* 8-16 * * 1-5 /home/magnus/bin/cron/check_enterprise.sh



A good day at work ūüôā