-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cf5fb89
commit 3ba8ede
Showing
5 changed files
with
99 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 36 additions & 28 deletions
64
...-service/app/integrations/builtin_integrations/postgres/config/prerequisites.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,37 @@ | ||
## Prerequisites | ||
|
||
### Prepare postgres for monitoring | ||
|
||
- Have a running postgresql instance | ||
- Have the monitoring user created | ||
- Have the monitoring user granted the necessary permissions | ||
|
||
This receiver supports PostgreSQL versions 9.6+ | ||
|
||
For PostgreSQL versions 10+, run: | ||
|
||
```sql | ||
create user monitoring with password '<PASSWORD>'; | ||
grant pg_monitor to monitoring; | ||
grant SELECT ON pg_stat_database to monitoring; | ||
``` | ||
|
||
For PostgreSQL versions >= 9.6 and <10, run: | ||
|
||
```sql | ||
create user monitoring with password '<PASSWORD>'; | ||
grant SELECT ON pg_stat_database to monitoring; | ||
``` | ||
## Before You Begin | ||
|
||
To configure metrics and logs collection for a Postgres server, you need the following. | ||
|
||
### Ensure Postgres server is prepared for monitoring | ||
|
||
- **Ensure that the Postgres server is running a supported version** | ||
Postgres versions 9.6+ are supported. | ||
You can use the following SQL statement to determine server version | ||
```SQL | ||
SELECT version(); | ||
``` | ||
|
||
- **If collecting metrics, ensure that there is a Postgres user with required permissions** | ||
To create a monitoring user for Postgres versions 10+, run: | ||
```SQL | ||
create user monitoring with password '<PASSWORD>'; | ||
grant pg_monitor to monitoring; | ||
grant SELECT ON pg_stat_database to monitoring; | ||
``` | ||
|
||
|
||
### Install Otel Collector | ||
|
||
To start gathering postgres logs and metrics, please [install otel collector](https://signoz.io/docs/tutorial/opentelemetry-binary-usage-in-virtual-machine/) in your deployment. | ||
To create a monitoring user for Postgres versions >= 9.6 and <10, run: | ||
```SQL | ||
create user monitoring with password '<PASSWORD>'; | ||
grant SELECT ON pg_stat_database to monitoring; | ||
``` | ||
|
||
|
||
### Ensure that an OTEL Collector is running with access to the Postgres server | ||
|
||
- **Ensure that an OTEL collector is running in your deployment environment** | ||
If needed, please [install an OTEL Collector](https://signoz.io/docs/tutorial/opentelemetry-binary-usage-in-virtual-machine/) | ||
If already installed, ensure that you can provide config to the collector with environment variables and command line flags. | ||
|
||
- **Ensure that the OTEL collector can access the Postgres server** | ||
In order to collect metrics, the collector must be able to access the Postgres server as a client using the monitoring user. | ||
In order to collect logs, The collector must be able to read the Postgres server log file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"id": "postgres", | ||
"title": "PostgreSQL", | ||
"description": "Monitor postgres using logs and metrics.", | ||
"description": "Monitor Postgres with metrics and logs", | ||
"author": { | ||
"name": "SigNoz", | ||
"email": "[email protected]", | ||
|
@@ -54,17 +54,21 @@ | |
"data_collected": { | ||
"logs": [ | ||
{ | ||
"name": "pid", | ||
"name": "Process ID", | ||
"path": "attributes.pid", | ||
"type": "string" | ||
}, { | ||
"name": "timestamp", | ||
"name": "Timestamp", | ||
"path": "timestamp", | ||
"type": "timestamp" | ||
}, { | ||
"name": "severity", | ||
"path": "severity", | ||
"type": "severity" | ||
"name": "Severity Text", | ||
"path": "severity_text", | ||
"type": "string" | ||
}, { | ||
"name": "Severity Number", | ||
"path": "severity_number", | ||
"type": "number" | ||
} | ||
], | ||
"metrics": [ | ||
|
@@ -77,19 +81,19 @@ | |
{ | ||
"name": "postgresql.bgwriter.buffers.allocated", | ||
"type": "sum", | ||
"unit": "{buffers}", | ||
"unit": "number", | ||
"description": "Number of buffers allocated." | ||
}, | ||
{ | ||
"name": "postgresql.bgwriter.buffers.writes", | ||
"type": "sum", | ||
"unit": "{buffers}", | ||
"unit": "number", | ||
"description": "Number of buffers written." | ||
}, | ||
{ | ||
"name": "postgresql.bgwriter.checkpoint.count", | ||
"type": "sum", | ||
"unit": "{checkpoints}", | ||
"unit": "number", | ||
"description": "The number of checkpoints performed." | ||
}, | ||
{ | ||
|
@@ -119,43 +123,43 @@ | |
{ | ||
"name": "postgresql.connection.max", | ||
"type": "gauge", | ||
"unit": "{connections}", | ||
"unit": "number", | ||
"description": "Configured maximum number of client connections allowed" | ||
}, | ||
{ | ||
"name": "postgresql.database.count", | ||
"type": "sum", | ||
"unit": "{databases}", | ||
"unit": "number", | ||
"description": "Number of user databases." | ||
}, | ||
{ | ||
"name": "postgresql.database.locks", | ||
"type": "gauge", | ||
"unit": "{lock}", | ||
"unit": "number", | ||
"description": "The number of database locks." | ||
}, | ||
{ | ||
"name": "postgresql.db_size", | ||
"type": "sum", | ||
"unit": "By", | ||
"unit": "Bytes", | ||
"description": "The database disk usage." | ||
}, | ||
{ | ||
"name": "postgresql.deadlocks", | ||
"type": "sum", | ||
"unit": "{deadlock}", | ||
"unit": "number", | ||
"description": "The number of deadlocks." | ||
}, | ||
{ | ||
"name": "postgresql.index.scans", | ||
"type": "sum", | ||
"unit": "{scans}", | ||
"unit": "number", | ||
"description": "The number of index scans on a table." | ||
}, | ||
{ | ||
"name": "postgresql.index.size", | ||
"type": "gauge", | ||
"unit": "By", | ||
"unit": "Bytes", | ||
"description": "The size of the index on disk." | ||
}, | ||
{ | ||
|
@@ -167,7 +171,7 @@ | |
{ | ||
"name": "postgresql.replication.data_delay", | ||
"type": "gauge", | ||
"unit": "By", | ||
"unit": "Bytes", | ||
"description": "The amount of data delayed in replication." | ||
}, | ||
{ | ||
|
@@ -185,49 +189,49 @@ | |
{ | ||
"name": "postgresql.sequential_scans", | ||
"type": "sum", | ||
"unit": "{sequential_scan}", | ||
"unit": "number", | ||
"description": "The number of sequential scans." | ||
}, | ||
{ | ||
"name": "postgresql.table.count", | ||
"type": "sum", | ||
"unit": "{table}", | ||
"unit": "number", | ||
"description": "Number of user tables in a database." | ||
}, | ||
{ | ||
"name": "postgresql.table.size", | ||
"type": "sum", | ||
"unit": "By", | ||
"unit": "Bytes", | ||
"description": "Disk space used by a table." | ||
}, | ||
{ | ||
"name": "postgresql.table.vacuum.count", | ||
"type": "sum", | ||
"unit": "{vacuums}", | ||
"unit": "number", | ||
"description": "Number of times a table has manually been vacuumed." | ||
}, | ||
{ | ||
"name": "postgresql.temp_files", | ||
"type": "sum", | ||
"unit": "{temp_file}", | ||
"unit": "number", | ||
"description": "The number of temp files." | ||
}, | ||
{ | ||
"name": "postgresql.wal.age", | ||
"type": "gauge", | ||
"unit": "s", | ||
"unit": "seconds", | ||
"description": "Age of the oldest WAL file." | ||
}, | ||
{ | ||
"name": "postgresql.wal.delay", | ||
"type": "gauge", | ||
"unit": "s", | ||
"unit": "seconds", | ||
"description": "Time between flushing recent WAL locally and receiving notification that the standby server has completed an operation with it." | ||
}, | ||
{ | ||
"name": "postgresql.wal.lag", | ||
"type": "gauge", | ||
"unit": "s", | ||
"unit": "seconds", | ||
"description": "Time between flushing recent WAL locally and receiving notification that the standby server has completed an operation with it." | ||
} | ||
] | ||
|
4 changes: 3 additions & 1 deletion
4
pkg/query-service/app/integrations/builtin_integrations/postgres/overview.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
### Monitor Postgres with SigNoz | ||
|
||
Parse your Postgres logs and collect key metrics. | ||
Collect key Postgres metrics and view them with an out of the box dashboard. | ||
|
||
Collect and parse Postgres logs to populate timestamp, severity, and other log attributes for better querying and aggregation. |