hit counter


My development logbook

How to Get Sensu Hipchat Plugin to Work

I encountered two issues when I want to deploy the hipchat notification handler.

Firstly it throws an exception of ‘Connection refused’. But api.hipchat.com is reachable. I have verified by running curl against the v2 api.

    $ cat /tmp/t.json |sudo /opt/sensu/embedded/bin/ruby  /etc/sensu/handlers/notification/hipchat.rb -j /etc/sensu
    /opt/sensu/embedded/lib/ruby/2.0.0/net/http.rb:878:in `initialize': Connection refused - connect(2) (Errno::ECONNREFUSED)
            from /opt/sensu/embedded/lib/ruby/2.0.0/net/http.rb:878:in `open'
            from /opt/sensu/embedded/lib/ruby/2.0.0/net/http.rb:878:in `block in connect'
            from /opt/sensu/embedded/lib/ruby/2.0.0/timeout.rb:52:in `timeout'
            from /opt/sensu/embedded/lib/ruby/2.0.0/net/http.rb:877:in `connect'
            from /opt/sensu/embedded/lib/ruby/2.0.0/net/http.rb:862:in `do_start'
            from /opt/sensu/embedded/lib/ruby/2.0.0/net/http.rb:851:in `start'
            from /opt/sensu/embedded/lib/ruby/2.0.0/net/http.rb:1367:in `request'
            from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-plugin-1.1.0/lib/sensu-handler.rb:85:in `api_request'
            from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-plugin-1.1.0/lib/sensu-handler.rb:120:in `stash_exists?'
            from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-plugin-1.1.0/lib/sensu-handler.rb:132:in `block (2 levels) in filter_silenced'
            from /opt/sensu/embedded/lib/ruby/2.0.0/timeout.rb:66:in `timeout'
            from /opt/sensu/embedded/lib/ruby/2.0.0/timeout.rb:97:in `timeout'

It turns out all sensu plugin has a dependeny on the sensu api. I did not start the sensu apu when I tested, and hence the exception.

Then I got a json config file related problem:

    $ cat /tmp/t.json |sudo /opt/sensu/embedded/bin/ruby  /etc/sensu/handlers/notification/hipchat.rb -j /handlers/notification/hipchat.json
    /etc/sensu/handlers/notification/hipchat.rb:44:in `handle': undefined method `[]' for nil:NilClass (NoMethodError)
            from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-plugin-1.1.0/lib/sensu-handler.rb:55:in `block in <class:Handler>'

-j does not work as I expected. The script actually expects the .json configuration in the /opt/sensu/conf.d

Sudo and Glob

Files are there but I cannot delete them

    $ sudo ls /etc/sensu/conf.d/handlers
    email.json  handler.json  hipchat.json

    $ sudo rm /etc/sensu/conf.d/handlers/*.json
    rm: cannot remove ‘/etc/sensu/conf.d/handlers/*.json’: No such file or directory

It is because my current login has no permission to read /etc/sensu/conf.d/handlers and so glob failed

This takes care of the problem:

    $ sudo bash -c 'rm /etc/sensu/conf.d/handlers/*.json'

Using Chef Sudo Cookbook

If you want to LWRP to define a sudo user, do not use

   include_recipe 'sudo'

It will blow away your default /etc/sudoers

Toastmaster Speech 4


  • The transition from introduction to first point can be done better

  • Hand clapping

  • Use of Jargon such as ‘proxy’

  • Repeated use of the word Innovation

  • Subtitle can be improved

Self accessment

Original version of the speech lasts almost 8 min. In real delivery the time is 5.30 minutes. A bit too fast.


Innovation has never got so much attention before. Innovation is a key driver of wealth creation. You probably already have an example of it in your pocket right now. Yes, nothing can highlight the impact of innovations better than Apple’s iPhone.

The success of iPhone actually combines several innovations in different area. They include supplier chain management, logistic, retails, brand management and product design.

So what it takes to be innovative? What can we do to come up with an truly innovative product? If you want to start the next Apple, the next Google or the next Tesla, You want to listen to these research results.

Size matters

Big corporate is not an ideal institute for innovation. Who would have thought? It is not so much a failure of the corporate because it is exactly what a corporate is designed for: avoid mistake! A big corporate has a series of command in place because new idea or product must be cross-examined and studied before they will receive a green light. They will do numerous marketing researches to decide if a product idea is viable.

When a product has to go through so many focus groups and polling, it is usually hardly innovative anymore. As Henry Ford has once put it famously: If you ask what a customer want out of a car, they will tell you a faster carriage!

That’s why over past decades, R&D effort of giant like AT&T, Xerox or IBM has little to show for as commercial products. Don’t get me wrong, their lab has produced brilliant ideas that change the world. For example Apple and Windows’ Graphical User Interface and Mouse is essentially a Xerox’s invention. But as an organisation, Xerox failed to capitalise the idea.

2) Gender matters

In another research, the researchers want to find out what makes a team great, or as they call it the Collective Intelligence. In two studies with about 700 people, working in groups of two to five, the researchers founds some factors that explains a group’s performance on a wide variety of tasks. This collective intelligence is not strongly correlated with the average or maximum individual intelligence of group members but is correlated with the average social sensitivity of group members and the equality in distribution of conversational turn-taking. And they are usually correlated to the proportion of females in the group.

In the tech startup world, teams are made up of usually predominantly socially awkward males (like me Exhibit A). Actually time and time again females have proven they are as competent if not better than their counterparts in engineering and computer science. If you are starting a new tech startup you should seriously rethink the prevailing bias against hiring females technical staff.

3) The mix matters

Have you thought about what a broadway musical successful? Is it the script or the score? Is it the genre? Is it the actors and actress? Or beautiful set and costume? After looking into how a company is formed, researchers find that actually it has a lot to do with the connections between the members: For a successful company, there is usually a healthy mix of, on the one hand, experienced veterans who have known and worked with each other for a long time, and on the other hand, relatively young and new members. Once this factor is identified, it just makes a lot of sense: The old and existing networks provides stability and experience to the team when the new kids on block comes and offer fresh angles and new inspiration. If the balance tilt either way, you will have either a company that may keep repeating its past success or a team of rookies who are struggling to get the basic right.

Gem Install Hipchat Problem 2

Error message:

   [2015-02-26T11:49:52+00:00] ERROR: gem_package[hipchat] (zeetings::sensu_resource line 27) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '2'
   ---- Begin output of /opt/sensu/embedded/bin/gem install hipchat -q --no-rdoc --no-ri -v "1.4.0" ----
   STDERR: ERROR:  Could not find a valid gem 'hipchat' (= 1.4.0), here is why:
      Unable to download data from https://rubygems.org/ - no such name (https://rubygems.org/quick/Marshal.4.8/hipchat-1.4.0.gemspec.rz)
   ERROR:  Possible alternatives: hipchat
   ---- End output of /opt/sensu/embedded/bin/gem install hipchat -q --no-rdoc --no-ri -v "1.4.0" ----
   Ran /opt/sensu/embedded/bin/gem install hipchat -q --no-rdoc --no-ri -v "1.4.0" returned 2
   [2015-02-26T11:49:52+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)