prometheus/documentation/examples/custom-sd
David Leadbeater fba3e847dc
Check syntax of example configurations (#10753)
* Check syntax of example configurations

Fix a mistake in the hetzner and vultr configs.

Also it's easier not to fight the build system, and this will lint
example code, so ignore a lint issue in custom-sd.

Signed-off-by: David Leadbeater <dgl@dgl.cx>

* No need to import Makefile.common, it just complicates things

Signed-off-by: David Leadbeater <dgl@dgl.cx>
2022-05-26 18:17:21 +10:00
..
adapter Check syntax of example configurations (#10753) 2022-05-26 18:17:21 +10:00
adapter-usage refactor: move from io/ioutil to io and os packages (#10528) 2022-04-27 11:24:36 +02:00
README.md Fix typo (#4760) 2018-10-18 21:19:21 +01:00

README.md

Custom SD

Custom SD is available via the file_sd adapter, which can be used to access SD mechanisms that are not included in official Prometheus releases. The sd adapter outputs a file that can be passed via your prometheus.yml as a file_sd file. This will allow you to pass your targets to Prometheus for scraping without having to use a static config.

Example

This directory (documentation/examples/custom-sd) contains an example custom service discovery implementation as well as a file_sd adapter usage. adapter-usage contains the Discoverer implementation for a basic Consul service discovery mechanism. It simply queries Consul for all it's known services (except Consul itself), and sends them along with all the other service data as labels as a TargetGroup. The adapter directory contains the adapter code you will want to import and pass your Discoverer implementation to.

Usage

To use file_sd adapter you must implement a Discoverer. In adapter-usage/main.go replace the example SD config and create an instance of your SD implementation to pass to the Adapter's NewAdapter. See the Note: comments for the structs and Run function.