Viewing JSON data from file in Grafana with or without DB?

I’m currently learning about Grafana and databases. I’m am not anywhere near proficient at either. What I have is a json file with a bunch of data in it that looks like this:

{“camera”: “192.168.131.26”, “data”:
[{“people_count”: {“enter”: 0, “leave”: 0}, “timestamp”: “2020-05-00 00:10:56.560010”},

Plus about 47000 more lines. :slight_smile:

I just want to visualize this data within a grafana dashboard, but I am not sure of the best way to do this. I thought about NoSQL using MongoDB and created all of the entries, but Grafana requires a subscription for this. Wondering if there is a way to get Grafana to just read directly from the file or any other suggested way of doing this, Again, I’m completely new to all of this and would really appreciate any direction. Thanks

1 Like

Have you investigated

Antony.

Or Grafana Infinity Datasource

Hey there @svetb , I decided to try infinity one first as it looked promising from the start. I was able to input my data into the field as shown by the examples. However, when I run the dashboard, it says there is no data to display. Have you used this plugin and have you had any issues like the one I am mentioning? Any thoughts on this? I know I am probably doing something wrong here. Thanks in advance.

Hey there, Antony. I’m tryng the Grafana Infinity Datasoure first, but will try the simpleJSON if I am unable ot get it to work. I appreciate the suggestion and will let you know what I find.

Hi @tdickson Here is gist of how you achieve this with infinity datasource.

[
  {
    "people_count": { "enter": 0, "leave": 0},
    "timestamp": "2020-05-01 00:10:56.5600010"
  },
  {
    "people_count": { "enter": 2, "leave": 0},
    "timestamp": "2020-05-01 00:12:56.5600010"
  },
  {
    "people_count": { "enter": 5, "leave": 2},
    "timestamp": "2020-05-01 01:10:56.5600010"
  }
]

1 Like

Hey there, @yesoreyeram I am really glad you jumped in on this as I think you have the most knowledge on this plugin. I tried your suggestion, but am still getting the No data alert. Here is how it is configured. I have added 10k lines and checked to make sure all are formatted as you mentioned. Am I doing something wrong? I am doing this on a local instance, btw.

@yesoreyeram nevermind. You fixed it. I decided to try another dashboard from scratch and the data is now showing. I really appreciate your time on this and your explanation was truly helpful. I will mark your answer as a solution. Stay safe :slight_smile:

1 Like

Hi @yesoreyeram, I found your answer in this post when trying to find a solution for my master thesis project. I need to connect Grafana to a MongoDB Database in the default location (localhost:27017). I am not proficient in this software so I hope you could kindly help me to connect the database. I used this (see picture below) but it seems that URL inputs field are deprecated. How can I include that?

Thanks in advance!

I also tried this:

Hi @juancarloscg sorry for the trouble you have. AFAIK, the mongodb port you specified doesnt use HTTP protocol. Infinity or json datasource. Instead suggest you to use any mongodb supported datasource for your usecase. All the best.

1 Like

Thank you very much for your help @yesoreyeram So how could I use MongoDB in Grafana? Do you recommend me using another database instead?

Hi sir
Our project is about displaying covid data on dashboard and we are using json and csv files later put it in mongo db and display mongo db data on graffana can u tell how to connect mongo db and grafana

This topic was automatically closed after 365 days. New replies are no longer allowed.