【Grafana】連接mssql並圖表顯示

在这里插入图片描述

【Grafana】連接mssql並圖表顯示

    • 1. 函數
    • 2. Demo
      • 2.1 Query
      • 2.2 Query
    • 3. Awakening
      • 1.1 Big Data -- Postgres


在这里插入图片描述
【Grafana】連接mssql並圖表顯示_第1张图片

在这里插入图片描述


1. 函數

Macro example Replaced by
$__time(dateColumn) An expression to rename the column to time. For example, dateColumn as time
$__timeEpoch(dateColumn) An expression to convert a DATETIME column type to Unix timestamp and rename it to time.
For example, DATEDIFF(second, ‘1970-01-01’, dateColumn) AS time
$__timeFilter(dateColumn) A time range filter using the specified column name.
For example, dateColumn BETWEEN ‘2017-04-21T05:01:17Z’ AND ‘2017-04-21T05:06:17Z’
$__timeFrom() The start of the currently active time selection. For example, ‘2017-04-21T05:01:17Z’
$__timeTo() The end of the currently active time selection. For example, ‘2017-04-21T05:06:17Z’
$__timeGroup(dateColumn,'5m'[, fillvalue]) An expression usable in GROUP BY clause. Providing a fillValue of NULL or floating value will automatically fill empty series in timerange with that value.
For example, CAST(ROUND(DATEDIFF(second, ‘1970-01-01’, time_column)/300.0, 0) as bigint)*300.
$__timeGroup(dateColumn,'5m', 0) Same as above but with a fill parameter so missing points in that series will be added by grafana and 0 will be used as value.
$__timeGroup(dateColumn,'5m', NULL) Same as above but NULL will be used as value for missing points.
$__timeGroup(dateColumn,'5m', previous) Same as above but the previous value in that series will be used as fill value if no value has been seen yet NULL will be used (only available in Grafana 5.3+).
$__timeGroupAlias(dateColumn,'5m') Same as $__timeGroup but with an added column alias (only available in Grafana 5.3+).
$__unixEpochFilter(dateColumn) A time range filter using the specified column name with times represented as Unix timestamp. For example, dateColumn > 1494410783 AND dateColumn < 1494497183
$__unixEpochFrom() The start of the currently active time selection as Unix timestamp. For example, 1494410783
$__unixEpochTo() The end of the currently active time selection as Unix timestamp. For example, 1494497183
$__unixEpochNanoFilter(dateColumn) A time range filter using the specified column name with times represented as nanosecond timestamp. For example, dateColumn > 1494410783152415214 AND dateColumn < 1494497183142514872
$__unixEpochNanoFrom() The start of the currently active time selection as nanosecond timestamp. For example, 1494410783152415214
$__unixEpochNanoTo() The end of the currently active time selection as nanosecond timestamp. For example, 1494497183142514872
$__unixEpochGroup(dateColumn,'5m', [fillmode]) Same as $__timeGroup but for times stored as Unix timestamp (only available in Grafana 5.3+).
$__unixEpochGroupAlias(dateColumn,'5m', [fillmode]) Same as above but also adds a column alias (only available in Grafana 5.3+).

2. Demo

2.1 Query

  • demo01
    【Grafana】連接mssql並圖表顯示_第2张图片
  • demo02
    【Grafana】連接mssql並圖表顯示_第3张图片

2.2 Query

  • 官方提供的函數,底層查詢使用的時間會減少8小時
    【Grafana】連接mssql並圖表顯示_第4张图片
  • 所有,代碼插入DB的時候要減8小時
    在这里插入图片描述
  • 顯示的時候再加回來
    【Grafana】連接mssql並圖表顯示_第5张图片

3. Awakening

1.1 Big Data – Postgres

     在一秒钟内看到本质的人和花半辈子也看不清一件事本质的人,自然是不一样的命运。

在这里插入图片描述

你可能感兴趣的:(Java,grafana,sqlserver,java)