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

marathon unsupported protocol scheme or panic: runtime error: index out of range #1511

Closed
samek opened this Issue Mar 29, 2016 · 4 comments

Comments

Projects
None yet
4 participants
@samek
Copy link

samek commented Mar 29, 2016

Hi,

since we've have a large amount of tasks in marathon first thing I wanted to try with prometheus was getting data out of marathon.

our marathon version is 0.15.2.

config

global:
  scrape_interval:     5s
  evaluation_interval: 5s

scrape_configs:

- job_name: service-marathon
  marathon_sd_configs:
  - servers: 
    - "10.231.0.136:8080"
    - "10.231.0.137:8080"
    - "10.231.0.235:8080"

output

prometheus, version 0.17.0 (branch: release-0.17, revision: e11fab3)
  build user:       fabianreinartz@macpro
  build date:       20160302-17:47:15
  go version:       1.5.3
INFO[0000] Loading configuration file prometheus.yml     source=main.go:202
INFO[0000] Loading series map and head chunks...         source=storage.go:299
INFO[0000] 0 series loaded.                              source=storage.go:304
INFO[0000] Listening on :9090                            source=web.go:239
INFO[0000] Starting target manager...                    source=targetmanager.go:114
INFO[0000] Target manager started.                       source=targetmanager.go:168
WARN[0000] No AlertManager configured, not dispatching any alerts  source=notification.go:165
ERRO[0030] Error while updating services: Get 10.0.0.136:8080/v2/apps/?embed=apps.tasks: unsupported protocol scheme ""  source=marathon.go:66

I've tried adding http in-front of each host where marathon runs

global:
  scrape_interval:     5s
  evaluation_interval: 5s

scrape_configs:

- job_name: service-marathon
  marathon_sd_configs:
  - servers: 
    - "http://10.231.0.136:8080"
    - "http://10.231.0.137:8080"
    - "http://10.231.0.235:8080"

but the output is now

prometheus, version 0.17.0 (branch: release-0.17, revision: e11fab3)
  build user:       fabianreinartz@macpro
  build date:       20160302-17:47:15
  go version:       1.5.3
INFO[0000] Loading configuration file prometheus.yml     source=main.go:202
INFO[0000] Loading series map and head chunks...         source=storage.go:299
INFO[0000] 0 series loaded.                              source=storage.go:304
INFO[0000] Starting target manager...                    source=targetmanager.go:114
INFO[0000] Listening on :9090                            source=web.go:239
WARN[0000] No AlertManager configured, not dispatching any alerts  source=notification.go:165
panic: runtime error: index out of range

goroutine 215 [running]:
github.com/prometheus/prometheus/retrieval/discovery/marathon.targetForTask(0xc820e778d0, 0x0, 0x0)
    /Users/fabianreinartz/repos/src/github.com/prometheus/prometheus/retrieval/discovery/marathon/conversion.go:70 +0x1cf
github.com/prometheus/prometheus/retrieval/discovery/marathon.targetsForApp(0xc820e77b38, 0x0, 0x0, 0x0)
    /Users/fabianreinartz/repos/src/github.com/prometheus/prometheus/retrieval/discovery/marathon/conversion.go:60 +0x18b
github.com/prometheus/prometheus/retrieval/discovery/marathon.createTargetGroup(0xc820e77b38, 0xc8207163f0)
    /Users/fabianreinartz/repos/src/github.com/prometheus/prometheus/retrieval/discovery/marathon/conversion.go:36 +0x33
github.com/prometheus/prometheus/retrieval/discovery/marathon.AppsToTargetGroups(0xc82012e1a0, 0x30)
    /Users/fabianreinartz/repos/src/github.com/prometheus/prometheus/retrieval/discovery/marathon/conversion.go:28 +0xdc
github.com/prometheus/prometheus/retrieval/discovery.(*MarathonDiscovery).fetchTargetGroups(0xc820010c00, 0x0, 0x0, 0x0)
    /Users/fabianreinartz/repos/src/github.com/prometheus/prometheus/retrieval/discovery/marathon.go:103 +0xb1
github.com/prometheus/prometheus/retrieval/discovery.(*MarathonDiscovery).Sources(0xc820010c00, 0x0, 0x0, 0x0)
    /Users/fabianreinartz/repos/src/github.com/prometheus/prometheus/retrieval/discovery/marathon.go:46 +0x5b
github.com/prometheus/prometheus/retrieval.(*prefixedTargetProvider).Sources(0xc820010c40, 0x0, 0x0, 0x0)
    /Users/fabianreinartz/repos/src/github.com/prometheus/prometheus/retrieval/targetmanager.go:374 +0x66
github.com/prometheus/prometheus/retrieval.(*TargetManager).Run(0xc8201c0d70)
    /Users/fabianreinartz/repos/src/github.com/prometheus/prometheus/retrieval/targetmanager.go:125 +0x2c2
created by main.Main
    /Users/fabianreinartz/repos/src/github.com/prometheus/prometheus/cmd/prometheus/main.go:168 +0x138b


....

I've read that marathon is in beta for prometheus, which version is supposed to work ?
Thanks.

@brian-brazil brian-brazil added the bug label Mar 31, 2016

@fabxc

This comment has been minimized.

Copy link
Member

fabxc commented Apr 6, 2016

The code indicates that prepending the scheme was correct. What seems to be a problem is that the JSON returned from your marathon API doesn't specify any port for a task. Thus it panics.

The access to the port should be checked to not throw a panic of course.
Generally, why does your task not specify a port. Is this expected behavior in the Marathon API? What would be a proper default port to chose?

@fabxc fabxc added this to the v1.0.0 milestone Apr 25, 2016

@fabxc fabxc added kind/bug and removed bug labels Apr 28, 2016

@fretboarder

This comment has been minimized.

Copy link

fretboarder commented Jun 3, 2016

I'm having the same problem with a Marathon instance that is accessible via https. A quick fix would be highly appreciated!

@fabxc

This comment has been minimized.

Copy link
Member

fabxc commented Jun 23, 2016

The panic on missing port was fixed #1722 and is already in the latest release.

@fabxc fabxc closed this Jun 23, 2016

@lock

This comment has been minimized.

Copy link

lock bot commented Mar 24, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Mar 24, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.