Collect metrics from a Prometheus server to telegraf

1.3k views Asked by At

I have a prometheus server running on a K8s instance and telegraf on a different cluster. Is there some way to pull metrics from the prometheus server using telegraf? I know there is telegraf support for scraping metrics from prometheus clients but I am looking to get these metrics from the prometheus server.

Thanks

2

There are 2 answers

1
Miguel de Vasconcelos On

there is this thing inside data sources, called scrapers, its a tab, you just need to put the url of the server. I am trying to configure this using cli, but i can only do it with gui

0
Navneet Reddy On

There is a prometheus remote write parser (https://github.com/influxdata/telegraf/tree/master/plugins/parsers/prometheusremotewrite), I think it will be included in the 1.19.0 release of Telegraf. If you want to try it out now you can use a nightly build. (https://github.com/influxdata/telegraf#nightly-builds)

Configure your prometheus remote write towards telegraf and configure the input plugin to listen for traffic on the port that you configured. For convenience sake, have the output plugin configured to file so you can see the metrics in a file, almost immediately