Parsing JSON Response in Grafana

Hi

I have a Kubernetes environment and using Grafana to visualise metrics streamed from Prometheus.
I have application counters which are not fed to Prometheus. However I am able to view them as a JSON object by using a curl command.

http://10.0.0.1:8081/api/events/

Response has the following format:

{
{
  "ID":   "001",
  "source": "pageloads",
  "summary":  "high failure counts",
  "severity": "major"
},
{
  "ID":   "003",
  "source": "profile_counts",
  "summary":  "profile count doesn't match number of groups",
  "severity": "minor"
},
{
  "ID":   "002",
  "source": "number of subscribers",
  "summary":  "profiles higher than subscribers",
  "severity": "critical"
}
}

Is there a plugin to query this data (http://10.0.0.1:8081/api/events/) in Grafana?

Thank you

You can use Loki. The “Getting started” section of that document explains how to quickly install and set up Loki as a data source.

How would you get Loki to query http://10.0.0.1:8081/api/events/ and store the JSON response?

For such simple use cases,I suggest to checkout Grafana infinity datasource or JSON API datasource.

Example: Below query is an example of infinity datasource query. Replace url with a valid json URL.

BTW, I see your json response is in invalid json format. So wont work directly in any json parser. Starts with { instead [.

1 Like