Prometheus Monitoring of Application Real-Time Monitoring Service (ARMS) allows you
to monitor MySQL by capturing MySQL data and displaying the captured data on the ARMS
Prometheus Grafana dashboard.
Step 1: Capture MySQL data through an external application
Deploy an application by using the mysqld-exporter image officially provided by Prometheus
to the Container Service Kubernetes cluster to capture MySQL data.
- Log on to the Alibaba Cloud Container Service for Kubernetes console.
- In the left-side navigation pane, choose . On the Clusters page, find the target cluster, and click Dashboard in the Actions column.
- In the left-side navigation pane, choose . In the upper-right corner, click CREATE, and enter the following information in the CREATE FROM TEXT INPUT section:
Note Change the values of <yourMySQLUsername>, <yourMySQLPassword>, <IP>, and <port> to those of MySQL.
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: mysqld-exporter
spec:
replicas: 1
template:
metadata:
labels:
app: mysqld-exporter
spec:
containers:
- name: mysqld-exporter
imagePullPolicy: Always
env:
- name: DATA_SOURCE_NAME
value: "<yourMySQLUsername>:<yourMySQLPassword>@(<IP>:<port>)/"
image: prom/mysqld-exporter
ports:
- containerPort: 9104
name: mysqld-exporter
In this step, the mysqld-exporter application is deployed to the Container Service
Kubernetes cluster.
- In the left-side navigation pane, choose . In the upper-right corner, click CREATE, and enter the following information in the CREATE FROM TEXT INPUT section:
apiVersion: v1
kind: Service
metadata:
labels:
app: mysqld-exporter
name: mysqld-exporter
spec:
ports:
- name: mysqld-exporter
port: 9104
protocol: TCP
targetPort: 9104
type: NodePort
selector:
app: mysqld-exporter
Step 2: Configure ARMS Prometheus Monitoring to receive MySQL data
Configure ARMS Prometheus Monitoring in the ARMS console to receive MySQL data captured
through external applications.
- Log on to the ARMS console.
- In the left-side navigation pane, click Prometheus Monitoring.
- On the top of the Prometheus monitoring page, select the region where the Container Service Kubernetes cluster is located.
Find the target cluster, and click Installation in the Actions column.
- After the ARMS Prometheus agent is installed, find the target cluster, and click Settings in the Actions column.
- On the Details tab, click Add ServiceMonitor. In the Add ServiceMonitor dialog box, enter the following information:
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
app: mysqld-exporter
release: p
name: mysqld-exporter
# namespace: monitoring
# The Prometheus namespace
spec:
endpoints:
- interval: 30s
# The Mysqld Grafana template ID is 7362.
# Enter the value of the Name field for Port of Prometheus Exporter in the service.yaml file.
port: mysqld-exporter
# Enter the path exposed in Prometheus Exporter code.
path: /metrics
namespaceSelector:
any: true
# The namespace of the NGINX Demo
selector:
matchLabels:
app: mysqld-exporter
Step 3: Display the MySQL data on the Grafana dashboard
Import the Grafana dashboard template in the ARMS console and specify the Container
Service Kubernetes cluster where the Prometheus data source is located.
- Go to Host Dashboard.
- In the left-side navigation pane, choose , enter 7362 in the Grafana.com Dashboard field, and click Load.
- On the Import page, set the following information and click Import.
- Enter a custom dashboard name in the Name field.
- Select your Container Service Kubernetes cluster from the Folder drop-down list.
- Select your Container Service Kubernetes cluster from the prometheus drop-down list.
After the configuration is complete, the ARMS Prometheus Grafana MySQL dashboard appears,
as shown in the following figure.

What to do next
After the ARMS Prometheus Grafana MySQL dashboard is configured, you can view Prometheus
Monitoring metrics and customize the dashboard. For more information, see the following
documents.