prometheus

How to add multiple scrape URLs to prometheus.yml?


I want to use Grafana/Prometheus to collect metrics from components. Grafana, Prometheus, node_exporter, Wildfly are running fine.

I want to collect metrics from:

How to configure it in prometheus.yml? I tried the following, but this does not work:

scrape_configs:
  - job_name: "prometheus"
    metrics_path: "/metrics"
    static_configs:
      - targets: ["localhost:9100", "localhost:9990", "localhost:9090"]
        labels:
            group: 'system'
  - job_name: "application"
    metrics_path: "/application/rest/metrics"
    static_configs:
      - targets: ["localhost:8080"]
        labels:
            group: 'application'

Solution

  • Please try this configuration:

    scrape_configs:
      - job_name: prometheus
        static_configs:
          - targets: ['localhost:9090']
      - job_name: node_exporter
        static_configs:
          - targets: ['localhost:9182']
      - job_name: wildfly
        static_configs:
          - targets: ['localhost:9990']
      - job_name: application
        metrics_path: '/application/rest/metrics'
        static_configs:
          - targets: ['localhost:8080']