Question regarding sensuctl plugin development


While looking at the Sensu Plugin Tool on github I noticed that it was possible to create plugins for sensuctl (at least there’s a template for it :slight_smile: )
Is there any explanation/example around to see how we can “extend” sensuctl?
Is there any pre-requisite (like only sensuctl version greater than 5.18 or things like this)


1 Like

I started working on something recently that might make a good example:

Some things I noted along the way:

  • Sensu CLI plugin development UX is quite nice thanks to the sensuctl env command, as it helps emulate the CLI plugin execution environment. All of the environment variables made available in the command plugin’s execution environment are also available via eval $(sensuctl env). This also makes it possible to run any plugins you develop as standalone programs like: eval $(sensuctl env) && --flag foo
  • I was able to prototype sensuctl plugins using a simple shell script (this even works with shell scripts that execute multiple sensuctl commands).
  • Don’t forget that the executable must be called via bin/entrypoint in the resulting Sensu Asset. I haven’t tested using a symlink for this, but I suspect that should work.

I hope this helps!

I will look into this


We’ve also penciled time for a sensuctl command plugin hour during the upcoming virtual Sensu Summit, to give people an opportunity to do a little watch and learn. Watch out for more information on proposed Summit workshop topics this week on discourse.

For sure I will look into this too :slight_smile:
I already wrote a check and a handler in go using your template, so next step for me is the sensuctl part :slight_smile:
Lets see what I can do :smiley:

1 Like

It’d be great to have some people attempt to build their own command ahead of the summit so we can get some feedback on the templated process. The command plugin is a pretty new and powerful concept.

For check and handler, if you already “played” a bit with events in order to create your plugins (I did some in perl mainly), using the template is pretty easy.
Especially it’s making it pretty easy to manipulate events and the various fields :smiley:

I’m not yet using the part for automatic publishing to bonsai, but the rest is very nice :smiley:

1 Like