Transform JSON Data from HTTP to metrics

Hello everyone.
I would like to transform the data exposed by the PRTG API (JSON, CSV or XML) into a metrics format I can store in prometheus. For this I was hoping to use grafana alloy.
I get the json string using remote.http, however I am at a loss on how to properly transform this using the inbuilt features from alloy.
Would appreciate your help! :slight_smile:
Thanks in advance.

Hi @fivehundredisok and welcome to the Grafana forum.

A few questions…

  1. This is the API you are referring to, correct?
  2. If you wanted to view the historical data, couldn’t you use the Infinity datasource with the appropriately configured HTTP site?

I am not sure how easy it will be for Alloy to do a grab-and-send to Prometheus, but Node-RED could do it for sure. Have you looked into that?

1 Like

Hello @grant2 and thank you for your reply.

To answer your questions:
Yes, I am talking about the PRTG API.
I will check out the infinity datasource as well as nodered.

Cheers

can you post a sample json or xml coming back from that rest api and what visualization you want to use

{
	"prtg": {
		"result": {
			"channel": "Amount of RAM",
			"value": "1000",
			"unit": "custom",
			"customunit": "RAM",
			"showchart": "0"
		}
	}
}

If you want to track metrics over time from your API to prometheus, you can use grafana recorded queries feature along with infinity.

Recorded queries is an enterprise feature of Grafana.

1 Like