Enabling Monitoring for Existing Clusters
Monitoring data collection for the PolarDB-X Enterprise Edition is turned off by default and needs to be configured to enable it.
Enabling Monitoring for Existing PolarDB-X Enterprise Edition
This section explains how to enable monitoring for PolarDB-X Enterprise Edition clusters. Execute the following command to create a PolarDBXMonitor object for the PolarDBXCluster you wish to monitor:
kubectl apply -f polardbx-monitor.yaml
The yaml description of polardbx-monitor.yaml is as follows:
- spec.clusterName: The name of the PolarDB-X cluster to enable monitoring for.
- spec.monitorInterval: The frequency of monitoring data collection, default is 30s.
- spec.scrapeTimeout: The timeout for monitoring data collection, default is 10s. Note: The value of scrapeTimeout must be less than monitorInterval.
Enabling Monitoring for Existing PolarDB-X Standard Edition
This section explains how to enable monitoring for PolarDB-X Standard Edition clusters. Execute the following command to configure a ServiceMonitor for your XStore object to enable monitoring:
kubectl apply -f polardbx-s-monitor.yaml
The content of polardbx-s-monitor.yaml is as follows:
# Name of the ServiceMonitor object, you can define it yourself
# Name of the PolarDB-X Standard Edition (XStore) to enable monitoring for
# Metrics service, no need to modify
# The following content uses default configuration and does not need to be modified
- port: metrics
- sourceLabels: [xstore_name]
- targetLabel: polardbx_role
Note: In the yaml file above, modify spec.selector.matchLabels.xstore/name and metadata.name to the name of the xstore object you want to enable monitoring for. Other contents do not need to be modified.