All Products
Search
Document Center

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

Last Updated:Jul 16, 2026

Sebarkan exporter QCloud open-source untuk memantau sumber daya Tencent Cloud dengan Managed Service for Prometheus.

Prasyarat

Informasi latar belakang

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

Cloud Monitor (CM) Tencent Cloud menyediakan pemantauan waktu nyata dan peringatan untuk sumber daya Tencent Cloud seperti cloud server dan database. Exporter QCloud adalah exporter pihak ketiga Prometheus yang mendukung sumber daya Tencent Cloud berikut.

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: Sebarkan QCloud exporter

  1. Buat 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"  # SecretId dari cloud API.
      secret_key: "secret_key"  # SecretKey dari cloud API.
      region: "ap-nanjing"      # Wilayah tempat instans berada.
    
    rate_limit: 15              # Batas laju pengambilan data dari Cloud Monitor. Maksimum adalah 20 panggilan/detik atau 1.200 panggilan/menit. Untuk informasi selengkapnya, lihat https://cloud.tencent.com/document/product/248/31014.
    
    products:
      - namespace: QCE/CVM      # Untuk detail metrik, lihat https://cloud.tencent.com/document/product/248/6843.
        all_metrics: true       # Ekspor semua metrik yang didukung.
        all_instances: true     # Ekspor semua instans di wilayah tersebut.
        #only_include_metrics: []
        #only_include_instances: [ins-xxxxxxxx]
        extra_labels: [InstanceId, InstanceName] # Ekspor bidang instans sebagai label metrik.
        #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. Sebarkan QCloud exporter.

    Bangun image Docker dengan file konfigurasi dan dorong 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 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 service.

      1. Di panel navigasi 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 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 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.

    Daftar menampilkan catatan bernama qcloud-exporter dengan namespace default, label pencocokan {matchLabels={app=...}}, selektor {any=true}, status ditampilkan berwarna hijau (diaktifkan), dengan operasi Delete dan Edit di sisi kanan.

Langkah 3: Buat aturan peringatan

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