Prometheus Monitoring of Application Real-Time Monitoring Service (ARMS) allows you to display monitoring data on the ARMS Prometheus Grafana dashboard. You can customize a Grafana dashboard or import the dashboard from the Grafana official website. This topic describes how to customize the Grafana dashboard to display monitoring data.
Prerequisites
Step 1: Deploy the application to the Container Service Kubernetes cluster
Deploy the application to the Container Service Kubernetes cluster so that ARMS Prometheus Monitoring can monitor and capture the JVM data.
Step 2: Install the ARMS Prometheus agent for the application
Step 3: Configure the data collection rule for Prometheus Monitoring to monitor the application
After the ARMS Prometheus agent is installed, it monitors CPU information, memory information, and network information by default. If you want to monitor non-default data, such as order information, you need to configure the data collection rule for Prometheus Monitoring to monitor the application.
- Find the target cluster, and click Settings in the Actions column.
- You can configure the data collection rule for Prometheus Monitoring to monitor the
application in the following scenarios:
- To monitor the business data of applications deployed in the Kubernetes cluster, such
as order information, you can click Add ServiceMonitor on the Details tab. In the Add ServiceMonitor dialog box, enter the following information:
apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: # Enter a unique name. name: tomcat-demo # Enter the target namespace. namespace: default spec: endpoints: - interval: 30s # Enter the value of the Name field for Port of Prometheus Exporter. port: tomcat-monitor # Enter the value of the Path field for Prometheus Exporter. path: /prometheus-metrics namespaceSelector: any: true selector: matchLabels: # Enter the label field of service.yaml to locate the target service.yaml file. app: tomcat
- To monitor business data outside the Kubernetes cluster, such as the number of Redis
connections, you can click Edit prometheus.yaml on the Details tab to configure the native prometheus.yaml file. In the Edit prometheus.yaml dialog box, enter the following information:
global: scrape_interval: 15s evaluation_interval: 15s scrape_configs: - job_name: 'prometheus' static_configs: - targets: ['localhost:9090']
- To monitor the business data of applications deployed in the Kubernetes cluster, such
as order information, you can click Add ServiceMonitor on the Details tab. In the Add ServiceMonitor dialog box, enter the following information:
Step 4: Create a Grafana dashboard
- Go to Host Dashboard.
- In the left-side navigation pane, choose Add Query in the New Panel section. , and click
- Select a cluster from the drop-down list next to Query. On the A collapse panel, select a monitoring metric, for example, go_gc_duration_seconds, from the Metrics drop-down list.
- Click the chart icon on the left side of the page to select the visualization type of the dashboard, such as a chart, table, or heatmap, and configure other parameters as needed.
- Click the setting icon on the left side of the page and enter a chart name.
- Click the bell icon on the left side of the page. Click Create Alert in the Alert section to configure alerts. The subsequent alert configuration page will jump to the alert configuration page in ARMS Prometheus Monitoring.
- Click the save icon in the upper-right corner. In the Save As... dialog box, enter the dashboard name, select a cluster, and click Save to save the dashboard and chart. You can create multiple dashboards and charts as needed.
Step 5: Debug data and monitor complex metrics
To monitor metrics that involve complex operations, debug data in ARMS Prometheus Monitoring to acquire the corresponding PromQL statement.
- On the Prometheus monitoring page, click Settings in the Actions column.
- Click Data debugging. On the Explore page of ARMS Prometheus Grafana, you can enter the PromQL statement in the Metrics field for debugging.
- After successful debugging, you can repeat the preceding steps to add more dashboards or charts. For more information, see Step 4: Create a Grafana dashboard.