Giter Site home page Giter Site logo

Comments (6)

marcusolsson avatar marcusolsson commented on July 29, 2024 1

As I mentioned earlier

the query result needs to contain a time field and a number field

In your case, you seem to have neither :)

  • SensorValue is a string. The plugin would need to support parsing strings as numbers which it currently doesn't. If this is important to you, please create a feature request.
  • In your screenshot, you don't seem to extract the SensorUpdateTime. You'd need to add another JSON Path query referencing the property you'd like to use for the timestamp.

from grafana-json-datasource.

adyanth avatar adyanth commented on July 29, 2024 1

Yeah, I already did that on a dashboard for the same data source with a custom JSON exporter (Here and here). That works good.
I wanted to do it only in grafana because I was planning to run the whole thing on a raspberry pi which is already overloaded with this, and don't think can handle prometheus too : ) + I don't need more than like 60 samples at best, so keeping historical data does not help. I think I can roll a JSON -> JSON stateful adapter to save those samples if I plan to use this.

Thanks for looking into this, greatly appreciated! Happy holidays!

from grafana-json-datasource.

marcusolsson avatar marcusolsson commented on July 29, 2024

To graph data in Grafana, the query result needs to contain a time field and a number field. The plugin detects time fields by checking if it's a valid ISO 8601 string, or if it looks like a UNIX epoch.

Let me know if you have trouble graphing data with this plugin!

from grafana-json-datasource.

adyanth avatar adyanth commented on July 29, 2024

Here is the sample data from the API below, and my JsonPath query is $[?(@.SensorName == "Physical Memory Used")].SensorValue. (I tried the whole object too, $[?(@.SensorName == "Physical Memory Used")])

The SensorUpdateTime is indeed in Unix epoch time.
This is what I get on Grafana:
image
After switching to table view:
image
With the full object:
image

Let me know if I am doing something wrong here and thanks for looking into this!

[
  {
    "SensorApp": "HWiNFO",
    "SensorClass": "System: MSI MS-7C92",
    "SensorName": "Virtual Memory Commited",
    "SensorValue": "13857",
    "SensorUnit": "MB",
    "SensorUpdateTime": 1609297850
  },
  {
    "SensorApp": "HWiNFO",
    "SensorClass": "System: MSI MS-7C92",
    "SensorName": "Virtual Memory Available",
    "SensorValue": "27028",
    "SensorUnit": "MB",
    "SensorUpdateTime": 1609297850
  },
  {
    "SensorApp": "HWiNFO",
    "SensorClass": "System: MSI MS-7C92",
    "SensorName": "Virtual Memory Load",
    "SensorValue": "33.8",
    "SensorUnit": "%",
    "SensorUpdateTime": 1609297850
  },
  {
    "SensorApp": "HWiNFO",
    "SensorClass": "System: MSI MS-7C92",
    "SensorName": "Physical Memory Used",
    "SensorValue": "10133",
    "SensorUnit": "MB",
    "SensorUpdateTime": 1609297850
  }
]

from grafana-json-datasource.

adyanth avatar adyanth commented on July 29, 2024

Okay, I tried that. This recognizes the date format, but does not plot anything. When I said that JSON updates in real time, I meant that the JSON will only be for the current instance. It won't have data for the previous time instances.

So, I don't think this is possible with this data source, since I believe it is expecting the complete data to be sent over, rather than just the current data. My JSON source is sending data only for the current time instance, the next time you request, it would respond with new data.

image

from grafana-json-datasource.

marcusolsson avatar marcusolsson commented on July 29, 2024

Oh I see. Yeah, this plugin doesn't keep state at all. The JSON response need to contain the entire time series. If you want to store historical data, then I agree that something like Prometheus would be a better option 💯

from grafana-json-datasource.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.