tencent cloud

Feedback

Connecting to Prometheus

Last updated: 2024-11-07 14:49:02

    Overview

    By default, a CKafka Pro Edition instance allows connection with external monitoring services for instance monitoring through the provided access point, including monitoring metrics of open-source Kafka such as unsynced replicas and incoming message rate.
    CKafka Pro Edition instances currently provide Prometheus to scrape the metric information of broker nodes, including basic monitoring metrics such as CPU, memory usage, and system load, as well as the metrics exposed by the broker's JMX.

    Directions

    1. Log in to the CKafka console.
    2. Select Instance List on the left sidebar and click the ID of the target instance to enter its basic information page.
    3. Click Get Monitoring Target in the top-right corner of the Prometheus Monitoring module and select the VPC and subnet.
    4. Click Submit to obtain a set of monitoring targets.
    
    5. In the Prometheus Monitoring instance, click Retrieve again in the top-right corner to delete the current monitoring addresses under the existing network.
    
    6. Click Confirm to retrieve the monitoring targets again.
    
    7. Download Prometheus and configure the monitoring scrape address.
    7.1 Enter the directory of the Prometheus package and run the following command to decompress it.
    tar -vxf prometheus-2.30.3.linux-amd64.tar.gz
    7.2 Modify the prometheus.yml configuration file by adding the jmx_exporter and node_exporter scrape tasks.
    scrape_configs:
    # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
    - job_name: "prometheus"
    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.
    static_configs:
    - targets: ["localhost:9090"]
    
    - job_name: "broker-jmx-exporter"
    scrape_interval: 5s
    metrics_path: '/metrics'
    static_configs:
    - targets: ['10.x.x.0:60001','10.x.x.0:60003','10.x.x.0:60005']
    labels:
    application: 'broker-jmx'
    - job_name: "broker-node-exporter"
    scrape_interval: 10s
    metrics_path: '/metrics'
    static_configs:
    - targets: ['10.x.x.0:60002','10.x.x.0:60004','10.x.x.0:60006']
    labels:
    application: 'broker-node'
    Here, broker-jmx-exporter is the tag configured for the jmx metric of the broker scraped by Prometheus, Targets contains the information of the mapped port, broker-node-exporter is the tag configured for the basic metrics of the node of the scraped broker, and scrape_interval is the frequency of scraping metric data.
    7.3 Start Prometheus.
    ./prometheus --config.file=prometheus.yml --web.enable-lifecycle
    7.4 Open the UI provided by Prometheus to check whether the connected targets are normal by entering http://localhost:9090 in the browser for example.
    
    7.5 Confirm that all targets are in UP status.
    
    If the targets are in DOWN status, check whether the network is accessible or check the Error option at the end of the status bar for the cause.
    8. Query the monitoring metric data.
    Click Graph, enter a metric name such as node_memory_MemAvailable_bytes, and click Execute to view the monitoring data.
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support