> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-8a08bda2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# ClickHouse Cloud 控制台中的监控

> ClickHouse Cloud 控制台中的内置监控仪表板

export const Image = ({img, alt, size}) => {
  return <Frame>
      <img src={img} alt={alt} />
    </Frame>;
};

ClickHouse Cloud 中的服务开箱即用，内置监控组件，可为用户提供仪表板和通知。默认情况下，Cloud 控制台中的所有用户都可以访问这些仪表板。

<div id="dashboards">
  ## 仪表盘
</div>

<div id="service-health">
  ### 服务健康
</div>

“服务健康”仪表板可用于监控服务的整体健康状态。ClickHouse Cloud 会从系统表中抓取并存储该仪表板显示的指标，以便在服务进入休眠状态时仍可查看。

<div id="resource-utilization">
  ### 资源利用率
</div>

Infrastructure 仪表板可详细查看 ClickHouse 进程使用的资源。ClickHouse Cloud 会从系统表中抓取并存储此仪表板显示的指标，因此即使服务处于休眠状态，也可以查看这些指标。

<div id="memory-and-cpu">
  #### 内存和 CPU
</div>

**Allocated CPU** 和 **Allocated Memory** 图表显示了服务中每个副本可用的总计算资源。这些资源配额可通过 ClickHouse Cloud 的[扩缩容功能](/zh/products/cloud/features/autoscaling/overview)进行调整。

**Memory Usage** 和 **CPU Usage** 图表会估算每个副本中 ClickHouse 进程实际占用的 CPU 和内存，包括查询以及合并等后台进程。

<Info>
  **性能下降**

  如果内存或 CPU 使用率接近已分配的内存或 CPU，可能就会开始出现性能下降。为解决此问题，我们建议：

  * 优化查询
  * 调整表引擎的分区方式
  * 使用[扩缩容](/zh/products/cloud/features/autoscaling/overview)为服务添加更多计算资源
</Info>

以下是这些图表中显示的系统表对应指标：

| 图表      | 对应的指标名称             | 聚合  | 说明                                                |
| ------- | ------------------- | --- | ------------------------------------------------- |
| 已分配内存   | `CGroupMemoryTotal` | 最大值 |                                                   |
| 已分配 CPU | `CGroupMaxCPU`      | 最大值 |                                                   |
| 已使用内存   | `MemoryResident`    | 最大值 |                                                   |
| 已使用 CPU | 系统 CPU 指标           | 最大值 | 通过 Prometheus 端点获取的 `ClickHouseServer_UsageCores` |

<div id="data-transfer">
  #### 数据传输
</div>

图表显示与 ClickHouse Cloud 之间的数据传入和传出情况。有关更多信息，请参阅[网络数据传输](/zh/products/cloud/reference/billing/network-data-transfer)。

<div id="advanced-dashboard">
  ### 高级仪表板
</div>

此仪表板基于[内置高级可观测性仪表板](/zh/products/cloud/features/monitoring/advanced-dashboard)修改而来，其中每个序列表示各个副本的指标。它可用于监控和排查 ClickHouse 特有的问题。

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-8a08bda2/Crkay9vSr-K_Gf1T/images/cloud/manage/monitoring/advanced_dashboard.png?fit=max&auto=format&n=Crkay9vSr-K_Gf1T&q=85&s=23db20e47b7efa2e6315d536086c8e6f" size="lg" alt="ClickHouse Cloud 中的高级仪表板" border width="3012" height="1468" data-path="images/cloud/manage/monitoring/advanced_dashboard.png" />

<Note>
  ClickHouse Cloud 会从系统表中抓取并存储此仪表板显示的指标，因此即使服务处于休眠状态，也仍然可以查看这些指标。访问这些指标不会向底层服务发起查询，也不会唤醒休眠中的服务。
</Note>

下表列出了高级仪表板中各个图表对应的 ClickHouse 指标、系统表来源和聚合类型：

