ClickHouse:
┌─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: 104189952Grafana:
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
发布于 2021-05-23 16:29:24
Grafana期望您的SQL将返回大多数可视化的时间序列数据格式。
DateTime\Date\DateTime64 or UInt32,用于描述具有数字类型(Float、Int*、UInt*)和度量值(列名将用作时间序列名称)的时间戳的字符串。
或高级“时间序列”格式,当第一列将timestamp,而第二列将Array(tuple(String, Numeric)),其中String列将时间序列名称(通常它与
因此,选择表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端进行适当的数据转换。
发布于 2021-05-26 06:30:25
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
EventDateTimehttps://stackoverflow.com/questions/67584369
复制相似问题