All Products
Search
Document Center

Managed Service for Prometheus:Pantau sumber daya Tencent Cloud dengan Prometheus

Last Updated:Jun 17, 2026

Anda dapat menggunakan Managed Service for Prometheus untuk memantau sumber daya Tencent Cloud dengan men-deploy QCloud exporter open-source.

Prasyarat

Informasi latar belakang

QCloud exporter open-source mengonversi metrik dari Tencent Cloud Monitor ke dalam format Prometheus. Prometheus kemudian mengambil metrik tersebut dari exporter untuk memantau sumber daya Tencent Cloud.

Cloud Monitor (CM) Tencent Cloud menyediakan pemantauan waktu nyata dan peringatan terpadu untuk sumber daya Tencent Cloud seperti cloud server dan cloud database. QCloud exporter merupakan Prometheus third-party exporter. Tabel berikut mencantumkan sumber daya Tencent Cloud yang didukung.

Product

Namespace

Supported metrics

TencentDB for MongoDB

QCE/CMONGO

Metric details

Cloud Database (CDB)

QCE/CDB

Metric details

TencentDB for Redis (Standard Edition)

QCE/REDIS

Metric details are not available.

TencentDB for Redis (Cluster Edition)

QCE/REDIS_CLUSTER

Metric details are not available.

TencentDB for Redis (Memory Edition)

QCE/REDIS_MEM

Metric details

cloud server

QCE/CVM

Metric details

Cloud Object Storage (COS)

QCE/COS

Metric details

Content Delivery Network (CDN)

QCE/CDN

Metric details

Cloud Load Balancer (public network)

QCE/LB_PUBLIC

Metric details

Cloud Load Balancer (Layer-7)

QCE/LOADBALANCE

Metric details

NAT Gateway

QCE/NAT_GATEWAY

Metric details

Direct Connect

QCE/DC

Metric details

Direct Connect Tunnel

QCE/DCX

Metric details

cloud disk

QCE/CBS

Metric details

TencentDB for SQL Server

QCE/SQLSERVER

Metric details

TencentDB for MariaDB

QCE/MARIADB

Metric details

Elasticsearch Service

QCE/CES

Metric details

Cloud Message Queue (CMQ) Queue Service

QCE/CMQ

Metric details

CMQ Topic Subscription

QCE/CMQTOPIC

Metric details

TencentDB for PostgreSQL

QCE/POSTGRES

Metric details

CKafka instance

QCE/CKAFKA

Metric details

Memcached

QCE/MEMCACHED

Metric details are not available.

Lighthouse

QCE/LIGHTHOUSE

Metric details are not available.

TDSQL for MySQL

QCE/TDMYSQL

Metric details

Elastic IP Address (EIP)

QCE/LB

Metric details

Prosedur

Diagram berikut menunjukkan alur kerja untuk memantau sumber daya Tencent Cloud dengan Managed Service for Prometheus.

