Added support to auto discovery with SRV DNS registry (#60)

* Added support to auto discovery witih SRV

The yaml configuration has been modified to suport srv parameters.
Now the name is taken form the router identity to allow dynamic
discovery of devices based on SRV registry.

* Corrected format

* feat(collector): Added support to use custom DNS

* feat(collector): get default dns server from resolv.conf

* Remove getIdentity on the static config devices
This commit is contained in:
wolmi
2020-02-04 04:03:45 +01:00
committed by GitHub
parent 75b5f8be36
commit d723fdfe38
5 changed files with 121 additions and 5 deletions

View File

@@ -53,6 +53,19 @@ devices:
port: 8999
user: prometheus2
password: password_to_second_router
- name: routers_srv_dns
srv:
record: _mikrotik._udp.example.com
user: prometheus
password: password_to_all_dns_routers
- name: routers_srv_custom_dns
srv:
record: _mikrotik2._udp.example.com
dns:
address: 1.1.1.1
port: 53
user: prometheus
password: password_to_all_dns_routers
features:
bgp: true
@@ -64,6 +77,11 @@ features:
optics: true
```
If you add a devices with the `srv` parameter instead of `address` the exporter will perform a DNS query
to obtain the SRV record and discover the devices dynamically. Also, you can specify a DNS server to use
on the query.
###### example output
```