tencent cloud

Feedback

Compatible with Prometheus API

Last updated: 2024-09-20 17:48:27
    Metric topics are compatible with the Prometheus metrics data model and the following APIs:

    Metrics Query API

    Prometheus HTTP API

    Compatible with the following HTTP APIs and commonly used for integration with Grafana.
    Instant queries : /api/v1/query
    Range queries : /api/v1/query_range
    Finding series by label matchers : /api/v1/series
    Getting label names : /api/v1/labels
    Querying label values : /api/v1/label/<label_name>/values
    Querying exemplars : /api/v1/query_exemplars
    Not compatible with APIs used for native Prometheus collection configurations, alarm rules, and cluster management features, such as Targets, Rules, Alerts, Querying target metadata, Querying metric metadata, Alertmanagers, Status, TSDB Admin APIs.
    Directions for integration with Grafana:
    1. On the Grafana Data Sources page, click Add data source.
    2. Select Prometheus, and configure the following information in the form:
    Search for the required CAM policy as needed, and click to complete policy association.
    
    
    URL: Replace ${region} and ${topicId} where ${region} represents the region abbreviation, and ${topicId} represents the metric topic ID.
    Public network address: https://${region}.cls.tencentcs.com/prometheus/${topicId}
    Private network address: https://${region}.cls.tencentyun.com/prometheus/${topicId}
    Basic auth: Turn on this switch.
    Basic Auth Details: The API uses Basic Auth for authentication. Use the SecretId and SecretKey from the API Key as the username and password, respectively.
    username:${SecretId}
    password:${SecretKey}
    Note:
    It is recommended to create a separate sub-account and use the SecretId and SecretKey of that account. Grant this account only the following permissions to ensure security. For configuration details, see Sub-account Authorization.
    {
    "version": "2.0",
    "statement": [
    {
    "effect": "allow",
    "action": [
    "cls:MetricsSeries",
    "cls:MetricsQueryExemplars",
    "cls:MetricsLabelValues",
    "cls:MetricsQueryRange",
    "cls:MetricsLabels",
    "cls:MetricsQuery"
    ],
    "resource": [
    "*"
    ]
    }
    ]
    }
    Manage alerts via Alerting UI: Turn off this switch. CLS is not compatible with Prometheus Alerts-related APIs and does not support this feature.
    3. Click Save & Test at the bottom to test whether the configuration is correct and to save the settings.

    Prometheus Remote Read API

    This is commonly used to read metric topic data with a self-built Prometheus instance. Add the following configuration to the Prometheus configuration file (for more configuration details, see the Prometheus Official Documentation):
    # Reading address: Replace ${region} and ${topicId}. This example uses the public network address; if network conditions allow, it is recommended to use the private network address.
    # Private network address URL: https://${region}.cls.tencentyun.com/prometheus/${topicId}/api/v1/read
    url: https://${region}.cls.tencentcs.com/prometheus/${topicId}/api/v1/read
    
    # Authentication information: Replace ${SecretId} and ${SecretKey}.
    basic_auth:
    username: ${SecretId}
    password: ${SecretKey}
    In the URL, ${region} represents the region abbreviation, and ${topicId} represents the metric topic ID.
    The API uses Basic Auth for authentication. Use the SecretId and SecretKey from the API Key as the username and password, respectively.
    username:${SecretId}
    password:${SecretKey}
    Note:
    It is recommended to create a separate sub-account and use the SecretId and SecretKey of that account. Grant this account only the following permissions to ensure security. For configuration details, see Sub-account Authorization.
    {
    "version": "2.0",
    "statement": [
    {
    "effect": "allow",
    "action": [
    "cls:MetricsRemoteRead"
    ],
    "resource": [
    "*"
    ]
    }
    ]
    }

    Metrics Reporting API

    Prometheus Remote Write API

    This API is commonly used to collect and report metrics to the metric topics by using various collectors compatible with the Prometheus Remote Write protocol, such as vmagent and telegraf. Metrics from a local Prometheus instance can also be reported to metric topics via this API. For detailed instructions, see Metric Reporting.
    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