Configure alert in Grafana bases on real UTC time

Hi.
I’ve got a MySQL table in which a script writes this info:

UTC TIME | Temperature
1522846176 | 26.81
1522846160 | 26.94
1522846144 | 27.00

I have graphs configurated in Grafana and everything goes right.
Now, I want to configure an alert bases on actual UTC TIME versus last UTC entry database.
Is this possible to do?

Excuse My english

Hi,

That should be possibly using mysql date and time functions. Really easy if your mysql db runs on a server with timezone utc - then you can just use NOW() to get the current time in utc, concert it to Unix timestamp and subtract your values in tables from this and use that as value. Then you can basically plot diff in seconds with utc in a graph panel and alert on it.

Marcus

Hi Marcus!.

I configured what you said, and works fine! Also I have to write in SQL Query an adicional statement: ‘ORDER BY DateColumn DESC LIMIT 1’. The only way I have to size the offset is with NOW() - Latest UTC time written in table.
If you put this in a graph, you only see one point, and it is not very elegant… I configured a SingleStat panel and used value mappings. If time diff is on scope, there is this message text: ‘SYNC’. If time diff is not on scope, ‘NO SYNC’.
And waiting for newer Grafana version and waiting for a new Alert Tab in SingleStat panels…

Thanks Marcus!!!

Marcus, another request.
Is there in Grafana GitHub a special place of folder (or a suggestion mailbox) where we can send you new ideas for improvements to grafana? For example, the alert tab for SingleStat panels?
Thanks!!

Glad you sorted it out.

You create a feature request issue. Just be sure to search open/closed issues before in case that feature already have been requested.

For example, there’s already a feature for singlestat alerting support: https://github.com/grafana/grafana/issues/6983

Marcus