Yelp / sensu_handlers

Custom Sensu Handlers to support a multi-tenant environment, allowing checks themselves to emit the type of handler behavior they need in the event json
Apache License 2.0
75 stars 31 forks source link

api_client settings #75

Closed somic closed 8 years ago

somic commented 9 years ago

This is a fix for a tricky situation.

When sensu-api starts, it reads /etc/sensu/conf.d/api.json to find out its configuration - such as what port it should be listening on.

Sensu handlers however use this file to find out which sensu-api process they should be talking to - https://github.com/sensu-plugins/sensu-plugin/blob/master/lib/sensu-handler.rb#L84

This is bad for deployments that have many sensu-api processes running (for example behind haproxy) where it's better for sensu handlers to connect to some other (host, port), not ones from api.json

This change makes it happen via api_client_config param to sensu_handlers which I expect we could set in hiera to whatever we want handlers to connect to when they want to talk to API (it's expected to be a hash).

Internal ticket is OPS-8402

solarkennedy commented 9 years ago

Hmm. This seems like an ok solution. It is a little too bad there is this difference between the "configuration" for sensu-api and the "configuration" for the other components to "discover" that api. In large environments they are likely to be different.

Wfm. @bobtfish or @keymone do you guys have any second opinions or better implementations?

somic commented 8 years ago

ping @bobtfish @keymone

mks-m commented 8 years ago

agree with @solarkennedy. lets merge this and think where would we stick service discovery in future.

somic commented 8 years ago

@keymone I fixed return value from reset_api_settings! and addressed specs as you suggested.

mks-m commented 8 years ago

:ship: