How to set up a Prometheus endpoint for a Timescale Cloud database
You can get more insights into the performance of your Timescale Cloud database by monitoring it using Prometheus, a popular open-source metrics-based systems monitoring solution. This tutorial will take you through setting up a Prometheus endpoint for a database running in Timescale Cloud. To create a monitoring system to ingest and analyze Prometheus metrics from your Timescale Cloud instance, you can use Promscale!
This will expose metrics from the node_exporter as well as pg_stats metrics.
Prerequisites
In order to proceed with this tutorial, you will need a Timescale Cloud database. To create one, see these instructions for how to get started with Timescale Cloud
Step 1: Enable Prometheus service integration
In the navigation bar, select ‘Service Integrations’. Navigate to the service integrations, pictured below.
This will present you with the option to add a Prometheus integration point. Select the plus icon to add a new endpoint and give it a name of your choice. We’ve named ours endpoint_dev
.
Furthermore, notice that you are given basic authentication information and a port number in order to access the service. This will be used when setting up your Prometheus installation, in the prometheus.yml
configuration file. This will enable you to make this Timescale Cloud endpoint a target for Prometheus to scrape.
Here’s a sample configuration file you can use when you setup your Prometheus installation, substituting the target port, IP address, username, and password for those of your Timescale Cloud instance:
# prometheus.yml for monitoring a Timescale Cloud instance
global:
scrape_interval: 10s
evaluation_interval: 10s
scrape_configs:
- job_name: prometheus
scheme: https
static_configs:
- targets: ['{TARGET_IP}:{TARGET_PORT}']
tls_config:
insecure_skip_verify: true
basic_auth:
username: {ENDPOINT_USERNAME}
password: {ENDPOINT_PASSWORD}
remote_write:
- url: "http://{ADAPTER_IP}:9201/write"
remote_read:
- url: "http://{ADAPTER_IP}:9201/read"
Step 2: Associate Prometheus endpoint with managed service
Next, we want to associate our Prometheus endpoint with our Timescale Cloud service. Using the navigation menu, select the service we want to monitor and click the ‘Overview’ tab.
Navigate down to the ‘Service Integrations’ section and click the ‘Manage Integrations’ button.
Find the Prometheus integration option and select ‘Use Prometheus’.
Next, select the endpoint name you created in Step 1 as the endpoint you’d like to use with this service and then click the ‘Enable’ button. It’s possible to use the same endpoint for multiple services or a separate one for services you’d like to keep apart.
To check if this was successful, navigate back to the Service Integrations section of your managed service, and check if that “Active” flag appears, along with the name of the endpoint you associated the service with.
Congratulations, you have successfully set up a Prometheus endpoint on your managed service on Timescale Cloud!
Next steps
Next, use Promscale with Timescale, Grafana, and Prometheus to ingest and analyze Prometheus metrics from your Timescale Cloud instance.