sql - 这是通过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
解决方案
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
推荐阅读
- python - 在数据框中使用熊猫在随机位置插入特殊字符
- google-sheets - 如何获取最新值,只要最新状态不符合工作表上的条件(通过查询公式)
- swift - SwiftUI 和 USerDefaults:更新没有 ForEach 的变量
- gcc - 使用 bitbake 构建的二进制文件没有符号表
- python - 有没有办法用 sqlalchemy 连接查询?
- python - 为什么装饰器显示中的内部函数名称?
- html - 有没有办法超链接需要的图像
<p style="text-align: center"> <img class="alignnone size-full wp-image-759 aligncenter" /><img src="https://steamboateramuseum.or
- python - 按 pd 数据帧中的分位数对行进行排序,并在每个分位数中查找初始数据帧的索引
- javascript - 如果用户输入链接,如何防止提交?
- python - Python - 有效地计算字符串列表中非 ngram 序列的频率