How can i dashboard from arbitrary json data

Hello,

If I have standard json data, e.g { “host”:"host1,“metrics1”:{“Name”: “metrics1”, “Status”: “GOOD”, “Message”: “Enabled”}, “metrics2”:{“Name”: “metrics2”, “Status”: “GOOD”, “Message”: “Enabled”}}, This data is coming from many hosts.

Is there way to dashboard this? How can i get this data in Grafana? I am not interested in any timestamp, all want is current status of all my metrics, and if they are enabled or not.
All I am looking for a url where each host can send this to and dashbaord this available latest data from that url. No need to store it forever.

I looked at posting to api/annotations/ but won’t access this type of json. and even if I somehow post it to annotation, how I can display it?

S

Where are you getting the JSON data from? If your JSON is available via an HTTP(S) request, you can add it as a data source using the following plugin: JSON API plugin for Grafana | Grafana Labs. Once you have the configured as a datasource, it would be pretty easy to create a status dashboard using stat panels.

2 Likes

run with this

1 Like

Thanks

Sure I can use this plugin/datasource. To configure this datasource, I need to setup a host:port, where as my data is coming from many different hosts. How I can get this json data into grafana/prometheus. e.g. on the host where I generate json, can I just run curl post to this json to somwhere? Do i need to run a webserver on 8080 (or some other port) on a server where I am running grafana?

Thanks

-S

Sorry, I meant to say json is not available via http(s) …it is output of a a python script. I can curl post to wherever i need…thats why I was looking at annotations.
-S

what is the real source of the data? before python generates the json

its python script generating application specific data, some may be compliance some will be used for debugging, but all values are good or bad. Currently the data is json format with just straight 10 items (not a complicated json). This json is used by other application for various reasons, but nice to have a dashboard, to just show status map (up/down, 0/1). I can have my python script dump the json to a directory and have node_exporter text collector send it to Prometheus. But i think i will have to convert that to Prometheus metrics format somewhere…

Thanks
S

1 Like

or dump it into mongodb or … another nosql db. all kinds of options. or bleeding edge (prometheus, mimir)

https://grafana.com/docs/mimir/latest/operators-guide/getting-started/

I agree with @yosiasz – I would see about having the Python script put data into something like InfluxDB or even MQTT and then use one of those as your datasource in Grafana. If you’re not looking for history, it doesn’t get much simpler than MQTT.