Skip to main content

Monitoring:TiDB database monitoring

HertzBeat monitors general performance metrics of TiDB through HTTP and JDBC protocol.

Metrics Schema



Protocol Use: HTTP and JDBC

Configuration parameter

Parameter nameParameter help description
Target HostMonitored IPV4, IPV6 or domain name. Note⚠️Without protocol header (eg: https://, http://)
Task nameIdentify the name of this monitoring. The name needs to be unique
Service PortThe port that the TiDB database provides externally for status reporting is 10080 by default
PD PortThe PD port for the TiDB database, which defaults to 2379
Query timeoutSet the timeout time when SQL query does not respond to data, unit: ms, default: 6000ms
JDBC PortThe TiDB database externally provides the port used for client requests, which defaults to 4000
Database nameDatabase instance name, optional
UsernameDatabase connection user name, optional
PasswordDatabase connection password, optional
JDBC URLDatabase using JDBC connection URL,optional,If configured, the database name, user name, password and other parameters in the URL will overwrite the above configured parameters
Collection intervalInterval time of monitor periodic data collection, unit: second, and the minimum interval that can be set is 30 seconds
Whether to detectWhether to detect and check the availability of monitoring before adding monitoring. Adding and modifying operations will continue only after the detection is successful
Description remarksFor more information about identifying and describing this monitoring, users can note information here

Collection Metric

The monitoring template will retrieve the monitoring metrics from the TiDB System Variables table, and the user can retrieve the TiDB System Variables Table by himself to query the required information or other system variables.

Besides, TiDB also provides default monitoring metrics table, see Metrics Schema and METRICS_SUMMARY, and users can add their own sql codes according to their needs.

Due to the large number of metrics that can be monitored, only the metrics queried in the monitoring template are described below.

Metric set: global variables

Metric NameMetric UnitMetric Help Description
versionnoneThe MySQL version, followed by the TiDB version. For example '8.0.11-TiDB-v7.5.1'.
version_commentnoneThe TiDB version. For example, 'TiDB Server (Apache License 2.0) Community Edition, MySQL 8.0 compatible'.
version_compile_machinenoneThe name of the CPU architecture on which TiDB is running.
version_compile_osnoneThe name of the OS on which TiDB is running.
max_connectionsnoneThe maximum number of concurrent connections permitted for a single TiDB instance. This variable can be used for resources control. The default value 0 means no limit. When the value of this variable is larger than 0, and the number of connections reaches the value, the TiDB server rejects new connections from clients.
datadirnoneThe location where data is stored. This location can be a local path /tmp/tidb, or point to a PD server if the data is stored on TiKV. A value in the format of ${pd-ip}:${pd-port} indicates the PD server that TiDB connects to on startup.
portnoneThe port that the tidb-server is listening on when speaking the MySQL protocol.