| 图表                         | 对应的 ClickHouse 指标名称                                                                                                                                                     | 系统表                       | 聚合类型                    |
| -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------- | ----------------------- |
| 查询数/秒                      | `ProfileEvent_Query`                                                                                                                                                    | `metric_log`              | Sum / bucketSizeSeconds |
| 运行中的查询                     | `CurrentMetric_Query`                                                                                                                                                   | `metric_log`              | Avg                     |
| 运行中的合并                     | `CurrentMetric_Merge`                                                                                                                                                   | `metric_log`              | Avg                     |
| 已选取字节数/秒                   | `ProfileEvent_SelectedBytes`                                                                                                                                            | `metric_log`              | Sum / bucketSizeSeconds |
| IO 等待                      | `ProfileEvent_OSIOWaitMicroseconds`                                                                                                                                     | `metric_log`              | Sum / bucketSizeSeconds |
| S3 读取等待                    | `ProfileEvent_ReadBufferFromS3Microseconds`                                                                                                                             | `metric_log`              | Sum / bucketSizeSeconds |
| S3 读取错误数/秒                 | `ProfileEvent_ReadBufferFromS3RequestsErrors`                                                                                                                           | `metric_log`              | Sum / bucketSizeSeconds |
| CPU 等待                     | `ProfileEvent_OSCPUWaitMicroseconds`                                                                                                                                    | `metric_log`              | Sum / bucketSizeSeconds |
| OS CPU 使用率 (userspace，归一化) | `OSUserTimeNormalized`                                                                                                                                                  | `asynchronous_metric_log` |                         |
| OS CPU 使用率 (kernel，归一化)    | `OSSystemTimeNormalized`                                                                                                                                                | `asynchronous_metric_log` |                         |
| 从磁盘读取                      | `ProfileEvent_OSReadBytes`                                                                                                                                              | `metric_log`              | Sum / bucketSizeSeconds |
| 从文件系统读取                    | `ProfileEvent_OSReadChars`                                                                                                                                              | `metric_log`              | Sum / bucketSizeSeconds |
| 内存 (已跟踪，字节)                | `CurrentMetric_MemoryTracking`                                                                                                                                          | `metric_log`              |                         |
| MergeTree parts 总数         | `TotalPartsOfMergeTreeTables`                                                                                                                                           | `asynchronous_metric_log` |                         |
| 单个分区的最大 parts 数            | `MaxPartCountForPartition`                                                                                                                                              | `asynchronous_metric_log` |                         |
| 从 S3 读取                    | `ProfileEvent_ReadBufferFromS3Bytes`                                                                                                                                    | `metric_log`              | Sum / bucketSizeSeconds |
| 文件系统缓存大小                   | `CurrentMetric_FilesystemCacheSize`                                                                                                                                     | `metric_log`              |                         |
| Disk S3 写请求数/秒             | `ProfileEvent_DiskS3PutObject` + `ProfileEvent_DiskS3UploadPart` + `ProfileEvent_DiskS3CreateMultipartUpload` + `ProfileEvent_DiskS3CompleteMultipartUpload`            | `metric_log`              | Sum / bucketSizeSeconds |
| Disk S3 读请求数/秒             | `ProfileEvent_DiskS3GetObject` + `ProfileEvent_DiskS3HeadObject` + `ProfileEvent_DiskS3ListObjects`                                                                     | `metric_log`              | Sum / bucketSizeSeconds |
| FS 缓存命中率                   | `sum(ProfileEvent_CachedReadBufferReadFromCacheBytes) / (sum(ProfileEvent_CachedReadBufferReadFromCacheBytes) + sum(ProfileEvent_CachedReadBufferReadFromSourceBytes))` | `metric_log`              |                         |
| 页缓存命中率                     | `greatest(0, (sum(ProfileEvent_OSReadChars) - sum(ProfileEvent_OSReadBytes)) / (sum(ProfileEvent_OSReadChars) + sum(ProfileEvent_ReadBufferFromS3Bytes)))`              | `metric_log`              |                         |
| 网络接收字节数/秒                  | `NetworkReceiveBytes`                                                                                                                                                   | `asynchronous_metric_log` | Sum / bucketSizeSeconds |
| 网络发送字节数/秒                  | `NetworkSendBytes`                                                                                                                                                      | `asynchronous_metric_log` | Sum / bucketSizeSeconds |
| 并发 TCP 连接数                 | `CurrentMetric_TCPConnection`                                                                                                                                           | `metric_log`              |                         |
| 并发 MySQL 连接数               | `CurrentMetric_MySQLConnection`                                                                                                                                         | `metric_log`              |                         |
| 并发 HTTP 连接数                | `CurrentMetric_HTTPConnection`                                                                                                                                          | `metric_log`              |                         |

