Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions tiup/customized-montior-in-tiup-environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,30 @@ monitoring_servers:

上述配置后,在集群进行 deploy/scale-out/scale-in/reload 操作时,TiUP 会将 additional_scrape_conf 字段的内容会添加到 Prometheus 配置文件的对应参数中。

### 自定义 Prometheus 外部标签

从 TiUP v1.17.0 开始,你可以在拓扑文件中配置 Prometheus 全局 `external_labels`。

1. 打开 TiDB 集群的拓扑配置文件 `topology.yaml`。

2. 在 `monitoring_servers` 的配置部分添加 `external_labels` 字段。

以下为 `topology.yaml` 文件中的 `monitoring_servers` 配置示例:

```yaml
monitoring_servers:
- host: xxxxxxx
external_labels:
environment: production
region: us-east-1
```

3. 不要配置保留 label `cluster` 和 `monitor`,也不要使用以 `__` 开头的 label 名;所有 label 名都必须符合 Prometheus 标签命名规则。

完成上述配置后,当你部署、扩容、缩容或重载 TiDB 集群时,TiUP 会将 `external_labels` 字段渲染到 Prometheus 全局 `external_labels` 配置中。

如果使用不支持该字段的早期版本 TiUP 打开拓扑配置文件,TiUP 不会忽略该字段,而是会解析拓扑配置失败。

## 自定义 Grafana 配置

目前,TiUP 支持自定义 Grafana Dashboard 和其他配置。
Expand Down
4 changes: 4 additions & 0 deletions tiup/tiup-cluster-topology-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,7 @@ scheduling_servers:
- `arch`:`host` 字段所指定的机器的架构,若不指定该字段,则默认为 `global` 中的 `arch`
- `resource_control`:针对该服务的资源控制,如果配置了该字段,会将该字段和 `global` 中的 `resource_control` 内容合并(若字段重叠,以本字段内容为准),然后生成 systemd 配置文件并下发到 `host` 指定机器。`resource_control` 的配置规则同 `global` 中的 `resource_control`
- `additional_args`:从 TiUP v1.15.0 开始引入,用于配置 Prometheus 额外运行参数。该字段是一个数组,数组元素为 Prometheus 运行参数。例如,要开启 Prometheus 热加载功能,可以将该字段配置为 `--web.enable-lifecycle`
- `external_labels`:从 TiUP v1.17.0 开始引入,该字段用于以键值对的形式配置 Prometheus 全局 `external_labels`。你可以使用该字段为 Prometheus 的 `remote_write`、联邦抓取 (federation) 和告警附加稳定元数据。TiUP 会自动管理并保留 `cluster` 和 `monitor` 标签,因此不要在该字段中配置这些标签。此外,以 `__` 开头的标签名称同样是保留的,所有标签名称都必须符合 Prometheus 标签命名规则。如果使用不支持该字段的早期版本 TiUP 读取拓扑配置文件,TiUP 不会忽略该字段,而是直接解析失败。
- `additional_scrape_conf`:自定义 Prometheus scrape 配置。在集群进行 deploy/scale-out/scale-in/reload 操作时,TiUP 会将 `additional_scrape_conf` 字段的内容添加到 Prometheus 配置文件的对应参数中。更多信息,请参考[自定义监控组件的配置](/tiup/customized-montior-in-tiup-environment.md#自定义-prometheus-scrape-配置)

以上所有字段中,部分字段部署完成之后不能再修改。如下所示:
Expand All @@ -555,6 +556,9 @@ monitoring_servers:
rule_dir: /local/rule/dir
additional_args:
- --web.enable-lifecycle
external_labels:
environment: production
region: us-east-1
remote_config:
remote_write:
- queue_config:
Expand Down
4 changes: 4 additions & 0 deletions tiup/tiup-dm-topology-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ worker_servers:
- `remote_write`:参考 Prometheus [`<remote_write>`](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_write) 文档
- `remote_read`:参考 Prometheus [`<remote_read>`](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_read) 文档
- `external_alertmanagers`:若配置了 `external_alertmanagers`,Prometheus 会将配置行为报警通知到集群外的 Alertmanager。该字段为一个数组,数组的元素为每个外部的 Alertmanager,由 `host` 和 `web_port` 字段构成
- `external_labels`:从 TiUP v1.17.0 开始引入,该字段用于以键值对的形式配置 Prometheus 全局 `external_labels`。你可以使用该字段为 Prometheus 的 `remote_write`、联邦抓取 (federation) 和告警附加稳定元数据。TiUP 会自动管理并保留 `cluster` 和 `monitor` 标签,因此不要在该字段中配置这些标签。此外,以 `__` 开头的标签名称同样是保留的,所有标签名称都必须符合 Prometheus 标签命名规则。如果使用不支持该字段的早期版本 TiUP 读取拓扑配置文件,TiUP 不会忽略该字段,而是直接解析失败。
- `os`:`host` 字段所指定的机器的操作系统,若不指定该字段,则默认为 `global` 中的 `os`
- `arch`:`host` 字段所指定的机器的架构,若不指定该字段,则默认为 `global` 中的 `arch`
- `resource_control`:针对该服务的资源控制,如果配置了该字段,会将该字段和 `global` 中的 `resource_control` 内容合并(若字段重叠,以本字段内容为准),然后生成 systemd 配置文件并下发到 `host` 指定机器。`resource_control` 的配置规则同 `global` 中的 `resource_control`
Expand All @@ -219,6 +220,9 @@ worker_servers:
monitoring_servers:
- host: 10.0.1.11
rule_dir: /local/rule/dir
external_labels:
environment: production
region: us-east-1
remote_config:
remote_write:
- queue_config:
Expand Down
Loading