Hello. I have just started using Grafana with a MySQL db. I have a powershell script running to connect to the database and enter the information I want and that works fine. The issue I am having is getting the DATETIME into UTC format so Grafana likes it. I am changing it from local time to UTC in the script with:
$TS = Get-Date
$New = $TS.ToUniversalTime()
$timestamp = Get-Date $New -UFormat “%Y-%m-%d %H:%M:%S”
When I run that code in PS the datetime is UTC and I can see it in the db in UTC as well. However, when I try to use the table to make a graph, Grafana cannot find the data. BUT, if I do NOT change it to UTC in the script and leave it as is (local) it works fine and Grafana can see and use the table no problem.
Here is the SQL:
Date AS “time”,
Metric AS metric,
Metric = ‘CPU_Avg’
ORDER BY Date
I ran into the same problem with python on a Raspberry Pi and the answer there was to change the time to UTC on the rPi itself which fixed the problem but I cannot do that on my Windows box.
I know I am not explaining it well, so I apologize. Please reach out if any more info is needed.