How to display JSON format data in grafana

I am getting data from my VM to zabbix using custom script. This is the format of my data on zabbix

{"time":"2024-04-19T12:02:48Z","name":"argocd-redis-ha-haproxy-6bbf6475d7-6hqnm","namespace":"argocd","status":"Pending"}
{"time":"2024-04-19T12:02:48Z","name":"argocd-repo-server-9f64dfc4d-8fwff","namespace":"argocd","status":"Pending"}
{"time":"2024-04-19T12:02:48Z","name":"argocd-redis-ha-haproxy-6bbf6475d7-42l8l","namespace":"argocd","status":"Pending"}
{"time":"2024-04-19T12:02:48Z","name":"argocd-server-544d778bb8-9md9z","namespace":"argocd","status":"Pending"}
{"time":"2024-04-19T12:02:48Z","name":"argocd-redis-ha-server-1","namespace":"argocd","status":"Pending"}

i want to create a panel on grafana dashboard but it is showing the whole data under one column. I want more structured panel for this data so that i can further add filters to this dashboard

you can try an extract fields transformation

One sec…

How to do that? can yo please elaborate?

Play around with it and see what you can do. I’ve never used that transformation but it supports JSON

individually those are proper json format data pieces, taken as whole the payload is not proper json. copy that whole thing and use online json validstor to see what I mean

are you showing us individual rows or the whole final data payload?

My tip is learn to use Apache ECharts

If you know how to program, then you can use javascript to format the data any way you want (you will no longer have to rely on grafana to support exactly what you need). They also have great documentation and tutorials.

If you don’t know how to program, this is a great opportunity to learn

This is the final data payload on zabbix

it is no proper json so probably would not work with any json parsing methods

[quote=“sanashahbaz, post:11, topic:119827, full:true”]
[
{
“time”: “2024-04-24T11:49:31Z”,
“name”: “argocd-redis-ha-haproxy-6bbf6475d7-6hqnm”,
“namespace”: “argocd”,
“status”: “Pending”
},
{
“time”: “2024-04-24T11:49:31Z”,
“name”: “argocd-repo-server-9f64dfc4d-8fwff”,
“namespace”: “argocd”,
“status”: “Pending”
}
]
this is my format i am getting to grafana. How to use extract fields to get the data in columns?

1 Like

you can change inline to url to change to the actual api url…

this is the data i am getting from zabbix. I need to keep the data source as zabbix

in the transformation tab look for Extract and play around with it and post back when you are stuck

:fishing_pole_and_fish:


This is the transformation i have added but it is showing data like this.
i want columns like time, name, namespace and status

what you are showing us does not match the json you provided us.
hard to help you if you dont provide us the exact json body you get from zabbix

this is my zabbix query

the result you get from that query does not match the json data you posted.

[
{
“time”: “2024-04-24T11:49:31Z”,
“name”: “argocd-redis-ha-haproxy-6bbf6475d7-6hqnm”,
“namespace”: “argocd”,
“status”: “Pending”
},
{
“time”: “2024-04-24T11:49:31Z”,
“name”: “argocd-repo-server-9f64dfc4d-8fwff”,
“namespace”: “argocd”,
“status”: “Pending”
}



]
this is my data with multiple records

please show us the Table View of that query without the extract transform

image


this is the table view