1
0
Fork 0
mirror of https://codeberg.org/icewind/prometheus-mdns-rs.git synced 2026-06-03 09:54:21 +02:00
mDNS service discovery for prometherus
  • Rust 50.4%
  • Nix 49.6%
Find a file
2021-01-30 00:24:39 +01:00
src use mdns 1.1 2020-01-31 22:12:39 +01:00
.dockerignore dockerfile, readme and licence 2019-09-08 17:19:23 +02:00
.gitignore init repo 2019-09-07 23:16:55 +02:00
Cargo.lock tokio 1.0 2021-01-30 00:24:39 +01:00
Cargo.toml tokio 1.0 2021-01-30 00:24:39 +01:00
Dockerfile dockerfile, readme and licence 2019-09-08 17:19:23 +02:00
LICENSE-APACHE dockerfile, readme and licence 2019-09-08 17:19:23 +02:00
LICENSE-MIT dockerfile, readme and licence 2019-09-08 17:19:23 +02:00
README.md dockerfile, readme and licence 2019-09-08 17:19:23 +02:00

mDNS service discovery for Prometheus

Discovers mDNS/ZeroConf/Bonjour service announcements under _prometheus-http._tcp for ad-hoc discovery of devices on LAN networks.

Usage

Run the service discovery daemon

prometheus-mdns-sd-rs /etc/prometheus/mdns-sd.json

Configure prometheus to use the output file

- job_name: mdns-sd
  scrape_interval: 30s
  scrape_timeout: 10s
  metrics_path: /metrics
  scheme: http
  file_sd_configs:
  - files:
    - /etc/prometheus/mdns-sd.json
    refresh_interval: 5m

Advertising services

An example of advertising services using the esp8266 arduino sdk

if (!MDNS.begin(hostString)) {
    Serial.println("Error setting up MDNS responder!");
}
MDNS.addService("prometheus-http", "tcp", 80);
MDNS.addServiceTxt("prometheus-http", "tcp", "name", prometheus_name);

Credits

Wholly inspired by prometheus-mdns-sd by Morten Siebuhr