prometheus_docker_sd

command module
v0.0.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2023 License: MIT Imports: 15 Imported by: 0

README

Prometheus Docker Discovery for single host (no swarm)

Vanilla

Prometheus have built-in discovery of Docker containers with docker_sd_configs, see https://prometheus.io/docs/prometheus/latest/configuration/configuration/#docker_sd_config.

See examples/vanilla for a working example.

This flavour

The trouble with docker_sd_configs is when a container have multiple exposed ports, there will be multiple targets present for the same container. This application solves that scenario.

See examples/discovery for a working example.

For a container to be exported:

  • add container label 'prometheus_job' with the job name you want as value.
  • the container must be in the configured target network (defaults to 'metrics-net').
  • the container must have at least 1 expose port. Public ports are ignored. This may already be set in the Docker image.
Container label Description
prometheus_job Add target. Set job name to value. Containers without this label will be ignored.
prometheus_<key> Add <key>' to output labels
prometheus_scrape_port Overrules address scrape port. Should be set when the container have multiple exposed ports.
prometheus_scrape_interval Override the scrape interval. Optional.
prometheus_scrape_timeout Override the scrape timeout. Optional.
prometheus_scrape_path Override metrics path. Optional.
prometheus_scrape_scheme Override scheme. Optional.

Metrics should indicate if a container has the 'prometheus_job' label set, but not included in targets.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
examples
app1 Module
web

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL