Jenkins : "Red Bear Alert!" - The Hudson Bear Lamps

Xtreme feedback devices can really help to introduce the concept of continous integration to a team of programmers.

At a customer's site, I installed three colored lamps in the form of cute gummibears (about 40cm in height) hooked up to Ethernet-controlled power sockets. The lamps are placed on a widely visible shelf.

Hudson signature color scheme


See the movie! Hudson Bear Lamps on YouTube!

First we followed the official blue-yellow-red "Hudson signature color scheme" with the following meaning of the colors:

Blue bear

All projects built successfully.

Yellow bear

At least one project is unstable, but not project failed.

Red bear

At least one project failed.

Any blinking

At least one build in progress.

While in theory this corresponds nicely with the on-screen display of Hudson, in practice it drives programmers nuts, having blinking bears in their field of view for minutes (depening on the build duration).

Traffic light color scheme

So we came up with a more conservative "traffic light" scheme without blinking bears:

Green bear

All projects built successfully.

Yellow bear

At least one build in progress.

Red bear

At least one project failed or is unstable.

Yes, this slightly differs from the official blue-yellow-red "Hudson signature colors" - but the "traffic light" scheme is understood almost intuitively.

The science behind the bears

No matter who sees the bears for the first time: The reaction identifies him or her either as gal, guy, or geek.


  • Cuuuuuute!
  • I want one of these at my desk, too! Can I adopt one? (Geek in the background: No!)
  • Hey, can you make the red bear light up too? (Same geek in the background: Nooooooo!)


  • You geeks - what are these girly bears good for?
    Customers / Managers / Colleagues sometimes ask about the meaning of the fancy bears - especially when witnessing a color switch. This is an ideal opportunity to explain how much your company cares about software quality... ;O)


  • How do you switch the power?
  • How do you get status information from Hudson?
  • How much did it cost?

O.k. You've read so far. So you qualified as geek and deserve answers.

How do you switch the power?

Ethernet-controlled power sockets are power sockets with typically 2-8 outlets and an embedded web server running on an own IP address. Usually the sockets offer some sort of CGI-based control options. For example, the following URLs switch on/off a specific power outlet (the actual parameters vary from manufacturer to manufacturer):

http://your.socket?F1=0        // Switch socket outlet 1 on.
http://your.socket?F2=1        // Switch socket outlet 2 off.

If you are more software inclined than a hardware geek, the nice thing about these ready-made power sockets is that you can buy them safety-certified. Then you don't have to worry about burning down your house when running your unit tests and switching high voltage currents...

There are also USB-controlled power sockets. Currently, they are a way cheaper alternative to Ethernet-controlled sockets.

On the other hand, they will require a PC with an USB port running all the time if you can't connect the USB-controlled socket directly to the Hudson server. Even if you have an outdated PC or laptop that you can recycle for this purpose, the energy cost savings for Ethernet-controlled sockets (they typically need just 3-5 Watts) will charge off within the first year.

How do you get status information from Hudson?

Is there a specific "bears plugin" needed for Hudson? Not at all! Hooking up Hudson is actually the simplest part. While Hudson exposes the outcome of terminated builds (successful or not) as RSS feed, it also offers an XML-based API for status information out of the box. Basically you just append /api/xml to the URL of the page you are viewing in your browser. Then you get the same information in an XML-based, machine-processable format.

For example, the following URL will return you the dashboard as XML file:


All you have to do, is to get this URL periodically, scan for status colors and send the corresponding command URLs to your Ethernet-controlled socket. We use an extended version of the short PHP script below that runs continously on the Hudson server (we added logging and error handling in the real thing - but to get the idea, a shorter example serves better).

// URL to Hudson server dashboard (redered as XML)
define("HUDSON_XML_URL", "http://your.hudson.server/api/xml");
// URL to Ethernet-based power socket
define("NETCONTROL_URL", "http://your.socket");

// Power socket configuration
define("GREEN_BEAR", 1);
define("YELLOW_BEAR", 2);
define("RED_BEAR", 3);
define("SWITCH_ON", 0);
define("SWITCH_OFF", 1);

// Enter infinite loop.
while (true) {
  // Retrieve XML data from Hudson.
  $myxml = file(HUDSON_XML_URL);

  // Scan for status colors. Note: No real XML parsing necessary here ;O).
  $isBuilding = strpos(implode($myxml), "_anime</color>") > 0  ? true : false ;
  $isBroken = strpos(implode($myxml), "<color>red") > 0  ? true : false ;

  // Set yellow "Is Building" status light.
  if($isBuilding) {
    switchSocket(YELLOW_BEAR, SWITCH_ON);
  } else {
    switchSocket(YELLOW_BEAR, SWITCH_OFF);

  // Set green/red "Build Outcome" status lights.
  if($isBroken) {
    switchSocket(GREEN_BEAR, SWITCH_OFF);
    switchSocket(RED_BEAR, SWITCH_ON);
  } else {
    switchSocket(RED_BEAR, SWITCH_OFF);
    switchSocket(GREEN_BEAR, SWITCH_ON);

  // Sleep some time...

function switchSocket($socket, $command) {
  // Use syntax of your specific socket manufacturer here.
  file(NETCONTROL_URL . "?F$socket=$command");


How much did it cost?

  • The bear lamps are some 10 EUR each,
  • an Ethernet-controlled socket (3 outlets) some 120 EUR,
  • Hudson is free,
  • and the fun... priceless!


trafficlight_scheme.jpg (image/jpeg)
hudson_scheme.jpg (image/jpeg)