1

I am trying to figureout how to allow prometheus to add targets based on hostname and not IP. Currently i am using Netdata as exporter but do not find any information on how to allow hostname of each host to be available in prometheus.

Vaishnav
  • 611
  • 1
  • 9
  • 23

2 Answers2

1

If you cannot add the targets to Prometheus manually (either IP or hostname, both is supported) you have to use some kind of service discovery. Some methods included in Prometheus, for example AWS EC2 or Docker Swarm.

trallnag
  • 2,041
  • 1
  • 17
  • 33
  • Thanks. What i am trying to achieve is i have a metrics called instance_info that has the hostname in it in netdata like below. ``` netdata_info{instance="development.mainshop.tv",application="netdata",version="v1.26.0"} 1 1606202908287 ``` What i am trying to achieve is to use this metric in prometheus scrape config to relabe or add a label to that particular host like hostname etc. – Vaishnav Nov 24 '20 at 08:00
  • Is the metric `netdata_info` exposed on `development.mainshop.tv`? If so you have a circular dependency going on – trallnag Nov 24 '20 at 09:27
0

A possible solution to your problem could be to use remote-write so that each Netdata writes to the Prometheus node and not the other way around.

Moreover, you could use something like Consul for service discovery.