Volcengine Managed Service for Prometheus supports monitoring cloud services such as Volcengine Kubernetes Engine (VKE) and also supports service discovery through ServiceMonitor, PodMonitor, and Service/Pod annotations. However, sometimes after you complete the configuration, you cannot correctly retrieve the expected metrics. This article introduces how to troubleshoot such issues.
Issue symptoms
When using Volcengine Managed Service for Prometheus (VMP) for monitoring VKE clusters, after turning on resource monitoring or configuring ServiceMonitor or PodMonitor, the expected metric data is not collected.
Cause Analysis
Possible reasons why you cannot view the expected metrics include:
- Query statement errors leading to failure to query the correct results.
- Confirm that the Target is discovered and collected normally.
- Service discovery configuration error caused the Target to be incorrectly detected.
- Abnormality in business Pod itself and collection endpoint.
- The queried metric is incorrect.
Troubleshooting Steps
Step One: Confirm Metric Query and Writing
Confirm whether the metric exists
- On the top navigation bar, select the target region.
- Click Explore on the left navigation bar to go to the Explore page.
- Configure the Workspace parameter for which you want to query metrics in the upper right corner, and enter the corresponding metric name in the Metric Query text box to confirm whether the metric has been collected and stored.
-
Confirm the metric query statement
When querying metrics, please first confirm that the query statement you use is correct. An incorrect query statement will result in wrong queried metrics or simply no results being returned.
If there is a problem with the query statement, please modify it in time. For how to use query statements, please refer to PromQL Basic Usage. - Click Workspace on the left navigation bar, select the workspace you want to view monitoring data from the workspace list, and click the Workspace Name to enter the workspace configuration page.
- Click Monitor in the left navigation bar.
- On the monitoring page, check the workspace's self-monitoring to see if there is any traffic being rate-limited or lost.
Step 2: Confirm that the target is discovered and collected as expected
You can follow the steps below to determine whether the collector correctly discovers the Target and collects data normally:
(Recommended) Method One: Confirm the Target status via prometheus-agent dashboard
prometheus-agent provides a user-friendly troubleshooting page that can be relied on to troubleshoot issues in most scenarios.
- Access the prometheus-agent dashboard.
- Access through a local browser
- Use port-forward to access the prometheus-agent port locally.
tip
- Make sure your local machine can access the dashboard over the public network through kubeconfig. Alternatively, you can use a tunnel to connect your local machine to the Kubernetes prometheus-agent network.
- By default, it listens on the local localhost port. If you need to listen on all network interfaces, please add --address 0.0.0.0 in the command line.
- kubectl -nkube-system port-forward svc/vmagent-prometheus-agent 8429:8429 --address 0.0.0.0
- Access locally at localhost:8429.
- You need to pay attention to the targets and service-discovery modules. The homepage is shown as follows.
-
- Alternative methods when local access is not available
- In some scenarios, you may not be able to access the dashboard from your local browser (for example, you only have temporary kubectl read permissions for troubleshooting). In this case, you can only execute kubectl port-forward and call the prometheus-agent API with curl to view the JSON response.
- Click on the targets of the prometheus-agent to check whether Targets are normally collected.
-
- The Target name comes from the configured job name, but if you use the CR method to configure, the naming format of job is:
Method Two: Confirm Target status through the console
warning
You can view whether the corresponding service is correctly discovered through the prometheus-agent dashboard; it cannot be viewed in the console.
- On the top navigation bar, select the target region.
- Click Explore on the left navigation bar to go to the Explore page.
- Configure the Workspace parameter for which you want to query metrics in the upper right corner, and enter up{job="xxxx"} in the text box of Metric Query to check whether the corresponding service is correctly discovered.
-
Verification results and solutions
Step Three: Check the collector status
Method One: Use kubectl to check the sampler status
Method Two: Use the console to check the sample status
- Select Cluster in the left menu bar, and select the cluster where the collector is located from the cluster list on the right side.
- Click the name of the cluster to go to the cluster configuration page.
- Select Workload > StatefulSet in the left navigation bar, and under the kube-system namespace, view the Pod status and log of the collector vmagent-prometheus-agent.
-
Verification results and solutions
Check prometheus-agent status
Collection and sending link abnormality
Possible causes include:
- Network issues of exporter and prometheus-agent
tip
Please ensure that the exporter status is normal and the security groups are configured correctly first.
- Problem exists in prometheus-agent itself
- Issues from prometheus-agent to vmp workspace.
Please troubleshoot by combining Checking prometheus-agent Logs and the prometheus-agent Basic Metric monitoring panel. For the specific procedure, please refer to Checking prometheus-agent Status. Step Four: Check metrics in collection targets
You can follow the steps below to confirm the required metrics exist in the Target:
- In the local environment, use kubectl to connect to the cluster where the collector is located, and check for status abnormality in Exporter.
- Confirm whether the Metrics interface is abnormal or metrics are not exposed.
- On the prometheus-agent dashboard, click the Active targets tab to view the corresponding target response.
-
- If the port is inaccessible, the status will not be UP; please check the Error status displayed accordingly.
- If you want to confirm whether some metrics are missing, directly search for the corresponding metric name on the returned metrics page.
- Manually check with curl
- Execute the following command to map the port of the collection target (e.g., Exporter) to the local environment.
tip
- The collection target may be deployed inside the cluster or outside the cluster (e.g., deployed on an ECS host); this example uses the case where the collection target is deployed inside the cluster. If the collection target is deployed outside the cluster, you can directly access the collection target using curl http://target-ip:port/metrics.
- rabbitmq-exporter-5fxxxx is the instance name of the collection target. This example uses RabbitMQ-Exporter as an example. You need to replace it with the instance name of your collection target in the actual operation.
- 9419 is the port number for exposing metrics of this collection target. The port numbers differ for different collection targets. You need to replace them with the correct port numbers in the actual operation.
- -n volcano-metrics is the namespace where the collection target is located. You need to replace it with the namespace of the collection target in the actual operation.
- Open a browser in the local environment (Linux/Mac), enter localhost:9419 in the address bar to enter the collection target page, and check whether the metrics you queried are being correctly collected.
-
- If your queried metrics are still not being collected correctly, the following possibilities exist:
- The metric you queried has been deprecated. Please refer to the official document for this collection target to confirm.
- You have not yet completed the configuration corresponding to the metric. e.g.: In Kafka, if you have not configured Topic, you cannot query metrics related to Topic such as kafka_topic_partitions.