grafana-prtg icon indicating copy to clipboard operation
grafana-prtg copied to clipboard

Grafana showing no data in graph

Open jimmyjams22 opened this issue 6 years ago • 4 comments

Hello,

Firstly i would love to say its great seeing you being more active again on this fantastic plugin you have created. My issue is identical to #141 which is now closed. The plugin detects i have data, however will not display anything in the graphs. While that user did fix it by going back to plugin version 4.0.

I was wondering if there are any plans to fix the issue on the current PRTG and plugin version.

Thanks,

jimmyjams22 avatar Nov 24 '19 05:11 jimmyjams22

What language are you using? Do you have a different date format? historicdata.json shows the date as MM/DD/YYYY HH:MM:SS AM|PM - Unless for some absurd reason the date string is different, this should work perfectly.

neuralfraud avatar Nov 24 '19 21:11 neuralfraud

Hey,

Thanks for the quick response. It would appear you hit the nail on the head. I am from Australia and my native time format is DD/MM/YYYY. I changed the time format in PRTG to MM/DD/YYYY HH:MM:SS AM|PM and everything works perfectly now.

jimmyjams22 avatar Nov 25 '19 04:11 jimmyjams22

Ok thats super annoying but i will look into my options with the API. Thank you.

Sent from my iPhone

On Nov 24, 2019, at 10:15 PM, jimmyjams22 [email protected] wrote:

Hey,

Thanks for the quick response. It would appear you hit the nail on the head. I am from Australia and my native time format is DD/MM/YYYY. I changed the time format in PRTG to MM/DD/YYYY HH:MM:SS AM|PM and everything works perfectly now.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

neuralfraud avatar Nov 25 '19 14:11 neuralfraud

Looked in to this as I didn't want to downgrade due to the performance improvements found using 4.0.4's JSON parsing over XML (nor did I want to change the date format in PRTG). This is a consequence of the way that javascript's built-in Date object handles short dates. See "Fall-back to implementation-specific date formats" at: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse#Description

I did a hacky fix to get around it for now, by adding the following replacement regex to the date parse in the getItemHistory function datetime: Date.parse(results[iter]["datetime"].match(/(\d+\/\d+\/\d+\s\d+:\d+:\d+\s\w+)\s?/)[1].replace(/([0-9]+)\/([0-9]+)/,'$2/$1')), //Let's pray there are no Chinese timestamps

You might have to use/include a different time/date library to avoid having to do a lot of processing work to get around this issue.

adzicents avatar Jan 08 '20 02:01 adzicents