簡體   English   中英

這是通過grafana使用它的正確方法嗎?

[英]Is this the correct way to use it via grafana?


點擊屋:

┌─name──────────┬─type──────────┬
│ FieldUUID     │ UUID          │
│ EventDate     │ Date          │
│ EventDateTime │ DateTime      │
│ Metric        │ String        │
│ LabelNames    │ Array(String) │
│ LabelValues   │ Array(String) │
│ Value         │ Float64       │
└───────────────┴───────────────┴
Row 1:
──────
FieldUUID:     499ca963-2bd4-4c94-bc60-e60757ccaf6b
EventDate:     2021-05-13
EventDateTime: 2021-05-13 09:24:18
Metric:        cluster_cm_agent_physical_memory_used
LabelNames:    ['host']
LabelValues:   ['test01']
Value:         104189952

格拉法納:

SELECT
        EventDateTime,
        Value AS cluster_cm_agent_physical_memory_used
    FROM
        $table
    WHERE
        Metric = 'cluster_cm_agent_physical_memory_used'
        AND $timeFilter 
    ORDER BY
        EventDateTime

沒有數據點。

問題:這是通過grafana使用它的正確方法嗎?

例子:
cluster_cm_agent_physical_memory_used{host='test01'} 104189952

Grafana 預計您的 SQL 將為大多數可視化返回時間序列數據格式。

  • 一列DateTime\Date\DateTime64 or UInt32描述時間戳
  • 一列或多列具有數字類型(Float、Int*、UInt*)和度量值(列名將用作時間序列名稱)
  • 可選的一列字符串,可以描述多個時間序列名稱

或高級“時間序列”格式,當第一列將timestamp ,第二列將Array(tuple(String, Numeric))其中String列將時間序列名稱(通常與

因此,select 表metrics.shell作為表, EventDateTime作為query editor下拉列表中的字段,您的查詢可以更改為

    SELECT
        EventDateTime,
        Value AS cluster_cm_agent_physical_memory_used
    FROM
        $table
    WHERE
        Metric = 'cluster_cm_agent_physical_memory_used'
        AND $timeFilter 
    ORDER BY
        EventDateTime

SQL 從您的帖子中查詢,只需使用Table插件即可在不進行更改的情況下進行可視化,您應將“時間序列”更改為“表格”格式,以便在 grafana 端進行正確的數據轉換

promQL 查詢cluster_cm_agent_physical_memory_used{host='test01'} 104189952應該看起來像

SELECT
        EventDateTime,
        Value AS cluster_cm_agent_physical_memory_used
    FROM
        $table
    WHERE
        Metric = 'cluster_cm_agent_physical_memory_used'
        AND LabelValues[indexOf(LabelNames,'host')] = 'test01'
        AND $timeFilter 
    ORDER BY
        EventDateTime

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM