Sarahack
Sarahack

Reputation: 21

Send Prometheus query from telegraf to VictoriaMetrics DB

Did anyone know if it is possible to collect metric directly by sending a prometheus query in telegraf to VictoriaMetrics ?

I have tried this but it is not working :/

[inputs]
[[inputs.prometheus]]
urls = ["http://my_db_address:8428"]
query = "ifHCOutOctets_counter{target="device"}" 

Any ideas ? Thanks !

Upvotes: 2

Views: 505

Answers (2)

valyala
valyala

Reputation: 17784

Try the following config for Telegraf:

[[inputs.prometheus]]
urls = ["http://my_db_address:8428/federate?match[]=ifHCOutOctets_counter{target='device'}"]

It uses /federate endpoint for obtaining the last values for metrics matching the given filters. The /federate endpoint returns metrics in the same format as usual Prometheus exporters do at /metrics page.

Upvotes: 0

Skill Skot
Skill Skot

Reputation: 1

Make sure Prometheus query is valid data in system.if issue persists victoria metrics logs connection problem.Adusjust query with single quotes.Not use double quotes.

Upvotes: 0

Related Questions