Configuring handler extensions


#1

I’ve got a handler extension that should forward event info to another service. I’d like to be able to configure this handler with a settings hash, so I’m not hardcoding servernames and ports into my handler. When looking at this page, it indicates that there’s a settings hash that can be used by an extension. Unfortunately, the page describing the settings is a 404, and no amount of Googling has turned up any real-world examples of a configurable extension - just hardcoded ones.

Where is this settings hash populated from, and how should I be using it?

Thanks in advance


#2

The hash contains all of the sensu settings from a deep merge.

Most of the extensions in the community repo use the settings has in
some way to get their configuration:

Here is an exact example of flapjack reading its configuration:

I've opened a PR to try to address the lack of docs:

···

On Wed, Oct 22, 2014 at 5:05 PM, George Lester <glester491@gmail.com> wrote:

I've got a handler extension that should forward event info to another
service. I'd like to be able to configure this handler with a settings hash,
so I'm not hardcoding servernames and ports into my handler. When looking at
this page, it indicates that there's a settings hash that can be used by an
extension. Unfortunately, the page describing the settings is a 404, and no
amount of Googling has turned up any real-world examples of a configurable
extension - just hardcoded ones.

Where is this settings hash populated from, and how should I be using it?

Thanks in advance


#3

Thanks! That sent me on the right track. I didn’t realize it included everything from the conf.d/ directory, that’s way easier than I expected.

···

On Wednesday, October 22, 2014 8:06:23 PM UTC-7, Kyle Anderson wrote:

The hash contains all of the sensu settings from a deep merge.

Most of the extensions in the community repo use the settings has in

some way to get their configuration:

https://github.com/sensu/sensu-community-plugins/tree/6ebe82174e2070d008f1474dbf27b22b83c1f972/extensions

Here is an exact example of flapjack reading its configuration:

https://github.com/sensu/sensu-community-plugins/blob/6ebe82174e2070d008f1474dbf27b22b83c1f972/extensions/handlers/flapjack.rb#L45

I’ve opened a PR to try to address the lack of docs:

https://github.com/sensu/sensu-docs/pull/142

On Wed, Oct 22, 2014 at 5:05 PM, George Lester glest...@gmail.com wrote:

I’ve got a handler extension that should forward event info to another

service. I’d like to be able to configure this handler with a settings hash,

so I’m not hardcoding servernames and ports into my handler. When looking at

this page, it indicates that there’s a settings hash that can be used by an

extension. Unfortunately, the page describing the settings is a 404, and no

amount of Googling has turned up any real-world examples of a configurable

extension - just hardcoded ones.

Where is this settings hash populated from, and how should I be using it?

Thanks in advance