Integrate Prometheus with Tiger Cloud
Export telemetry metrics from your service to monitor system performance and health
Prometheus is an open-source monitoring system with a dimensional data model, flexible query language, and a modern alerting approach.
This page shows you how to export your service telemetry to Prometheus:
-
For Tiger Cloud, using a dedicated Prometheus exporter in Tiger Console.
-
For self-hosted TimescaleDB, using PostgreSQL Exporter.
Prerequisites
To follow the steps on this page:
-
For Tiger Cloud:
Create a target Tiger Cloud service with the time-series and analytics capability enabled.
-
For self-hosted TimescaleDB:
- Create a target self-hosted TimescaleDB instance. You need your connection details.
- Install PostgreSQL Exporter. To reduce latency and potential data transfer costs, install Prometheus and PostgreSQL Exporter on a machine in the same AWS region as your Tiger Cloud service.
Export Tiger Cloud service telemetry to Prometheus
To export your data, do the following:
To export metrics from a Tiger Cloud service, you create a dedicated Prometheus exporter in Tiger Console, attach it to your service, then configure Prometheus to scrape metrics using the exposed URL. See Exported metrics for the full list of default and additional metrics you can export. The Prometheus exporter is available for Scale and Enterprise pricing plans.
- Create a Prometheus exporter
-
In Tiger Console, click
Exporters>+ New exporter. -
Select
Metricsfor data type andPrometheusfor provider.
-
Choose the region for the exporter. Only services in the same project and region can be attached to this exporter.
-
Name your exporter.
-
Change the auto-generated Prometheus credentials, if needed. See official documentation on basic authentication in Prometheus.
-
Optionally tick
PostgreSQL metricsto export additional metrics, then clickCreate exporter.
-
- Attach the exporter to a service
-
Select a service, then click
Operations>Exporters. -
Select the exporter in the drop-down, then click
Attach exporter.
The exporter is now attached to your service. To unattach it, click the trash icon in the exporter list.
-
- Configure the Prometheus scrape target
-
Select your service, then click
Operations>Exportersand click the information icon next to the exporter. You see the exporter details.
-
Copy the exporter URL.
-
In your Prometheus installation, update
prometheus.ymlto point to the exporter URL as a scrape target:scrape_configs:- job_name: "timescaledb-exporter"scheme: httpsstatic_configs:- targets: ["my-exporter-url"]basic_auth:username: "user"password: "pass"See the Prometheus documentation for details on configuring scrape targets.
You can now monitor your service metrics.
-
To export metrics from self-hosted TimescaleDB, you import telemetry data about your database to PostgreSQL Exporter, then configure Prometheus to scrape metrics from it. PostgreSQL Exporter exposes metrics that you define, excluding the system metrics.
- Create a user to access telemetry data about your database
-
Connect to your database in
psqlusing your connection details. -
Create a user named
monitoringwith a secure password:CREATE USER monitoring WITH PASSWORD '<password>'; -
Grant the
pg_read_all_statspermission to themonitoringuser:GRANT pg_read_all_stats to monitoring;
-
- Import telemetry data about your database to {C.PG} Exporter
-
Connect PostgreSQL Exporter to your database:
Use your connection details to import telemetry data about your database. You connect as the
monitoringuser:- Local installation:
Terminal window export DATA_SOURCE_NAME="postgres://<user>:<password>@<host>:<port>/<database>?sslmode=<sslmode>"./postgres_exporter - Docker:
Terminal window docker run -d \-e DATA_SOURCE_NAME="postgres://<user>:<password>@<host>:<port>/<database>?sslmode=<sslmode>" \-p 9187:9187 \prometheuscommunity/postgres-exporter
- Local installation:
-
Check the metrics for your database in the Prometheus format:
-
Browser:
Navigate to
http://<exporter-host>:9187/metrics. -
Command line:
Terminal window curl http://<exporter-host>:9187/metrics
-
-
- Configure Prometheus to scrape metrics
-
In your Prometheus installation, update
prometheus.ymlto point to your PostgreSQL Exporter instance as a scrape target. In the following example, you replace<exporter-host>with the hostname or IP address of the PostgreSQL Exporter.global:scrape_interval: 15sscrape_configs:- job_name: 'postgresql'static_configs:- targets: ['<exporter-host>:9187']If
prometheus.ymlhas not been created during installation, create it manually. If you are using Docker, you can find the IPAddress inInspect>Networksfor the container running PostgreSQL Exporter. -
Restart Prometheus.
-
Check the Prometheus UI at
http://<prometheus-host>:9090/targetsandhttp://<prometheus-host>:9090/tsdb-status.You see the PostgreSQL Exporter target and the metrics scraped from it.
-
You can further visualize your data with Grafana. Use the Grafana PostgreSQL dashboard or create a custom dashboard that suits your needs.
This feature is currently not supported for Tiger Cloud on Microsoft Azure.