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

Issue with deregister handler, api config #6

Closed
jaykumar-jnpr opened this issue May 30, 2016 · 4 comments
Closed

Issue with deregister handler, api config #6

jaykumar-jnpr opened this issue May 30, 2016 · 4 comments

Comments

@jaykumar-jnpr
Copy link

jaykumar-jnpr commented May 30, 2016

My api config looks like following , I am running api behind a loadbalancer

{ "api": { "host": "10.0.0.11:45670", "port": 4567, "bind": "10.0.0.10" } }

Looks like deregister is not working as expected

log snippet

@runningman84
Copy link

runningman84 commented Jun 1, 2016

Your host definition looks strange to me, why are you putting the port into the host?

https://sensuapp.org/docs/0.23/platforms/sensu-on-ubuntu-debian.html#api-standalone-configuration

@jaykumar-jnpr
Copy link
Author

jaykumar-jnpr commented Jun 1, 2016

I am running Sensu API behind a loadbalancer, with LB port 45670. 10.0.0.11 is the LB IP.

I guess the question is, how do I specify a port for remote API endpoint.

@cwjohnston
Copy link
Contributor

@jaykumar-jnpr hi, thanks for raising this issue.

The sensu-api process and the sensu-plugin handler class both rely on the api configuration scope in ways that seem to confound your expectations here.

Specifically, the deregistration handler uses the api_request method provided by the sensu-plugin gem. When executed, the handler will use the values from the api configuration scope for constructing the API endpoint URL. On the other hand, the sensu-api process uses the values from the api configuration scope to determine which port, ip address to listen on, and so on.

I understand that you are running one or more instances of the API behind a load balancer, and that the API instances are running on port 4567 while the load balancer is listening on port 45670.

If it is the case that your sensu-api instances are running on the same instances as your sensu-server, I would suggest that you consider using the defaults for the api:

{
  "api": {
    "host": "127.0.0.1",
    "bind": "0.0.0.0",
    "port": 4567
  }
}

When the API is actually running locally, having the server route API requests through a load balancer adds complexity that may prove problematic. As HA seems to be your aim, you may want to look at configuring your sensu-api and sensu-server instances to use redis replication and sentinels for high availability.

If it is not the case that your sensu-api instances run on the same machine as sensu-server, then you can continue using your existing config on the API instances and configure the sensu-server instances to target the load balancer directly, providing the load balancer host and port in the api configuration scope. Example sensu-server api configuration:

{
  "api": {
    "host": "10.0.0.11",
    "port": 45670
  }
}

@majormoses
Copy link
Member

closing due to inactivity

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

No branches or pull requests

4 participants