Infinity plugin - Unable to create graph from JSON values

Hello,

I used the Infinity plugin to make a call to REST API.
The following is the JSON response with timestamp (epoch) and values.

{
“timeStamp”:[1609455600000,1609456500000,1609457400000,1609458300000,1609459200000,1609460100000,1609461000000],
“values”:[5,10,15,10,10,5,5]
}

I am unable to get the values from both the fields.
Here is how I am trying to access,

Thank you in advance.

Hi,

I call @yesoreyeram who worked on the plugin to help, my first guess is that your json is not well formated, can you try with only one value.

Check this out might help :

Hope it helps.

Good Luck

@wlargou: Thank you for your suggestion.

If I change to format from Time Series to table, I got below response.

All the values are displayed in single line, instead of different rows.
Also, the values are not getting displayed in Time Series format.

Hi,

Make sense, you should have your data structure in JSON as timestamp/value pairs, currently you have all timestamps as an entry and all values at entry.

Good Luck

As @wlargou mentioned, Your json needs to be array of elements something like this

[
  { "timestamp" : 12345, "value" : 0.1 },
  { "timestamp" : 12346, "value" : 0.2 }
]

@vkamath - Unfortunately, current version of plugin doesn’t support the format you have now. May be will see if I can fix this in future versions. Thanks for testing the plugin.

1 Like

Thank you @wlargou and @yesoreyeram for all the help.

1 Like

My timeseries data look like this:



 {
        "type": "machine",
        "id": "187561",
        "signal": "value.common.cu.gnss.satellites.number",
        "aggregationFunction": "raw",
        "totalDatapoints": 139,
        "timeseries": [
            {
                "time": 1667560340000,
                "value": 11.0
            },
            {
                "time": 1667560399000,
                "value": 10.0
            },
            {
                "time": 1667560459000,
                "value": 10.0
            },
            {
                "time": 1667560519000,
                "value": 13.0
            }
        ]
    }
]

So basically the data structure is very much the same as in the example from the documentation page from thingspeak.
But the data are not being parsed:


What could be the problem here?

I found the rootcause. The values are nested in an array. This is how I could fix it:
grafik

Hey @yesoreyeram. I know its an old post but do you have any updates ? can the plugin now handle the format:

{
"timeseries":
    {
      "timestamp":[12345, 12346], 
      "values": [1,2]
    }
}

Thanks for your answer

@emanueljoos , possibly something like this with uql

parse-json
| scope "timeseries"
| project "values"=array_from_entries('timestamp',"timestamp", 'values',"values")
| extend "timestamp"=unixtime_milliseconds_todatetime("timestamp")

@yesoreyeram Thank you this works perfectly.

1 Like

@yesoreyeram Hey this is wonderful plugin. But i got a question, The dev team is dumping all metrics in a endpoint as payload, How can I create a timeseries graph using the json data by hitting that url every 5 mins and show the count graphically instead of table?

Here is sample data, few fields will keep updating after the plugin auto hits the endpoint url

{
“partCount”: 2,
“hostCount”: 2,
“nodeCount”: 244760,
“agents”: {
“agentCount”: 245058,
“execRate”: 699927,
“execTime”: 76907365184
},
“downlinks”: {
“linkCount”: 460258
},
“uplinks”: {
“linkCount”: 457014,
“eventCount”: 175
},
“system”: {
“cpuUsage”: 194,
“cpuTotal”: 400,
“memUsage”: 15690321920,
“memTotal”: 16596205568,
“diskUsage”: 19375001600,
“diskTotal”: 128838533120,
“startTime”: 1687268610193
}
}

kindly help