Categorygithub.com/bredtape/prometheus_docker_sd
modulepackage
0.0.16
Repository: https://github.com/bredtape/prometheus_docker_sd.git
Documentation: pkg.go.dev

# 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 labelDescription
prometheus_jobAdd target. Set job name to value. Containers without this label will be ignored.
prometheus_<key>Add <key>' to output labels
prometheus_scrape_portOverrules address scrape port. Should be set when the container have multiple exposed ports.
prometheus_scrape_intervalOverride the scrape interval. Optional.
prometheus_scrape_timeoutOverride the scrape timeout. Optional.
prometheus_scrape_pathOverride metrics path. Optional.
prometheus_scrape_schemeOverride scheme. Optional.

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

# Packages

No description provided by the author
No description provided by the author

# Constants

No description provided by the author

# Structs

No description provided by the author