Langkah 1: Deploy QCloud exporter

  1. Bangun image.

    git clone https://github.com/tencentyun/tencentcloud-exporter.git
    make build
  2. Tentukan konfigurasi instans produk.

    • Konfigurasikan informasi kredensial untuk cloud API.

    • Konfigurasikan produk, metrik, dan instans yang akan diekspor.

    Sebagai contoh, untuk mengekspor semua metrik dan instans untuk cloud server, gunakan konfigurasi berikut.

    credential:
      access_key: "access_key"  # The SecretId of the cloud API.
      secret_key: "secret_key"  # The SecretKey of the cloud API.
      region: "ap-nanjing"      # The region where the instance is located.
    
    rate_limit: 15              # The rate limit for pulling data from Cloud Monitor. The maximum is 20 calls/second or 1,200 calls/minute. For more information, see https://cloud.tencent.com/document/product/248/31014.
    
    products:
      - namespace: QCE/CVM      # For metric details, see https://cloud.tencent.com/document/product/248/6843.
        all_metrics: true       # Export all supported metrics.
        all_instances: true     # Export all instances in the region.
        #only_include_metrics: []
        #only_include_instances: [ins-xxxxxxxx]
        extra_labels: [InstanceId, InstanceName] # Export instance fields as metric labels.
        #statistics_types: [last]
        #period_seconds: 60
        #metric_name_type: 2
    Catatan

    Untuk informasi selengkapnya tentang cara mengonfigurasi file qcloud.yaml, lihat dokumentasi tencentcloud-exporter.

  3. Deploy QCloud exporter.

    Bangun image Docker dengan file konfigurasi dan unggah ke repositori, seperti Docker Hub atau Container Registry (ACR).

    1. Masuk ke ACK console. Di panel navigasi kiri, klik Clusters.

    2. Pada halaman Clusters, temukan kluster target dan klik Applications di kolom Operation.

    3. Buat Deployment.

      1. Di panel navigasi sebelah kiri, pilih Workload > Stateless.

      2. Pada halaman Stateless, klik Create Resources in YAML.

      3. Pada halaman Create , masukkan YAML berikut di editor Template dan klik Create .

        apiVersion: apps/v1
        kind: Deployment
        metadata:
          generation: 5
          labels:
            app: qcloud-exporter-demo
          name: qcloud-exporter-demo
          namespace: default
        spec:
          replicas: 1
          selector:
            matchLabels:
              app: qcloud-exporter-demo
          template:
            metadata:
              labels:
                app: qcloud-exporter-demo
            spec:
              containers:
                - args:
                    - '--config.file=/usr/local/etc/qcloud-cvm-product.yml'
                  image: 'registry.cn-hangzhou.aliyuncs.com/fuling/qcloud-exporter:v0.1'
                  imagePullPolicy: Always
                  name: qcloud-exporter
                  ports:
                    - containerPort: 9123
                      name: web-normal
                      protocol: TCP
    4. Buat layanan.

      1. Di panel navigasi sebelah kiri, pilih Network > Service.

      2. Pada halaman Service, klik Create Resources in YAML.

      3. Pada halaman Create , masukkan YAML berikut di editor Template dan klik Create .

        apiVersion: v1
        kind: Service
        metadata:
          labels:
            app: qcloud-exporter-demo
          name: qcloud-exporter-demo-svc
          namespace: default
        spec:
          ports:
            - name: qcloud-exporter-metrics
              port: 9123
              protocol: TCP
              targetPort: 9123
          selector:
            app: qcloud-exporter-demo

Langkah 2: Konfigurasikan penemuan layanan

Konfigurasikan penemuan layanan di Managed Service for Prometheus untuk mengambil metrik dari QCloud exporter.

Penting

Pastikan kluster ACK Anda telah terhubung ke Managed Service for Prometheus. Untuk informasi selengkapnya, lihat Prometheus instance for Container Service.

  1. Masuk ke Managed Service for Prometheus console.

  2. Di panel navigasi kiri, klik Instances.

  3. Di bilah menu atas, pilih wilayah kluster ACK Anda, lalu klik nama instans target.

  4. Di panel navigasi sebelah kiri, klik Service Discovery, lalu klik tab Configurations.

  5. Pada halaman Configurations, klik tab ServiceMonitor, lalu klik Add ServiceMonitor, dan pada kotak dialog Add ServiceMonitor, masukkan konten berikut dan klik OK.

    apiVersion: monitoring.coreos.com/v1
    kind: ServiceMonitor
    metadata:
      name: qcloud-exporter-sm
      namespace: default
    spec:
      endpoints:
      - interval: 60s
        path: /metrics
        port: qcloud-exporter-metrics
        scrapeTimeout: 60s
      namespaceSelector:
        any: true
      selector:
        matchLabels:
          app: qcloud-exporter-demo

    Konfigurasi penemuan layanan baru muncul di halaman ServiceMonitor.

    image

Langkah 3: Buat aturan peringatan

Buat aturan peringatan Prometheus. Untuk petunjuknya, lihat Create a Prometheus alert rule.