Prometheus is an open source tool that is used to monitor cloud-native applications. This topic shows you how to deploy a self-managed Prometheus instance to monitor Alibaba Cloud Service Mesh (ASM) instances.
Prerequisites
- A Container Service for Kubernetes (ACK) cluster is created. For more information, see Create an ACK managed cluster.
- An ASM instance is created. For more information, see Create an ASM instance.
- A Prometheus instance and a Grafana instance are deployed in the ACK cluster. For more information, see Use Prometheus to monitor an ACK cluster.
Step 1: Configure monitoring metrics
Copy the following content to the configuration file of the Prometheus instance. Then,
restart the Prometheus instance for the configuration to take effect.
scrape_configs:
# Mixer scrapping. Defaults to Prometheus and mixer on same namespace.
- job_name: 'istio-mesh'
kubernetes_sd_configs:
- role: endpoints
namespaces:
names:
- istio-system
relabel_configs:
- source_labels: [__meta_kubernetes_service_name, __meta_kubernetes_endpoint_port_name]
action: keep
regex: istio-telemetry;prometheus
# Scrape config for envoy stats
- job_name: 'envoy-stats'
metrics_path: /stats/prometheus
kubernetes_sd_configs:
- role: pod
relabel_configs:
- source_labels: [__meta_kubernetes_pod_container_port_name]
action: keep
regex: '.*-envoy-prom'
- source_labels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port]
action: replace
regex: ([^:]+)(?::\d+)?;(\d+)
replacement: $1:15090
target_label: __address__
- action: labeldrop
regex: __meta_kubernetes_pod_label_(.+)
- source_labels: [__meta_kubernetes_namespace]
action: replace
target_label: namespace
- source_labels: [__meta_kubernetes_pod_name]
action: replace
target_label: pod_name
- job_name: 'istio-policy'
kubernetes_sd_configs:
- role: endpoints
namespaces:
names:
- istio-system
relabel_configs:
- source_labels: [__meta_kubernetes_service_name, __meta_kubernetes_endpoint_port_name]
action: keep
regex: istio-policy;http-policy-monitoring
- job_name: 'istio-telemetry'
kubernetes_sd_configs:
- role: endpoints
namespaces:
names:
- istio-system
relabel_configs:
- source_labels: [__meta_kubernetes_service_name, __meta_kubernetes_endpoint_port_name]
action: keep
regex: istio-telemetry;http-monitoring
- job_name: 'pilot'
kubernetes_sd_configs:
- role: endpoints
namespaces:
names:
- istio-system
relabel_configs:
- source_labels: [__meta_kubernetes_service_name, __meta_kubernetes_endpoint_port_name]
action: keep
regex: istiod;http-monitoring
- source_labels: [__meta_kubernetes_service_label_app]
target_label: app
- job_name: 'sidecar-injector'
kubernetes_sd_configs:
- role: endpoints
namespaces:
names:
- istio-system
relabel_configs:
- source_labels: [__meta_kubernetes_service_name, __meta_kubernetes_endpoint_port_name]
action: keep
regex: istio-sidecar-injector;http-monitoring
Step 2: Enable Prometheus
Step 3: Generate monitoring metric data
Send requests to services on the data plane. In this example, the Bookinfo application
is used. For more information, see Overview. Go to the Productpage page of Bookinfo. Refresh the page multiple times. 

Verify the result
- Run the following commands to check whether Envoy proxies collect data of the specified
monitoring metrics.
Data in the command output indicates the monitoring metric data that is collected by Envoy proxies. If the command output contains no data, Envoy proxies do not collect monitoring metric data.
details=$(kubectl get pod -l app=details -o jsonpath={.items..metadata.name}) kubectl exec $details -c istio-proxy -- curl -s localhost:15090/stats/prometheus grep istio
- View the metrics that are monitored by Prometheus.
- Log on to the ACK console.
- In the left-side navigation pane of the ACK console, click Clusters.
- On the Clusters page, find the cluster that you want to manage and click its name or click Details in the Actions column.
- In the left-side navigation pane of the details page, choose .
- On the Services page, click the public endpoint of Prometheus.
- On the Prometheus page, enter istio_requests_total in the search box and click Execute. The metrics that are monitored by Prometheus are displayed.
- View the Grafana report of the monitoring metric data.
- Log on to the ACK console.
- In the left-side navigation pane of the ACK console, click Clusters.
- On the Clusters page, find the cluster that you want to manage and click its name or click Details in the Actions column.
- In the left-side navigation pane of the details page, choose .
- On the Services page, click the public endpoint of Grafana.
- On the Grafana page, select Istio Workload Dashboard in the upper-left corner. The
following figure shows the Grafana report that is displayed.