sumologic-prometheus-scraper icon indicating copy to clipboard operation
sumologic-prometheus-scraper copied to clipboard

Unable to scrape metrics from a service with multiple endpoints

Open Reifier opened this issue 6 years ago • 0 comments

I currently have a service that has to exposes 2 ports for different purposes:

kind: Service
apiVersion: v1
metadata:
  name: metrics-collector
  namespace: metrics-collector
spec:
  selector:
    name: metrics-collector
  ports:
    - name: prometheus
      port: 80
      targetPort: 9102
    - name: statsd
      port: 8135
      protocol: UDP
      targetPort: 9125

I have this in a target that corresponds to the service:

103           "url": {
104             "service": "metrics-collector",
105             "namespace": "metrics-collector",
106             "protocol": "http"

Seems like collector is trying to pick up metrics from 9125 and of course it can’t:

HTTPConnectionPool(host='10.136.4.137', port=9125): Max retries exceeded with url: /metrics (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f26a38a72e8>: Failed to establish a new connection: [Errno 111] Connection refused',))

How do we tell the collector which port to use? I tried to put in an additional

"port": directive, but:


Error: Invalid value for "targets" / "1" / "url" / "port": extra keys not allowed```
I don’t think it’s supported.

Reifier avatar Feb 28 '19 18:02 Reifier