How to configure prometheus.yml file to have multiple host

11,032 views
Skip to first unread message

sig...@gmail.com

unread,
Jun 15, 2017, 2:04:40 PM6/15/17
to Prometheus Users
Hi Team,

Greetings,

I may be asking the dumbest question here. I am trying to configure Prometheus to monitor docker swarm and the services running within the swarm. Can someone please help me with the configuration file. I am facing difficulty in adding the host to the prometheus.yml file. If I run the docker file with localhost its running fine. But if i add the swarm host ip then the docker itself is not starting.

Looking foeward for your help .

Regards,
SD

sig...@gmail.com

unread,
Jun 15, 2017, 2:11:33 PM6/15/17
to Prometheus Users
I am trying with the below configuration

root@prometheus:/prometheus-data# vim prometheus.yml
global:
  scrape_interval: 5s # By default, scrape targets every 15 seconds.
  evaluation_interval: 5s
  # Attach these labels to any time series or alerts when communicating with
  # external systems (federation, remote storage, Alertmanager).
  external_labels:
    monitor: 'Prometheus_Monitoring'

rule_files:

# 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'

    # Override the global default and scrape targets from this job every 5 seconds.
    scrape_interval: 5s

    static_configs:
      - targets:
           ['localhost:9090']

- job_name: 'docker-swarm-manager'

    # Override the global default and scrape targets from this job every 5 seconds.
    scrape_interval: 5s

    static_configs:
      - targets:
           ['10.140.0.3:8080']

Stuart Clark

unread,
Jun 15, 2017, 4:14:22 PM6/15/17
to sig...@gmail.com, Prometheus Users
What is port 8080 in this scenario?
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.

Ben Kochie

unread,
Jun 16, 2017, 3:55:57 AM6/16/17
to sig...@gmail.com, Prometheus Users
For docker swarm, you will need a bridge to handle service discovery.

Take a look at this option:


--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/1a7eb6bb-1c9a-496c-a76c-a2f763815961%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

sig...@gmail.com

unread,
Jun 18, 2017, 7:14:27 PM6/18/17
to Prometheus Users
i am using 8080 port to get the metrics from cadvisor .

Thanks Ben is there any native solution from prometheus without using adapter .

On Thursday, June 15, 2017 at 6:04:40 PM UTC, sig...@gmail.com wrote:

Ben Kochie

unread,
Jun 19, 2017, 1:28:22 AM6/19/17
to sig...@gmail.com, Prometheus Users
No, there is not currently native docker swarm support.  It is possible to use docker swarm's DNS server to do DNS-based discovery.

See the issue linked from the adapter readme:

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.

bharat...@gmail.com

unread,
May 2, 2018, 10:31:52 AM5/2/18
to Prometheus Users
Hi Sundeep,
        Can you please provide me your contact number if you don't mind,  I have few questions with Prometheus. Please help.
Reply all
Reply to author
Forward
0 new messages