如需了解各项可视化的详细信息以及如何用它们进行故障排查，请参阅[高级仪表板文档](/zh/products/cloud/features/monitoring/advanced-dashboard)。

<div id="query-insights">
  ## Query insights
</div>

**Query Insights** 功能借助各种可视化和表格，让 ClickHouse 内置的查询日志更易使用。ClickHouse 的 `system.query_log` 表是用于查询优化、调试以及监控整体集群健康状态和性能的关键信息来源。

选择某个服务后，左侧边栏中的 **Monitoring** 导航项会展开，并显示 **Query insights** 子项：

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-8a08bda2/4tGY89RiEVulg4pa/images/cloud/sqlconsole/insights_overview.png?fit=max&auto=format&n=4tGY89RiEVulg4pa&q=85&s=15f59829053c8c1c5cb35d341b0ab2b3" size="md" alt="Query Insights UI 概览" border width="1712" height="790" data-path="images/cloud/sqlconsole/insights_overview.png" />

<div id="top-level-metrics">
  ### 顶层指标
</div>

顶部的统计卡片显示的是所选时间范围内的基础查询指标。下方的时间序列图表则按查询类型 (select、insert、other) 分类展示查询量、延迟和错误率。延迟图表可切换为显示 p50、p90 和 p99 延迟：

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-8a08bda2/4tGY89RiEVulg4pa/images/cloud/sqlconsole/insights_latency.png?fit=max&auto=format&n=4tGY89RiEVulg4pa&q=85&s=f90c089f1c3aead61a763b954aa45a8d" size="md" alt="Query Insights 延迟图表" border width="1456" height="384" data-path="images/cloud/sqlconsole/insights_latency.png" />

<div id="recent-queries">
  ### 最近查询
</div>

表格会显示所选时间窗口内按归一化查询哈希和用户分组的查询日志条目。最近查询可按任何可用字段进行过滤和排序，还可将表格配置为显示或隐藏其他字段，例如表、p90 和 p99 延迟：

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-8a08bda2/4tGY89RiEVulg4pa/images/cloud/sqlconsole/insights_recent.png?fit=max&auto=format&n=4tGY89RiEVulg4pa&q=85&s=df54f91616821ebe6b8fca75b1b35afb" size="md" alt="Query Insights 最近查询表" border width="1625" height="736" data-path="images/cloud/sqlconsole/insights_recent.png" />

<div id="query-drill-down">
  ### 查询下钻
</div>

在 Recent queries 表中选择某个查询后，会打开一个弹出面板，其中包含该查询的相关指标和信息：

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-8a08bda2/4tGY89RiEVulg4pa/images/cloud/sqlconsole/insights_drilldown.png?fit=max&auto=format&n=4tGY89RiEVulg4pa&q=85&s=1d30b29ebd3637c48801b9d25df26d5d" size="md" alt="Query Insights UI 查询下钻" border width="1889" height="963" data-path="images/cloud/sqlconsole/insights_drilldown.png" />

**Query info** 选项卡中的所有指标都是聚合后的指标；如果选择 **Query history** 选项卡，还可以查看每次单独运行的指标：

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-8a08bda2/4tGY89RiEVulg4pa/images/cloud/sqlconsole/insights_query_info.png?fit=max&auto=format&n=4tGY89RiEVulg4pa&q=85&s=fd48d101e4ff4d06a673d00176e23382" size="sm" alt="Query Insights UI 查询信息" border width="591" height="961" data-path="images/cloud/sqlconsole/insights_query_info.png" />

在此面板中，可以展开每次查询运行对应的 `Settings` 和 `Profile Events` 项，以查看更多信息。

<div id="related">
  ## 相关页面
</div>

* [通知](/zh/products/cloud/features/monitoring/notifications) — 配置扩缩容事件、错误和计费相关告警
* [高级仪表板](/zh/products/cloud/features/monitoring/advanced-dashboard) — 各仪表板可视化项的详细参考
* [查询系统表](/zh/products/cloud/features/monitoring/system-tables) — 对系统表运行自定义 SQL 查询，深入查看内部信息
* [Prometheus 端点](/zh/products/cloud/features/monitoring/prometheus) — 将指标导出到 Grafana、Datadog 或其他兼容 Prometheus 的工具
