tencent cloud


Connecting to Prometheus

Last updated: 2024-01-09 14:47:31


    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.


    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 get the set of monitoring targets.
    5. Download Prometheus and configure the monitoring scrape address.
    5.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
    5.2 Modify the prometheus.yml configuration file by adding the jmx_exporter and node_exporter scrape tasks.
    # 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'.
    - targets: ["localhost:9090"]
    - job_name: "broker-jmx-exporter"
    scrape_interval: 5s
    metrics_path: '/metrics'
    - targets: ['10.x.x.0:60001','10.x.x.0:60003','10.x.x.0:60005']
    application: 'broker-jmx'
    - job_name: "broker-node-exporter"
    scrape_interval: 10s
    metrics_path: '/metrics'
    - targets: ['10.x.x.0:60002','10.x.x.0:60004','10.x.x.0:60006']
    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.
    5.3 Start Prometheus.
    ./prometheus --config.file=prometheus.yml --web.enable-lifecycle
    5.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.
    5.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.
    6. 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