Metricbeat Autodiscover - error parsing URL: empty host

Metricbeat Version used: 6.4.0
Kubernetes Version: 1.10

Hi,

I'm trying to get the Prometheus Collector working with Hints based autodiscovery in Kubernetes.

Unfortunately I always get the following Error:

ERROR [autodiscover] cfgfile/list.go:104 Error creating runner from config: 1 error: 1 error: host parsing failed for prometheus-collector: error parsing URL: empty host

I checked the start event for the host field and it's present.

Got a start event: map[host:100.123.3.45 port:1234 kubernetes:{"annotations":{"co":{"elastic":{"metrics/hosts":"${data.host}:10254","metrics/metricsets":"collector","metrics/module":"prometheus","metrics/period":"1m"}}}} config:[0xc42001f4a0] start:true], generated configs: [0xc42001f4a0]

My Configuration is the following:

metricbeat.autodiscover:
  providers:
    - type: kubernetes
      hints.enabled: true

I'm using the following Annotations:

      annotations:
        co.elastic.metrics/hosts: ${data.host}:10254
        co.elastic.metrics/metricsets: collector
        co.elastic.metrics/module: prometheus
        co.elastic.metrics/period: 1m
        prometheus.io/port: "10254"
        prometheus.io/scrape: "true"

Any ideas why this is happening?

Hi @simioa

That config should work, do you see any other start event without a host or a different error? A full log would help here

Best regards

Hi @exekias
I see two start events for the same container, but for different ports:

