Eureka Service Discovery

29 views
Skip to first unread message

Marco Schmucki

unread,
Nov 6, 2020, 9:23:27 AM11/6/20
to Prometheus Users
Hi all

I've implemented the eureka_sd_configs:

# my global config
global:
  scrape_interval:     60s # Default is every 1 minute.
  evaluation_interval: 60s # The default is every 1 minute.

# Alertmanager configuration
alerting:
  alertmanagers:
  - static_configs:
    - targets:
      # - alertmanager:9093

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: 'prometheus'
    static_configs:
    - targets: ['localhost:9090']
  # eureka service discovery
  - job_name: 'eureka'
    metrics_path: '/actuator/prometheus'
    eureka_sd_configs:


The services  are shown under the register "target".
But one service is not correct, because this service takes the default "__meta_eureka_app_instance_port", but it should take the "__meta_eureka_app_instance_metadata_management_port".


1. prometheus config:

- source_labels: [__address__, __meta_eureka_app_instance_metadata_prometheus_port]
  action: replace
  regex: ([^:]+)(?::\d+)?;(\d+)
  replacement: $1:$2
  target_label: __address__


2. service application properties:

eureka.instance.metadataMap[prometheus.port]=9091  


How can I change the port of one of the services?

Many thanks for your feedback.

Regards,
Marco

Marco Schmucki

unread,
Nov 6, 2020, 11:16:17 AM11/6/20
to Prometheus Users
I was able to get it worked.

I've changed the following:

--> OLD not working (with FQDN):

eureka_sd_configs:

--> NEW is working (with docker-container-name):

eureka_sd_configs:

Reply all
Reply to author
Forward
0 new messages