Can I use a Ruby handler in Sensu Go?

  1. What have you already tried? Please include links to gists and/or code blocks (if relatively small)

I’m using the sensu/sensu:master image with Docker. I’m trying to integrate Sensu Go with Google Chat. I’ve found this handler but it is written in Ruby for the 1.x version of Sensu.

Can I use this handler (or any handler writen in Ruby) with Sensu Go? Can I install a Ruby runtime inside the sensu-backend container? Or should I rewrite this handler in Go or another languaje?

  1. Tell us about your setup, this should include OS, version of Sensu, version of Sensu components (redis, rabbitmq), plugin versions (if applicable), anything special about your setup such as an airgapped network or strict ACLs

Sensu go inside a Docker container using the sensu/sensu:master image.

  1. Is there a Github issue related to your issue?


  1. Is there anything else that can help us effectively help you?

I’ve installed Ruby inside the sensu-backend container (apk add ruby) but when executing the handler I get this error:

/usr/local/bin # ./handler-hangouts-chat.rb 
Traceback (most recent call last):
        2: from ./handler-hangouts-chat.rb:10:in `<main>'
        1: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
/usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot load such file -- sensu-handler (LoadError)

@chgonzalez :wave: you can install a ruby runtime via . Ideally, the handler would be rewritten in Go so that it could be packaged as an asset, which would eliminate the need for installing the Ruby runtime and having to deal with any sort of PATH screwiness.


So I must install a ruby runtime inside the sensu-backend container?

It seems that sensu/sensu:latest is based on Alpine image. There isn’t an Alpine package in PackageCloud. Should I copy the instructions from and add it to my custom sensu-backend Dockerfile?


Yes, in order to run Ruby scripts, you’ll need a Ruby runtime within your container. You should be able to use the same Dockerfile.alpine you found without any problem!