|2018-09-10T11: 33: 07.664Z|DEBUG|[autodiscover ]|autodiscover/autodiscover.go: 206|Got a stop event: map[config: [ 0xc420966ae0 ] stop: true host: 100.123.3.45 port: 8080 kubernetes: { "annotations": { "cni": { "projectcalico": { "org/podIP": "100.123.3.45/32" } }, "co": { "elastic": { "metrics/hosts": "${data.host}:10254", "metrics/metricsets": "collector", "metrics/module": "prometheus", "metrics/period": "1m" } }, "kubernetes": { "io/psp": "privileged" }, "prometheus": { "io/port": "10254", "io/scrape": "true" } } } ], generated configs: [ 0xc420966ae0 ]|
|---|---|---|---|---|
|2018-09-10T11: 33: 07.664Z|DEBUG|[autodiscover ]|autodiscover/autodiscover.go: 216|Config &{ {<nil> } <nil> 0xc420afb360 } is not running|
|2018-09-10T11: 33: 07.664Z|DEBUG|[autodiscover ]|autodiscover/autodiscover.go: 138|Reloading existing autodiscover configs after error|
|2018-09-10T11: 33: 07.664Z|DEBUG|[autodiscover ]|cfgfile/list.go: 70|Starting reload procedure, current runners: 0|
|2018-09-10T11: 33: 07.664Z|DEBUG|[autodiscover ]|cfgfile/list.go: 88|Start list: 1, Stop list: 0|
|2018-09-10T11: 33: 07.664Z|ERROR|[autodiscover ]|cfgfile/list.go: 104|Error creating runner from config: 1 error: 1 error: host parsing failed for prometheus-collector: error parsing URL: empty host|
|2018-09-10T11: 33: 07.664Z|DEBUG|[autodiscover ]|autodiscover/autodiscover.go: 206|Got a stop event: map[stop: true host: 100.123.3.45 port: 6443 kubernetes: { "annotations": { "cni": { "projectcalico": { "org/podIP": "100.123.3.45/32" } }, "co": { "elastic": { "metrics/hosts": "${data.host}:10254", "metrics/metricsets": "collector", "metrics/module": "prometheus", "metrics/period": "1m" } }, "kubernetes": { "io/psp": "privileged" }, "prometheus": { "io/port": "10254", "io/scrape": "true" } } } 0xc4203852c0 ] ], generated configs: [ 0xc4203852c0 ]|
|2018-09-10T11: 33: 07.664Z|DEBUG|[autodiscover ]|autodiscover/autodiscover.go: 216|Config &{ {<nil> } <nil> 0xc4205b4820 } is not running |
|2018-09-10T11: 33: 07.664Z|DEBUG|[autodiscover ]|autodiscover/autodiscover.go: 138|Reloading existing autodiscover configs after error |
|2018-09-10T11: 33: 07.664Z|DEBUG|[autodiscover ]|cfgfile/list.go: 70|Starting reload procedure, current runners: 0 |
|2018-09-10T11: 33: 07.664Z|DEBUG|[autodiscover ]|cfgfile/list.go: 88|Start list: 1, Stop list: 0 |
|2018-09-10T11: 33: 07.664Z|ERROR|[autodiscover ]|cfgfile/list.go: 104|Error creating runner from config: 1 error: 1 error: host parsing failed for prometheus-collector: error parsing URL: empty host |
|2018-09-10T11: 33: 07.664Z|DEBUG|[autodiscover ]|autodiscover/autodiscover.go: 164|Got a start event: map[host: 100.123.3.45 port: 8080 kubernetes: { "annotations": { "cni": { "projectcalico": { "org/podIP": "100.123.3.45/32" } }, "co": { "elastic": { "metrics/hosts": "${data.host}:10254", "metrics/metricsets": "collector", "metrics/module": "prometheus", "metrics/period": "1m" } }, "kubernetes": { "io/psp": "privileged" }, "prometheus": { "io/port": "10254", "io/scrape": "true" } } } config: [ 0xc4207f0ff0 ] start: true ], generated configs: [ 0xc4207f0ff0 ]|
|2018-09-10T11: 33: 07.664Z|DEBUG|[autodiscover ]|autodiscover/autodiscover.go: 237|Got a meta field in the event|
|2018-09-10T11: 33: 07.664Z|DEBUG|[autodiscover ]|autodiscover/autodiscover.go: 138|Reloading existing autodiscover configs after error|
|2018-09-10T11: 33: 07.664Z|DEBUG|[autodiscover ]|cfgfile/list.go: 70|Starting reload procedure, current runners: 0|
|2018-09-10T11: 33: 07.664Z|DEBUG|[autodiscover ]|cfgfile/list.go: 88|Start list: 1, Stop list: 0|
|2018-09-10T11: 33: 07.664Z|ERROR|[autodiscover ]|cfgfile/list.go: 104|Error creating runner from config: 1 error: 1 error: host parsing failed for prometheus-collector: error parsing URL: empty host|
|2018-09-10T11: 33: 07.665Z|DEBUG|[autodiscover ]|autodiscover/autodiscover.go: 164|Got a start event: map[config: [ 0xc42009edb0 ] start: true host: 100.123.3.45 port: 6443 kubernetes: { "annotations": { "cni": { "projectcalico": { "org/podIP": "100.123.3.45/32" } }, "co": { "elastic": { "metrics/hosts": "${data.host}:10254", "metrics/metricsets": "collector", "metrics/module": "prometheus", "metrics/period": "1m" } }, "kubernetes": { "io/psp": "privileged" }, "prometheus": { "io/port": "10254", "io/scrape": "true" } } } ], generated configs: [ 0xc42009edb0 ]|
|2018-09-10T11: 33: 07.665Z|DEBUG|[autodiscover ]|autodiscover/autodiscover.go: 237|Got a meta field in the event|
|2018-09-10T11: 33: 07.665Z|DEBUG|[autodiscover ]|autodiscover/autodiscover.go: 138|Reloading existing autodiscover configs after error|
|2018-09-10T11: 33: 07.665Z|DEBUG|[autodiscover ]|cfgfile/list.go: 70|Starting reload procedure, current runners: 0|
|2018-09-10T11: 33: 07.665Z|DEBUG|[autodiscover ]|cfgfile/list.go: 88|Start list: 1, Stop list: 0|
|2018-09-10T11: 33: 07.665Z|ERROR|[autodiscover ]|cfgfile/list.go: 104|Error creating runner from config: 1 error: 1 error: host parsing failed for prometheus-collector: error parsing URL: empty host|
|2018-09-10T11: 33: 17.665Z|DEBUG|[autodiscover ]|autodiscover/autodiscover.go: 138|Reloading existing autodiscover configs after error|
|2018-09-10T11: 33: 17.665Z|DEBUG|[autodiscover ]|cfgfile/list.go: 70|Starting reload procedure, current runners: 0|
|2018-09-10T11: 33: 17.665Z|DEBUG|[autodiscover ]|cfgfile/list.go: 88|Start list: 1, Stop list: 0|
|2018-09-10T11: 33: 17.665Z|ERROR|[autodiscover ]|cfgfile/list.go: 104|Error creating runner from config: 1 error: 1 error: host parsing failed for prometheus-collector: error parsing URL: empty host|

Unfortunately I can not see any other Errors in the log

Best regards

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.