MS SQL And Graph Panel


I’m experiencing an issue with inexperience with SQL and Grafana that I hope you guys can help me out with.

So this is my issue:
I’m trying to display information from a database in a graph panel but the graph panel displays only a part of the data. The panel pulls it data from the database using the following query:

_ time,_
_ ConnectionCount as value,_
_ ServiceName as metric_
_ _
_ [Table]_

Order BY
_ time ASC"_

I’m using this query 4 times for different tables in my database.
But this query seems not be executed in real-time. In a matter of fact there seems to be a 2 hour delay between my Graph panel and my Database Record.

For example:
I have a record that has been injected into my database at 14:54:04.450 and my Graph panel displays this value at timestamp 16:45:04.449. Note that this has nothing to do with Time zones.

Has someone experienced this before?
Is this expected behavior?
Is this an configuration error on my end?

I’m a bit at a loss here.

Looking forward to your reply!

System verion:
Ubuntu version 16.04.5 LTS
Grafana Version: 5.2.2 (Recently Updated)

SQL Server:
Windows 2012 R2
SQL Express Version 2017 with default schema and 2016 compatibility

Kind regards,

i think that you can check de time on database and grafana server,
I’m sure it’s simply because of that,
when we implemented grafana in my company, I had to change the default timezone of the database

Hello Daniel,

Thank you for your reply!
But i do not think that this is the problemen because timezones are the same:

Grafana Server:
Thu Aug 2 09:31:17 CEST 2018

SQL Server:
SQL Systime: 2018-08-02 09:31:18.9191011
(UTC +01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna

The only diffrence is CEST and UTC +1 (With daylight savings)
But in time does not matter.

Maybe this will clarify the issue:
Graph panel

This displays 25 connections at time 09:05:08
This displays 30 connections at time 09:06:08
This displays 21 connections at time 09:07:08

Database records:
No records with 25,30,31 around 09:06:07.
No records with 25,30,31 around 08:06:07

But there are records around 07:06:07
That matches the graphs displayed.

As a control mechanism i’ve created a table panel and this displays the correct information
I’ve also recreated the panels to rule out an initial problem.
But no luck so far.

Again thank you and looking forward to your reply!

P.S. I had a lot more screenshots but i’m a new user so i am no allowed more than two. :frowning:

Kind Regards,

You must make sure that all of your stored dates in mssql are in UTC timezone.

Yes, that fixed the issue!

Never realized that.
Thank you!!