# Monitoring System for TiDB Databases

__*TiDB monitoring system*__
__*TiDB Grafana architecture*__

![left](./student-guide/diagram/DatabaseMonitoringSystem_en_001_20220621.png)
-------------------------------------------------------------
Monitoring systems play a very important role in finding and solving problems in our daily operation and development process. Here, we will introduce the monitoring method of Prometheus+ Grafana and the graphical interface TiDB Dashboard provided by TiDB since version 4.0.

Let's first take a look at the monitoring method of Prometheus+ Grafana. The monitoring system of the TiDB database is shown by the timing database Prometheus as the monitoring and performance index information storage scheme, and Grafana as a visual component.

First, let's take a look at the application of the time series database Prometheus in monitoring systems. TiDB currently uses the following components:
  - Prometheus Server: Used to collect and store time series data.
  - Client codebase: Used to customize the metrics needed in the program.
  - Alertmanager: Used to implement the alarm mechanism.

In the figure, we can see that Prometheus Server pulls and stores the monitored metrics of the monitored TiDB instance, PD instance, and TiKV instance.

Second, TiDB uses Grafana to display the monitoring of various components of a TiDB cluster. Grafana is an open source metric analysis and visualization system, and a very popular monitoring software analysis and display platform.

Finally, if the data stored in the Prometheus Server exceeds the set threshold, the Alertmanager module is started for alertmanager processing.

In addition, the TiDB Dashboard is a graphical interface provided by TiDB since version 4.0. It can be used to monitor and diagnose TiDB clusters. The TiDB Dashboard is built into the PD component of TiDB, so there is no need to deploy it independently.