- 系统表
- system.dashboards
system.dashboards
包含通过 HTTP 接口 访问的 /dashboard 页面所使用的查询。
此表可用于监控和故障排查。表中每个仪表盘图表对应一行记录。
注意
/dashboard 页面不仅可以渲染来自 system.dashboards 的查询,还可以渲染来自任意具有相同表结构的表中的查询。
这对于创建自定义仪表盘很有用。
示例:
SELECT *
FROM system.dashboards
WHERE title ILIKE '%CPU%'
Row 1:
──────
dashboard: overview
title: CPU 使用量(核心)
query: SELECT toStartOfInterval(event_time, INTERVAL {rounding:UInt32} SECOND)::INT AS t, avg(ProfileEvent_OSCPUVirtualTimeMicroseconds) / 1000000
FROM system.metric_log
WHERE event_date >= toDate(now() - {seconds:UInt32}) AND event_time >= now() - {seconds:UInt32}
GROUP BY t
ORDER BY t WITH FILL STEP {rounding:UInt32}
Row 2:
──────
dashboard: overview
title: CPU 等待时间
query: SELECT toStartOfInterval(event_time, INTERVAL {rounding:UInt32} SECOND)::INT AS t, avg(ProfileEvent_OSCPUWaitMicroseconds) / 1000000
FROM system.metric_log
WHERE event_date >= toDate(now() - {seconds:UInt32}) AND event_time >= now() - {seconds:UInt32}
GROUP BY t
ORDER BY t WITH FILL STEP {rounding:UInt32}
Row 3:
──────
dashboard: overview
title: 操作系统 CPU 使用量(用户态)
query: SELECT toStartOfInterval(event_time, INTERVAL {rounding:UInt32} SECOND)::INT AS t, avg(value)
FROM system.asynchronous_metric_log
WHERE event_date >= toDate(now() - {seconds:UInt32}) AND event_time >= now() - {seconds:UInt32} AND metric = 'OSUserTimeNormalized'
GROUP BY t
ORDER BY t WITH FILL STEP {rounding:UInt32}
Row 4:
──────
dashboard: overview
title: 操作系统 CPU 使用量(内核态)
query: SELECT toStartOfInterval(event_time, INTERVAL {rounding:UInt32} SECOND)::INT AS t, avg(value)
FROM system.asynchronous_metric_log
WHERE event_date >= toDate(now() - {seconds:UInt32}) AND event_time >= now() - {seconds:UInt32} AND metric = 'OSSystemTimeNormalized'
GROUP BY t
ORDER BY t WITH FILL STEP {rounding:UInt32}
列: