Skip to content

Commit

Permalink
moved prometheus to integrations
Browse files Browse the repository at this point in the history
  • Loading branch information
atovpeko committed Jan 27, 2025
1 parent 029af57 commit 54891d3
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 84 deletions.
82 changes: 82 additions & 0 deletions _partials/_prometheus-integrate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import IntegrationPrereqs from "versionContent/_partials/_integration-prereqs.mdx";

[Prometheus][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_SHORT telemetry to Prometheus using [PostgreSQL Exporter][postgresql-exporter].

## Prerequisites

<IntegrationPrereqs />

- [Download and install Prometheus][install-prometheus].

## Export $SERVICE_SHORT telemetry to Prometheus

Take the following steps to export your data:

<Procedure>

1. **Connect to your $SERVICE_LONG**

For $CLOUD_SHORT, connect from [$CONSOLE][run-queries]. For self-hosted, use [`psql`][psql].

1. **Create a user to scrape the metrics**

1. Create a user named `monitoring` with a password:

```sql
CREATE USER monitoring WITH PASSWORD '<password>';
```

1. Grant the `pg_read_all_stats` permission to the `monitoring` user:

```sql
GRANT pg_read_all_stats to monitoring;
```

1. **Install PostgreSQL Exporter**

You [install PostgreSQL Exporter][install-exporter] on the machine that you use to connect to your $SERVICE_SHORT and collect telemetry. To reduce latency and potential data transfer costs, run PostgreSQL Exporter in the same AWS region as your $SERVICE_LONG. Use your [connection details][connection-info] to configure the data source during installation:

- `<username>`: `monitoring`
- `<password>`: the `monitoring` user password
- `<host>`, `<port>`, and `<database>`: configure using your [connection details][connection-info].

To check the installation, navigate to `http://<exporter-host>:9187/metrics`. You should see PostgreSQL metrics in the Prometheus format.

1. **Configure Prometheus to scrape metrics**

1. Update the `prometheus.yml` file to include PostgreSQL Exporter as a scrape target. If `prometheus.yml` has not been created during installation, create it manually:

```yaml
global:
scrape_interval: 15s
scrape_configs:
- job_name: 'postgresql'
static_configs:
- targets: ['<exporter-host>:9187']
```

Replace `<exporter-host>` with the hostname or IP address of the PostgreSQL Exporter.

1. Restart Prometheus.

1. Check the Prometheus UI at `http://<prometheus-host>:9090`.

The PostgreSQL Exporter target under `Status` > `Target health` must be active.

</Procedure>

You can further [visualize your data][grafana-prometheus] with Grafana. Use the [Grafana PostgreSQL dashboard][postgresql-exporter-dashboard] or [create a custom dashboard][grafana] that suits your needs.

[install-exporter]: https://grafana.com/oss/prometheus/exporters/postgres-exporter/?tab=installation
[postgresql-exporter-dashboard]: https://grafana.com/oss/prometheus/exporters/postgres-exporter/?tab=dashboards
[install-prometheus]: https://prometheus.io/download/
[grafana]: /use-timescale/:currentVersion:/integrations/grafana/
[grafana-prometheus]: https://grafana.com/docs/grafana-cloud/send-data/metrics/metrics-prometheus/
[prometheus]: https://prometheus.io/docs/introduction/overview/
[run-queries]: /getting-started/:currentVersion:/run-queries-from-console/
[psql]: /use-timescale/:currentVersion:/integrations/psql/
[connection-info]: /use-timescale/:currentVersion:/integrations/find-connection-details/
[postgresql-exporter]: https://grafana.com/oss/prometheus/exporters/postgres-exporter/
8 changes: 5 additions & 3 deletions use-timescale/integrations/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ Some of the most in-demand integrations for $CLOUD_LONG are listed below, with l

## Observability and alerting

| Name | Description |
|:---------------------------:|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Name | Description |
|:---------------------------:|----------------------------------------------------------------------------------------------------------------------------------|
| [Grafana][grafana] | An open-source analytics and monitoring solution that enables you to query, visualize, alert on, and explore your metrics, logs. |
| [Tableau][tableau] | A popular analytics platform that helps you gain greater intelligence about your business. |
| [Tableau][tableau] | A popular analytics platform that helps you gain greater intelligence about your business. |
| [Prometheus][prometheus]| An open-source monitoring system with a dimensional data model, flexible query language, and a modern alerting approach. |


## Configuration and deployment
Expand Down Expand Up @@ -60,3 +61,4 @@ Some of the most in-demand integrations for $CLOUD_LONG are listed below, with l
[terraform]: /use-timescale/:currentVersion:/integrations/terraform
[apache-airflow]: /use-timescale/:currentVersion:/integrations/apache-airflow
[postgresql-integrations]: https://slashdot.org/software/p/PostgreSQL/integrations/
[prometheus]: /use-timescale/:currentVersion:/integrations/prometheus
12 changes: 12 additions & 0 deletions use-timescale/integrations/prometheus.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: Integrate Prometheus with Timescale Cloud
excerpt: Export telemetry metrics from your Timescale Cloud service to Prometheus
products: [cloud, mst, self_hosted]
keywords: [integrate]
---

import PrometheusIntegrate from "versionContent/_partials/_prometheus-integrate.mdx";

# Integrate Prometheus with $CLOUD_LONG

<PrometheusIntegrate />
83 changes: 2 additions & 81 deletions use-timescale/metrics-logging/metrics-to-prometheus.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,87 +10,8 @@ cloud_ui:
- [services, :serviceId, operations, integrations]
---

import IntegrationPrereqs from "versionContent/_partials/_integration-prereqs.mdx";
import PrometheusIntegrate from "versionContent/_partials/_prometheus-integrate.mdx";

# Export metrics to Prometheus

[Prometheus][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_SHORT telemetry to Prometheus using [PostgreSQL Exporter][postgresql-exporter].

## Prerequisites

<IntegrationPrereqs />

- [Download and install Prometheus][install-prometheus].

## Export $SERVICE_SHORT telemetry to Prometheus

Take the following steps to export your data:

<Procedure>

1. **Connect to your $SERVICE_LONG**

For $CLOUD_SHORT, connect from [$CONSOLE][run-queries]. For self-hosted, use [`psql`][psql].

1. **Create a user to scrape the metrics**

1. Create a user named `monitoring` with a password:

```sql
CREATE USER monitoring WITH PASSWORD '<password>';
```

1. Grant the `pg_read_all_stats` permission to the `monitoring` user:

```sql
GRANT pg_read_all_stats to monitoring;
```

1. **Install PostgreSQL Exporter**

You [install PostgreSQL Exporter][install-exporter] on the machine that you use to connect to your $SERVICE_SHORT and collect telemetry. To reduce latency and potential data transfer costs, run PostgreSQL Exporter in the same AWS region as your $SERVICE_LONG. Use your [connection details][connection-info] to configure the data source during installation:

- `<username>`: `monitoring`
- `<password>`: the `monitoring` user password
- `<host>`, `<port>`, and `<database>`: configure using your [connection details][connection-info].

To check the installation, navigate to `http://<exporter-host>:9187/metrics`. You should see PostgreSQL metrics in the Prometheus format.

1. **Configure Prometheus to scrape metrics**

1. Update the `prometheus.yml` file to include PostgreSQL Exporter as a scrape target. If `prometheus.yml` has not been created during installation, create it manually:

```yaml
global:
scrape_interval: 15s
scrape_configs:
- job_name: 'postgresql'
static_configs:
- targets: ['<exporter-host>:9187']
```

Replace `<exporter-host>` with the hostname or IP address of the PostgreSQL Exporter.

1. Restart Prometheus.

1. Check the Prometheus UI at `http://<prometheus-host>:9090`.

The PostgreSQL Exporter target under `Status` > `Target health` must be active.

</Procedure>

You can further [visualize your data][grafana-prometheus] with Grafana. Use the [Grafana PostgreSQL dashboard][postgresql-exporter-dashboard] or [create a custom dashboard][grafana] that suits your needs.

[install-exporter]: https://grafana.com/oss/prometheus/exporters/postgres-exporter/?tab=installation
[postgresql-exporter-dashboard]: https://grafana.com/oss/prometheus/exporters/postgres-exporter/?tab=dashboards
[install-prometheus]: https://prometheus.io/download/
[grafana]: /use-timescale/:currentVersion:/integrations/grafana/
[grafana-prometheus]: https://grafana.com/docs/grafana-cloud/send-data/metrics/metrics-prometheus/
[prometheus]: https://prometheus.io/docs/introduction/overview/
[run-queries]: /getting-started/:currentVersion:/run-queries-from-console/
[psql]: /use-timescale/:currentVersion:/integrations/psql/
[connection-info]: /use-timescale/:currentVersion:/integrations/find-connection-details/
[postgresql-exporter]: https://grafana.com/oss/prometheus/exporters/postgres-exporter/
<PrometheusIntegrate />
5 changes: 5 additions & 0 deletions use-timescale/page-index/page-index.js
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,11 @@ module.exports = [
href: "pgadmin",
excerpt: "Install pgAdmin to connect to Timescale",
},
{
title: "Prometheus",
href: "prometheus",
excerpt: "Integrate Prometheus with Timescale Cloud",
},
{
title: "psql",
href: "psql",
Expand Down

0 comments on commit 54891d3

Please sign in to comment.