Show Docker Daemon metrics in Prometheus

This commit is contained in:
Matthias Thubauville 2017-10-16 17:25:36 +02:00
Родитель cf247e41bd
Коммит 5f4e72f79d
3 изменённых файлов: 17 добавлений и 7 удалений

Просмотреть файл

@ -250,14 +250,17 @@ In this section, we'll start Prometheus and use it to scrape it's own health.
. Create a text file `prometheus.yml` and use the following content . Create a text file `prometheus.yml` and use the following content
+ +
``` ```
# A scrape configuration scraping a Node Exporter and the Prometheus server
# itself.
scrape_configs: scrape_configs:
# Scrape Prometheus itself every 5 seconds. # Scrape Prometheus itself every 5 seconds.
- job_name: 'prometheus' - job_name: 'prometheus'
scrape_interval: 5s scrape_interval: 5s
static_configs: static_configs:
- targets: ['localhost:9090'] - targets: ['localhost:9090']
# Scrape Docker-Daemon every 10s
- job_name: 'docker-for-mac'
scrape_interval: 10s
static_configs:
- targets: ['docker.for.mac.localhost:9323']
``` ```
+ +
This configuration file scrapes data from the Prometheus container which will be started subsequently on port 9090. This configuration file scrapes data from the Prometheus container which will be started subsequently on port 9090.
@ -311,6 +314,13 @@ image::prometheus-metrics6.png[]
Multiple graphs can be added this way. Multiple graphs can be added this way.
==== Plot the Docker daemon internal metrics
The experimental feature on the Docker deamon we enabled before, exposes various metrics about the daemon itself.
For example the `engine_daemon_events_total` metric provides the number of events which happend on the Docker Daemon (see also the `docker system events` command).
image::prometheus-metrics17.png[]
=== Node health === Node health
In this section, we'll start Prometheus node exporter that will publish machine metrics. Then we'll use Prometheus to scrape its health information about the node running Docker. In this section, we'll start Prometheus node exporter that will publish machine metrics. Then we'll use Prometheus to scrape its health information about the node running Docker.
@ -358,6 +368,7 @@ scrape_configs:
static_configs: static_configs:
- targets: - targets:
- 'localhost:9090' - 'localhost:9090'
- job_name: 'node resources' - job_name: 'node resources'
dns_sd_configs: dns_sd_configs:
- names: ['tasks.node'] - names: ['tasks.node']
@ -851,4 +862,3 @@ The green bar indicates that the data source was added successfully.
. Enter the following Prometheus query expressions in the query field. The graphs will referesh in a few seconds and will look like as shown: . Enter the following Prometheus query expressions in the query field. The graphs will referesh in a few seconds and will look like as shown:
+ +
image::grafana-metrics4.png[] image::grafana-metrics4.png[]

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 91 KiB

После

Ширина:  |  Высота:  |  Размер: 120 KiB

Двоичные данные
developer-tools/java/chapters/images/prometheus-metrics17.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 110 KiB