You need to enable JavaScript to run this app.
Volcengine Managed Service for Prometheus

Volcengine Managed Service for Prometheus

Copy page
Download PDF
Exporter integration
MongoDB exporter integration
Copy page
Download PDF
MongoDB exporter integration
Volcengine Managed Service for Prometheus (VMP) monitors the operational status of MongoDB by using the exporter. This topic describes how to deploy mongodb-exporter in a cluster and monitor MongoDB.​
Prerequisites​
  • VMP​
  • VKE​
  • A Volcano Engine root user has been created, and VKE has been activated.​
  • The VKE cluster has been integrated with VMP. For details, see VKE integration.​
  • Grafana has been deployed and integrated with the workspace.​
Procedure​
Step 1: Deploy mongodb-exporter​
  1. Log in to the VKE console.​
  1. In the left navigation pane, click Cluster. In the cluster list on the right side, find the target cluster.​
  1. Click the name of the cluster to go to the cluster details page.​
  1. Click Workload > Deployment in the left navigation pane. Click Create with Yaml to deploy mongodb-exporter.​
​
apiVersion: apps/v1​
kind: Deployment​
metadata:​
name: mongodb-exporter# Specify the name of the exporter.​
namespace: volcano-metrics# Specify the namespace where the exporter is located.​
labels: ​
app-name: mongodb-exporter# Specify the label of the exporter.​
spec:​
replicas: 1​
selector:​
matchLabels:​
app-name: mongodb-exporter# Change the name based on your business requirements. You can use the information about the MongoDB instance.​
template:​
metadata:​
labels:​
app-name: mongodb-exporter# Change the name based on your business requirements. You can use the information about the MongoDB instance.​
spec:​
containers:​
- args:​
- "--collect-all"​
- "--mongodb.uri=mongodb://<user-name>:<password>@<mongodb-address>:<mongodb-port>"​
image: bitnami/mongodb-exporter:latest# Pull the exporter image from Docker Hub.​
imagePullPolicy: IfNotPresent​
name: mongodb-exporter# Specify the container name.​
ports:​
- containerPort: 9216# Specify the container port number.​
name: metric-port# Specify the container port name.​
dnsPolicy: ClusterFirst​
restartPolicy: Always​
terminationGracePeriodSeconds: 30​
​
tip​
In this example, --collect-all is used to collect all metrics of MongoDB. You can also adjust the collection scope by specifying the appropriate parameters. For details, see mongodb-exporter.​
Step 2: Configure a collection rule​
  1. In the left navigation pane of the cluster details page, click Workload > Resource Explorer.​
  1. Click Create with Yaml to configure a collection rule by using PodMonitor.​
  • Select Custom from the Type list.​
  • Enter the YAML configuration in the Yaml field.​
​
apiVersion: monitoring.coreos.com/v1​
kind: PodMonitor​
metadata:​
name: mongodb-exporter# Specify the name of PodMonitor.​
namespace: volcano-metrics# Specify the namespace of PodMonitor.​
labels: ​
volcengine.vmp: "true"# Configure the labels for PodMonitor to allow the labels to be identified by prometheus-agent.​
spec:​
podMetricsEndpoints:​
- interval: 30s​
port: metric-port# Specify the container port name of the exporter.​
path: /metrics# Specify the URI path for metric exposure. The value is /metrics by default if it is not specified.​
relabelings:# Configure metric relabeling. If this parameter is not required, it can be omitted.​
- action: replace​
sourceLabels:​
- instance​
regex: (.*)​
targetLabel: instance​
replacement: 'mongodb-xxxxxx'# Specify the ID of the MongoDB instance.​
namespaceSelector:​
matchNames: ​
- volcano-metrics# Specify the namespace of the exporter.​
selector: ​
matchLabels:​
app-name: mongodb-exporter# Specify the label value of the exporter to locate and select the target pod.​
​
Validate results​
  1. Execute the following command to configure Grafana port forwarding:​
​
kubectl port-forward service/grafana 3000:3000 -n volcano-metrics​
​
  1. Open a browser in your local environment (Linux/Mac), paste localhost:3000 into the address bar, and then press Enter to go to the Grafana login page. Log in to Grafana by using the default username admin and password admin.​
  • ​alt​​
  1. After you log in to Grafana, you can create a dashboard to view the metric information of MongoDB.​
  • ​alt​​
tip​
For detailed parameters of mongodb-exporter, refer to mongodb-exporter.​
​
Last updated: 2026.10.10 10:16:50