How to configure Prometheus scrape targets when running in Docker on a Synology NAS

1,348 views
Skip to first unread message

anders....@gmail.com

unread,
Aug 11, 2018, 4:01:17 PM8/11/18
to Prometheus Users
Hi,

I have installed Docker on my Synology DS918+ NAS and added the prom/prometheus package and got Prometheus up and running. From the web interface in Prometheus I can click on "Status" in the menu bar and then "Configuration" to reveal the following default config:

global:
  scrape_interval: 15s
  scrape_timeout: 10s
  evaluation_interval: 15s
alerting:
  alertmanagers:
  - static_configs:
    - targets: []
    scheme: http
    timeout: 10s
scrape_configs:
- job_name: prometheus
  scrape_interval: 15s
  scrape_timeout: 10s
  metrics_path: /metrics
  scheme: http
  static_configs:
  - targets:
    - localhost:9090

From the web interface it is not possible to change what is written in the configuration file which means I am not able to add my desired scrape targets. How can I access the configuration file and edit it? Please keep in mind that I am very new to Prometheus and I have never used it or Docker before.

I appreciate any help I can get. Thank you!

//Anders

Chris Marchbanks

unread,
Aug 11, 2018, 4:20:48 PM8/11/18
to anders....@gmail.com, Prometheus Users
Hello Anders,

The prometheus configuration is a file on disk that you will need to mount into your docker container. Please see the installation documentation for docker (https://prometheus.io/docs/prometheus/latest/installation/#using-docker), especially the "Volumes & bind-mount" section for instruction on how to do this.

Let me know if you have more questions,

--
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/1dfad32a-cd8e-43c8-b5a8-1705a75c4bda%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Chris Marchbanks | Engineer
FreshTracks.io - Intelligent Alerting for Kubernetes and Prometheus

anders....@gmail.com

unread,
Aug 11, 2018, 5:27:51 PM8/11/18
to Prometheus Users
Dear Chris,

Thank you for your answer. My problem right now is that I do not know the exact path to the configuration file. I would also like to know how to mount this folder in the docker container?
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To post to this group, send email to promethe...@googlegroups.com.

Chris Marchbanks

unread,
Aug 12, 2018, 1:02:16 AM8/12/18
to anders....@gmail.com, Prometheus Users
You will have to create a local copy of a configuration file on your computer, then use the -v flag in your docker command to bind-mount your local copy of the configuration file into your running docker container. This is done using the -v docker command with the syntax "-v <path-to-local-configuration-file>:<destination-path-in-docker>". You can read more about using bind-mounts in the docker documentation: https://docs.docker.com/storage/bind-mounts/

The example in the Prometheus documentation I linked uses "-v /tmp/prometheus.yml:/etc/prometheus/prometheus.yml" which translates to mount a configuration file located on your computer at "/tmp/prometheus.yml" into the docker container at "/etc/prometheus/prometheus.yml", which is the default location prometheus looks for a configuration file.

Hope that helps,

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/0adbaf55-deda-481a-a7f5-4c79c131f607%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages