Prometheus is a leading application for metric monitoring. Prometheus provides a set of APIs that can be used to integrate remote storage systems with Prometheus. This way, you can use InfluxDB as a remote storage system to store time series data for Prometheus. This helps Prometheus remove the limits of local storage and provide more stable and reliable storage performance. This topic describes how to integrate Prometheus with Alibaba Cloud TSDB for InfluxDB® to provide a high-performance solution for storing monitoring data.
Prometheus is a monitoring and alerting system. Prometheus was developed by SoundCloud and became a widely adopted open source project after it joined Cloud Native Computing Foundation (CNCF) in 2016. Prometheus supports a multi-dimensional data model that uses metrics and labels to specify time series data. Prometheus also provides the PromQL query language to support multi-dimensional queries. In terms of storage, Prometheus provides a built-in time series database that is developed based on local storage. This single-node database provides limited scalability and reliability and limited features. To improve the storage performance, Prometheus provides a set of APIs that can be used to integrate remote storage systems with Prometheus. The following figure shows how remote storage works for Prometheus.
Prometheus provides the read and write APIs for remote storage. Protocol buffers are used to define communication protocols, and HTTP is used to transmit data. To enable a storage system to support Prometheus, you must implement an adapter pattern to convert the read and write requests of Prometheus to a format that is supported by the storage system. TSDB for InfluxDB® provides high-performance data storage and supports retention policies. TSDB for InfluxDB® supports the Prometheus read and write protocols and provides the adapter feature and two HTTP APIs to process read and write requests from Prometheus. This makes TSDB for InfluxDB® an excellent choice of remote storage for Prometheus. For more information about TSDB for InfluxDB®, see Introduction to TSDB for InfluxDB®.
Prometheus supports multiple operating systems. This topic uses Linux as an example to describe the configuration procedure.
The Prometheus package for Linux contains a configuration file. To integrate TSDB for InfluxDB® with Prometheus, you need only to specify TSDB for InfluxDB® as a remote storage system in the configuration file.
$ ls console_libraries consoles data LICENSE NOTICE prometheus prometheus.yml promtool
Use a text editor, such as Vim, to add the following content to the end of the prometheus.yml file:
In the preceding content, replace the URL with the public endpoint of your TSDB for InfluxDB® instance, the value of u with the username of your account, and the value of p with the password of your account.
remote_write: - url: "https://ts-1234abcd.influxdata.rds.aliyuncs.com:3242/api/v1/prom/write?db=prometheus&u=prom&p=mypassword" remote_read: - url: "https://ts-1234abcd.influxdata.rds.aliyuncs.com:3242/api/v1/prom/read?db=prometheus&u=prom&p=mypassword"
Save the configuration file and start Prometheus.
After Prometheus starts, you can use a browser to access the Prometheus service. The default port number of the service is 9090.