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

Health Check not being copied to Consul #235

Closed
tokenrain opened this issue May 25, 2017 · 2 comments
Closed

Health Check not being copied to Consul #235

tokenrain opened this issue May 25, 2017 · 2 comments

Comments

@tokenrain
Copy link
Contributor

tokenrain commented May 25, 2017

I am first trying out marathon-consul (Thanks for writing this BTW) and all is working great except that I can not seem to get health checks copied from Marathon to Consul.

I have a very simple marathon app with 1 defined health check. The apps gets properly registered in Consul but the health check does not make it over. I was hoping you could point me in the right direction to look at things

Here is the health check in Marathon

[
  {
    "protocol": "HTTP",
    "portIndex": 0,
    "gracePeriodSeconds": 300,
    "intervalSeconds": 15,
    "timeoutSeconds": 5,
    "maxConsecutiveFailures": 3,
    "ignoreHttp1xx": false
  }
]

Here is the logs from marathon-consul.log

time="2017-05-25T22:55:16Z" level=debug msg="Received event" EventType="api_post_event" OriginalTimestamp="2017-05-25T22:55:16.743Z" 
time="2017-05-25T22:55:16Z" level=debug msg="Malformed request" error="api_post_event is not supported" 
time="2017-05-25T22:55:16Z" level=debug msg="Received event" EventType="group_change_success" OriginalTimestamp="2017-05-25T22:55:16.744Z" 
time="2017-05-25T22:55:16Z" level=debug msg="Malformed request" error="group_change_success is not supported" 
time="2017-05-25T22:55:16Z" level=debug msg="Received event" EventType="add_health_check_event" OriginalTimestamp="2017-05-25T22:55:16.743Z" 
time="2017-05-25T22:55:16Z" level=debug msg="Malformed request" error="add_health_check_event is not supported" 
time="2017-05-25T22:55:16Z" level=debug msg="Malformed request" error="http: request body too large" 
time="2017-05-25T22:55:16Z" level=debug msg="Malformed request" error="http: request body too large" 
time="2017-05-25T22:55:16Z" level=debug msg="Malformed request" error="http: request body too large" 
time="2017-05-25T22:55:16Z" level=debug msg="Received event" EventType="status_update_event" OriginalTimestamp="2017-05-25T22:55:16.9Z" 
time="2017-05-25T22:55:16Z" level=info msg="Got StatusEvent" Id=nbs-spyre-foobarbaz.3844994a-419d-11e7-8c90-90b11c151479 TaskStatus="TASK_RUNNING" 
time="2017-05-25T22:55:16Z" level=debug msg="Not handled task status" Id=nbs-spyre-foobarbaz.3844994a-419d-11e7-8c90-90b11c151479 taskStatus="TASK_RUNNING" 
time="2017-05-25T22:55:31Z" level=debug msg="Received event" EventType="health_status_changed_event" OriginalTimestamp="2017-05-25T22:55:31.918Z" 
time="2017-05-25T22:55:31Z" level=info msg="Got HealthStatusEvent" Id=nbs-spyre-foobarbaz.3844994a-419d-11e7-8c90-90b11c151479 
time="2017-05-25T22:55:31Z" level=debug msg="Asking Marathon for /nbs-spyre-foobarbaz" Location="localhost:8800" 
time="2017-05-25T22:55:31Z" level=debug msg="Sending GET request to marathon" Location="localhost:8800" Protocol=http Uri="/v2/apps//nbs-spyre-foobarbaz?embed=apps.tasks" 
time="2017-05-25T22:55:31Z" level=warning msg="Could not parse provided path: " Address=10.123.14.26 Id="/nbs-spyre-foobarbaz" error="parse : empty url" 
time="2017-05-25T22:55:31Z" level=debug msg="Creating Consul client" Address="10.123.14.26:8501" BasicAuthEnabled=false Scheme=https SslVerificationEnabled=false Timeout=3s TokenEnabled=true 
time="2017-05-25T22:55:31Z" level=info msg=Registering Address=10.123.14.26 EnableTagOverride=false Id="nbs-spyre-foobarbaz.3844994a-419d-11e7-8c90-90b11c151479_nbs-spyre-foobarbaz_31318" Name=nbs-spyre-foobarbaz Port=31318 Tags=[marathon main-fbb marathon-task:nbs-spyre-foobarbaz.3844994a-419d-11e7-8c90-90b11c151479] 
time="2017-05-25T22:55:31Z" level=debug msg="Malformed request" error="http: request body too large" 
time="2017-05-25T22:55:31Z" level=debug msg="Malformed request" error="http: request body too large" 
@janisz
Copy link
Contributor

janisz commented May 26, 2017

@tokenrain Thanks for reporting. From your logs it looks like it's a problem with empty path.
For quick fix I recommend setting health check path to /.

The real fix for this is easy. If health check path is empty then we should replace it with /. This should take place just before parsing the path in consul/consul.go. Would you like to prepare fix for it? I'll be happy to merge it.

@tokenrain
Copy link
Contributor Author

Adding the Path on my end did indeed fix this. Thanks! - I have submitted a pull request. As I have never written a line of Go yet please feel free to make any fixes that are needed.

janisz pushed a commit that referenced this issue May 29, 2017
Fixes a regression introduced in 65c47ca.
When healthchekc has not defined path in Marathon
then we should map it to root path (/).

Fixes: #235
@janisz janisz closed this as completed in 5920d94 May 29, 2017
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

2 participants