Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sensu-api service should subscribe to sensu::rabbitmq::config class #433

Closed
fatmcgav opened this issue Oct 15, 2015 · 6 comments
Closed
Assignees

Comments

@fatmcgav
Copy link

It appears that currently the sensu-api service [1] doesn't subscribe to the sensu::rabbitmq::config class, which means that it doesn't get restarted automatically if the rabbitmq config is changed.

From my testing I believe it should do, otherwise the API doesn't work.

[1] https://github.com/sensu/sensu-puppet/blob/master/manifests/api/service.pp#L34-L39

@jaxxstorm
Copy link
Contributor

The API doesn't actually need any interaction with rabbitmq, so I don't think this is needed.

Closing, reopen if you feel this is in error.

@stevenviola
Copy link

I looks like the API does do something with rabbitmq (in Sensu 0.26.5), and not refreshing the sensu-api after updating rabbitmq.json can leave sensu-api in a broken state. To test this, I modified rabbitmq.json to connect to the wrong port and restarted the sensu-api. In the sensu-api logs were these messages:

{"timestamp":"2016-12-30T18:32:20.081877+0000","level":"error","message":"[amqp] Detected TCP connection failure: Errno::ECONNREFUSED"}
{"timestamp":"2016-12-30T18:32:23.848442+0000","level":"info","message":"api response","request":{"remote_address":"172.31.13.168","user_agent":"Go-http-client/1.1","method":"GET","uri":"/stashes","query_string":null,"body":""},"status":500,"content_length":59}

Running puppet put the right information back into rabbitmq.json, and triggered the sensu-server and sensu-client to be restarted, but not the sensu-api. This left sensu-api in a broken, returning 500 status for every request, until it was manually restarted to pick up the rabbitmq changes.

I'm not sure why sensu-api needs to connect to rabbitmq, but for whatever reason, it looks like sensu-api should be restarted whenever rabbitmq.json is updated to pull in the new values. Adding the api service to subscribe to sensu::rabbitmq::config, as @fatmcgav suggests, fixes the issue for me

@jaxxstorm
Copy link
Contributor

@portertech can you comment on this? Does the API need a connection to rabbitmq?

@jaxxstorm jaxxstorm reopened this Dec 30, 2016
@cwjohnston
Copy link
Contributor

@jaxxstorm the API establishes a connection to the transport. Uses for this connection include:

  • reporting number of consumers for /info and /health endpoints
  • publishing ad-hoc check requests via /request endpoint

@ghoneycutt
Copy link
Collaborator

@jeffmccune This also looks very similar to ae48859

jeffmccune added a commit to jeffmccune/sensu-puppet that referenced this issue Jul 11, 2017
Without this patch the Sensu API service doesn't reload itself when RabbitMQ
configuration changes occur.  This patch addresses the problem by adding a
relationship between the rabbitmq configuration class and the service resource.

Note, both sensu::rabbitmq::config and sensu::redis::config are in the catalog
regardless of which is actually being configured.

Resolves sensu#433
ghoneycutt added a commit that referenced this issue Jul 11, 2017
(#433) Reload Service[sensu_api] on RabbitMQ config changes
@ghoneycutt
Copy link
Collaborator

Thanks everyone!

Fix released in v2.19.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants