Unable to add Time series queries with grafana and MySQL?

HI ,
I did a fresh insalltion with graphana but not able to install my time series data on graph .

mysql> select * from excel_table1;
_±----±-----------±-------±-------±------±------±--------±------±---------±------------------±------------------±---------±------+_
_| id | datetime | orig | term | nopgr | error | call | fails | overload | failratio | errratio | auderror | hwerr |_
_±----±-----------±-------±-------±------±------±--------±------±---------±------------------±------------------±---------±------+_
_| 1 | 1345161600 | 377082 | 173266 | 20231 | 25681 | 504436 | 407 | 40 | 8068.417004337518 | 46.66320219206757 | 0 | 131 |_
_| 2 | 1345161600 | 361197 | 155805 | 14634 | 19783 | 482585 | 409 | 38 | 8475.19089901261 | 38.26484230235086 | 0 | 78 |_
_| 3 | 1345168800 | 341843 | 141346 | 10613 | 14755 | 457821 | 464 | 46 | 10134.96541224627 | 30.53670509883296 | 11 | 261 |_
_| 4 | 1345172400 | 337337 | 130852 | 8005 | 12385 | 447799 | 417 | 41 | 93122.13738753325 | 26.45299227448744 | 6 | 125 |_
_| 5 | 1345176000 | 339581 | 137203 | 7687 | 11826 | 457271 | 355 | 37 | 77634.48808255936 | 24.80368468740562 | 0 | 89 |_
_| 6 | 1345179600 | 366389 | 140749 | 8749 | 13574 | 484815 | 454 | 46 | 93643.96728649072 | 26.76589015218737 | 2 | 77 |_
_| 7 | 1345183200 | 426045 | 153306 | 12323 | 17707 | 549321 | 436 | 28 | 79370.71402695328 | 30.56350985844506 | 0 | 68 |_
_| 8 | 1345186800 | 534245 | 195869 | 20650 | 27619 | 681845 | 543 | 40 | 79636.86761654042 | 37.82833913608012 | 0 | 55 |_
_| 9 | 1345190400 | 673998 | 256556 | 35519 | 45073 | 849962 | 539 | 44 | 63414.59971151652 | 48.43673768529285 | 0 | 57 |_
_| 10 | 1345194000 | 748337 | 336462 | 55969 | 69143 | 959687 | 624 | 30 | 65021.19962029286 | 63.73807497978888 | 28 | 108 |_

to plot this on graph i wrote an query but it is not showing up anything on graph ,
Can someone help ??

My query

SELECT
** UNIX_TIMESTAMP(datetime) as time_sec,**
** orig as value,**
** ‘fails’ as metric**
** FROM excel_table1**
WHERE $__timeFilter(datetime)
ORDER BY datetime ASC

please if someone can help ?

Hi,

I am using Postgres, and for me, I had to change time_sec to time for the Time Series to render.

The field should be called time_sec for MySQL in the current version (Postgres has better support for time fields and can support subsecond intervals).

  • Are you getting an error?
  • What format is your datetime field (is it an int11?)
  • If there are no errors and the generated sql query looks correct - have you tried changing from lines to points (on the display tab->draw modes). If you see points then you have a problem with the grouping by time.