A prometheus confd setup that automatically extracts all metrics of containers using labels. No configuration needed.
Just launch a new Stack in rancher.
docker build -t marcbachmann/rancher-prometheus-config:1.0.3 .
- Run container as sidekick in rancher
- Mount volumes of sidekick into prometheus server
docker run -d --name prometheus-config marcbachmann/rancher-prometheus-config
docker run -d --volumes-from prometheus-config --name prometheus prom/prometheus -config.file=/etc/prometheus/prometheus.yml
This is quite easy, you can add new exporters based on labels on services, just configure it using the labels. All the labels are optional.
-
prometheus.port
, based on that we enable the exporter -
prometheus.job_name
, optional -
prometheus.metrics_path
-
prometheus.scrape_interval
-
prometheus.scrape_timeout
-
prometheus.label.foo
, to add a labelfoo
to all metrics of that exporter -
prometheus.metric_relabel_pattern
, only supportscadvisor
andnode
andblackbox
.cadvisor
addscontainer_id
,service_stack
,service_name
,instance
(host_ip) labels to it's metrics based on the rancher labels.node
addsinstance
(host ip),host_labels_*
,host_name
labels to all metrics
- Improve the relabeling of the node exporter. Add host labels onto node_last_seen or node_boot_time events