Configuration of User Password Parameters in Grafana

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: granfana配置用户密码参数

| username: 呢莫不爱吃鱼

[TiDB Usage Environment] Production Environment / Testing / PoC
[TiDB Version]
[Reproduction Path]
[Encountered Issue: By using the tiup cluster edit-config parameter, you can see the configuration of the username and password in grafana_servers, which are both set to admin by default. However, after modifying the username and password and updating the cluster configuration, the changes do not take effect. If this parameter cannot modify the relevant configuration, why is it retained?
[Resource Configuration] Go to TiDB Dashboard - Cluster Info - Hosts and take a screenshot of this page
[Attachment: Screenshot/Logs/Monitoring]
image

| username: Kongdom | Original post link

:thinking: Can it be understood as the initial default configuration? Waiting for the official response.

| username: 呢莫不爱吃鱼 | Original post link

I’m considering whether this configuration will conflict with changing the password after logging into Grafana. If the password is changed from the Grafana side, and then other configuration parameters are modified from the configuration file, it might cause the Grafana password to reset to admin…

| username: zhaokede | Original post link

It might be the initial configuration. After logging in and making changes, it is no longer read from here.

| username: Kongdom | Original post link

:flushed: I don’t think it will be like that.

| username: DBRE | Original post link

Try reloading the Grafana node.

| username: Daniel-W | Original post link

This should only be the initial configuration parameters. You can change the Grafana password directly on the Grafana page.

| username: WinterLiu | Original post link

Blind guessing is only used for initialization.

| username: 小龙虾爱大龙虾 | Original post link

Only useful during initialization.

| username: Jack-li | Original post link

It should be the initial default value.

| username: zhh_912 | Original post link

Initialization parameters

| username: 友利奈绪 | Original post link

It should be the initial default value.

| username: TiDBer_QYr0vohO | Original post link

You can set it before deployment, but after initialization, you can only use the Grafana CLI to modify it.

| username: TiDBer_小阿飞 | Original post link

When deploying a TiDB cluster using TiUP, TiUP will automatically deploy monitoring components such as Prometheus, Grafana, and Alertmanager, and automatically add monitoring configurations for new nodes during cluster expansion.

Note:

  • When customizing the configuration of monitoring components, do not directly modify the configuration files of the monitoring components. This is because during operations such as deploy/scale-out/scale-in/reload, TiUP will use its own configuration parameters to overwrite the monitoring components’ configurations.
  • If the monitoring components are not deployed and managed by TiUP, you can directly modify the configuration files of the monitoring components without referring to this document.
  • The functionality described in this document is supported in TiUP v1.9.0 and later versions. Please check the TiUP version number before using this feature.
    自定义监控组件的配置 | PingCAP 文档中心
| username: TiDBer_小阿飞 | Original post link

Custom Grafana Configuration

Currently, TiUP supports custom Grafana Dashboard and other configurations.

Custom Grafana Dashboard

  1. Place the custom Dashboard configuration file in a directory on the machine where TiUP is located.
  2. In the topology configuration file topology.yaml of the TiDB cluster, set the dashboard_dir to the directory where the custom Dashboard configuration file is actually placed.
    Below is an example of the grafana_servers configuration in the topology.yaml file:
# # Server configs are used to specify the configuration of Grafana Servers.
grafana_servers:
  # # The ip address of the Grafana Server.
  - host: 127.0.0.1
    dashboard_dir: /home/tidb/dashboards   # grafana dashboard dir on TiUP machine

After the above configuration, during deploy/scale-out/scale-in/reload operations of the cluster, TiUP will read the custom Dashboard from the local path /home/tidb/dashboards and then send this configuration to the Grafana Server, replacing the default configuration rules.

Custom Grafana Other Configurations

  1. Open the cluster configuration file topology.yaml.
  2. Add other configurations in the grafana_servers section.
    Below is an example of the [log.file] level field and smtp configuration in the topology.yaml file:
# # Server configs are used to specify the configuration of Grafana Servers.
grafana_servers:
  # # The ip address of the Grafana Server.
  - host: 127.0.0.1
    config:
      log.file.level: warning
      smtp.enabled: true
      smtp.host: {IP}:{port}
      smtp.user: example@pingcap.com
      smtp.password: {password}
      smtp.skip_verify: true

After the above configuration, during deploy/scale-out/scale-in/reload operations of the cluster, TiUP will add the contents of the config field to the grafana configuration file grafana.ini.