Prometheus auto discovery using Bonjour

411 views
Skip to first unread message

patri...@gmail.com

unread,
Apr 7, 2017, 8:04:58 AM4/7/17
to Prometheus Users
Hi,

I'm trying to figure out a way to get auto discovery working for my targets running the Prometheus Node Exporter. My targets already implement Bonjour, responding to _axis-video._tcp.local. I just cannot figure out a way to get those auto discovered by Prometheus. I read somewhere that DNS-SD should be possible to use in a zero conf environment for this, i just cannot figure out how to get things going. Any ideas?

Thanks a lot in advance!

Patrik

Julius Volz

unread,
Apr 7, 2017, 8:20:14 AM4/7/17
to patri...@gmail.com, Prometheus Users
Just reading briefly about Bonjour, it says it uses mDNS (multicast service discovery), which we don't support yet: https://github.com/prometheus/prometheus/issues/2537

But as the last comment on the issue points out, Morten built an external mDNS service discovery support that you can use with Prometheus's file_sd discovery method: https://github.com/msiebuhr/prometheus-mdns-sd


--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/5384487b-d595-48aa-8a38-ba6415d0a425%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

mrx

unread,
Apr 7, 2017, 10:03:30 AM4/7/17
to Julius Volz, Prometheus Users
Ah, nice. When i have configured the file_sd thingy like so:

scrape_configs:
- job_name: 'overwritten-default'

  file_sd_configs:
  - names: ['tgroups/*.json']

Would that detect new files in tgroups as well or just keep track of those json files that already exist in the tgroups folder?

The reason i ask is that i was thinking of keeping each target in a separate file to allow more flexibility concerning tagging.

Patrik Iselind

Julius Volz

unread,
Apr 7, 2017, 10:09:43 AM4/7/17
to mrx, Prometheus Users
It'll pick up new files as well.

mrx

unread,
Apr 7, 2017, 10:15:02 AM4/7/17
to Julius Volz, Prometheus Users
Interesting, then it seems that there is a fact error in https://prometheus.io/blog/2015/06/01/advanced-service-discovery/#custom-service-discovery

While Prometheus will not apply any malformed changes to files, it is considered best practice to update your files atomically via renaming, as we do in our example. It is also recommended to split larger amounts of target groups into several files based on logical grouping.
 
In the code they write to tgroups/target_groups.json.new which according to you would be picked up just as well as the tgroups/target_groups.json which it's renamed to later. The tgroups/target_groups.json.new file need to be outside the tgroups folder for the suggestion to work. Have i understood this correctly?

Patrik Iselind

Julius Volz

unread,
Apr 7, 2017, 10:24:04 AM4/7/17
to mrx, Prometheus Users
Nope, the glob in that blog post only matches 'tgroups/*.json', which does not include .json.new.

mrx

unread,
Apr 7, 2017, 11:37:48 AM4/7/17
to Julius Volz, Prometheus Users
Ah, right. Thanks for your time, I'll take a look at everything you've told me.

Patrik
Reply all
Reply to author
Forward
0 new messages