All Products
Search
Document Center

Connect ASK clusters to ARMS Prometheus Monitoring

Last Updated: Feb 04, 2021

After serverless Kubernetes (ASK) clusters are connected to Application Real-Time Monitoring Service (ARMS) Prometheus Monitoring, you can use the dashboard predefined in ARMS to monitor multiple performance metrics of the ASK clusters. This topic describes how to connect ASK clusters to ARMS Prometheus Monitoring.

Prerequisites

  • An ASK cluster is created.

    Note

    If the security group in the cluster is manually modified after it is automatically created, make sure that ports 8080, 8081, and 9335 are enabled.

  • ARMS is activated. For more information, see Activate and upgrade ARMS.

    Note

    You can receive a free 15-day trial of the Prometheus Monitoring sub-service of ARMS. After the free trial expires, you must activate the Pro Edition of ARMS Prometheus Monitoring for continual use. For more information, see the Application Real-Time Monitoring Service pricing page.

Background information

ARMS is an Application Performance Management (APM) service that contains modules such as Application Monitoring and Prometheus Monitoring. ARMS can help you perform full-stack performance monitoring and full-trace analysis in an end-to-end manner to simplify application O&M.

ARMS Prometheus Monitoring is a managed monitoring service of ARMS and compatible with the open source Prometheus ecosystem. ARMS Prometheus Monitoring monitors a wide variety of components and provides various ready-to-use predefined dashboards. You no longer need to concern yourself with managing underlying services such as data storage, data presentation, and system O&M. For more information, see What is Prometheus Service?

Install the Prometheus Monitoring agent

  1. Log on to the Container Service - Kubernetes console.

  2. In the left-side navigation pane, choose Marketplace > App Catalog.

  3. On the Alibaba Cloud Apps tab, click the ack-arms-prometheus application.

  4. Configure the parameters and select the cluster for which you want to install the agent.

    1. Select the cluster for which you want to install the agent from the drop-down list.

    2. On the Parameters tab, specify the accessKey and accessKeySecret parameters in the YAML template.

    3. Click Create.

    prometheus
  5. Check the installation result.

    Click the cluster name to go to the cluster information page. In the left-side navigation pane, choose Applications > Helm to check whether the status of arms-prom is Deployed.

View ARMS Prometheus Monitoring metrics

After the monitoring agent is installed, you can view the detailed monitoring information on the Prometheus Monitoring page in the ARMS console.

  1. In the left-side navigation pane of the Container Service - Kubernetes console, click Clusters.

  2. Find the cluster whose monitoring data you want to view and click the cluster name.

  3. On the Cluster Information page, click Prometheus Monitoring in the upper-right corner.

  4. View the Prometheus Monitoring metrics.

    You can switch between tabs to view the metrics displayed on different boards. For more information, see View Prometheus Monitoring metrics. Prometheus1In the upper-right corner, click Go to ARMS to redirect to the ARMS console and configure the Prometheus Monitoring dashboard for the cluster.Prometheus3

Configure a data collection rule for Prometheus Monitoring

ARMS Prometheus Monitoring is compatible with and provides three types of mainstream collection rules:

  • The standard open source collection rule, which can be obtained by editing the prometheus.yaml file.

  • The collection rule suitable for customizing monitoring within Kubernetes clusters. This rule can be obtained by adding ServiceMonitor.

  • The default collection rule, which can be obtained by adding annotations.

You can configure the three types of rules by using the following methods:

  • Edit prometheus.yaml

    You do not need to restart Prometheus Monitoring. You can dynamically update a collection rule by editing the prometheus.yaml file.

    1. Log on to the ARMS console and go to the Prometheus Monitoring page. Find the cluster for which you want to configure a collection rule and click Settings.

    2. On the page that appears, click the Prometheus Settings tab.

    3. Edit the Prometheus.yaml file and click Save.

      prometheus
  • Add ServiceMonitor

    After you add ServiceMonitor, you can monitor business data of applications within a Kubernetes cluster.

    1. Log on to the ARMS console and go to the Prometheus Monitoring page. Find the cluster for which you want to configure a collection rule and click Settings.

    2. On the page that appears, click the Service Discovery tab. Click Add ServiceMonitor.

    3. Enter the content by referring to the following example and click OK:

      apiVersion: monitoring.coreos.com/v1
      kind: ServiceMonitor
      metadata:
        # Enter a unique name.
        name: tomcat-demo
        # Enter a 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 destination service.yaml file.
            app: tomcat
  • Add annotations

    In the YAML file of the application, enter the following content to add annotations:

    annotations:
              prometheus.io/scrape: "true"
              prometheus.io/port: "9090"
              prometheus.io/path: "/metrics"