How execute custom ruby handler using pipe in sensu GO

Hi team,

I have ruby handler in sensu core (older version). I used pipe to execute that handler to forward some events in json format. How can i achieve same thing in SENSU GO.

Please help!


So most likely what is happening is your custom ruby handler isn’t able to cope with the new event format used in Sensu Go. You’ll most likely need to adapt your handler to consume Sensu Go events. In the meantime, you should be able to continue using this version of the handler by mutating the Sensu Go event into a json that is compatibile with Sensu Core events. You have a couple of different options:

  1. Is your custom ruby handler based sensu-plugin? if it is you probably only need to update the sensu-plugin gem dependency to version 4.x and make use of the new event mapping commandline argument provided as a mix-in. When active, the handler will map Sensu Go event json into Sensu Core json filling in critical json elements
  1. If your custom handler isn’t using sensu-plugin you can use the mutator-sensu-go-into-ruby.rb mutator that comes with the updated sensu-plugin gem. It’s a stand-alone mutator command.

I find its really helpful to use the sensuctl event info <entity> <check> --format json command when building Sensu Go pipelines. I can see exactly what is going to be piped into the mutator and/or handler and test operation against an existing event.

1 Like