---
date_published: 2026-08-13
date_modified: 2026-08-13
canonical_url: https://metricshub.org/community-connectors/connectors/postgresql.html
---

 [Supported Platforms](../supported-platforms.html)   [Connectors Directory](../connectors-directory.html)

# PostgreSQL

## Description

Monitors performance and operational metrics for a PostgreSQL database.

[community](tags/community.html) [database](tags/database.html) [linux](tags/linux.html) [windows](tags/windows.html)

[Source](https://github.com/metricshub/community-connectors/tree/main/src/main/connector/database/PostgreSQL/PostgreSQL.yaml)

## Target

Typical platform: **[PostgreSQL](platforms/postgre-sql.html)**

Operating systems: **Microsoft Windows, Linux**

## Prerequisites

Leverages: **PostgreSQL Database version 17 or higher**

Technology and protocols: **SQL/JDBC**

## Examples

### CLI

```batch
metricshub HOSTNAME -t win -c +PostgreSQL --jdbc -u USER --jdbc-url URL
```

### metricshub.yaml

```yaml
resourceGroups:
  <RESOURCE_GROUP>:
    resources:
      <HOSTNAME-ID>:
        attributes:
          host.name: <HOSTNAME> # Change with actual host name
          host.type: win
        connectors: [ +PostgreSQL ] # Optional, to load only this connector
        protocols:
          jdbc:
            port: <PORT>
            database: <DB_NAME>
            type: <type>
            url: <URL>
            username: <USERNAME> # Change with actual credentials
            password: <PASSWORD> # Encrypted using metricshub-encrypt
```

## Connector Activation Criteria

The **PostgreSQL** connector will be automatically activated, and its status will be reported as OK if all the below criteria are met:

- The **SQL query** below succeeds on the monitored database:

## Metrics

| Type | Collected Metrics | Specific Attributes |
| --- | --- | --- |
| **postgresql** | - `db.server.cache.operations{db.io.direction="write", db.cache.state="miss", db.postgresql.cache.type="wal_buffer"}` - `db.server.cache.size{db.postgresql.cache.type="shared_buffer"}` - `db.server.connections` - `db.server.connections.limit` - `db.server.postgresql.bgwriter.buffers{db.buffer.state="allocated"}` - `db.server.postgresql.bgwriter.buffers{db.buffer.state="clean"}` - `db.server.postgresql.bgwriter.clean_stops` - `db.server.postgresql.checkpointer.buffers` - `db.server.postgresql.checkpointer.operations{db.operation.trigger_type="requested"}` - `db.server.postgresql.checkpointer.operations{db.operation.trigger_type="scheduled"}` - `db.server.postgresql.checkpointer.sync_time` - `db.server.postgresql.checkpointer.write_time` - `db.server.postgresql.wal.io{db.io.direction="write"}` - `db.server.uptime` | - `db.namespace` - `db.system` - `db.version` - `id` |
| **postgresql_database** | - `db.server.cache.io{db.io.direction="read", db.cache.state="hit", db.postgresql.cache.type="shared_buffer"}` - `db.server.cache.io{db.io.direction="read", db.cache.state="miss", db.postgresql.cache.type="shared_buffer"}` - `db.server.commits` - `db.server.current_connections{db.connection.state="active"}` - `db.server.current_connections{db.connection.state="idle"}` - `db.server.errors{error.type="deadlocks"}` - `db.server.errors{error.type="session_abandoned"}` - `db.server.errors{error.type="session_fatal_error"}` - `db.server.errors{error.type="session_killed"}` - `db.server.operation_time{db.operation.type="sql"}` - `db.server.postgresql.index.row_operations{db.row_operation.type="fetch"}` - `db.server.postgresql.session_time` - `db.server.postgresql.transaction_time{db.transaction.state="idle"}` - `db.server.rollbacks` - `db.server.row_operations{db.row_operation.type="delete"}` - `db.server.row_operations{db.row_operation.type="insert"}` - `db.server.row_operations{db.row_operation.type="read"}` - `db.server.row_operations{db.row_operation.type="update"}` - `db.server.sessions` - `db.server.size` | - `db.namespace` - `db.system` |
| **postgresql_lock** | - `db.server.locks` | - `db.namespace` - `db.server.lock.relation` - `db.server.lock.type` - `db.system` |
| **replication** | - `db.server.postgresql.replication.flush_lag.time` - `db.server.postgresql.replication.lag` - `db.server.postgresql.replication.replay_lag.time` - `db.server.postgresql.replication.status{state="backup\|catchup\|startup\|stopping\|streaming"}` - `db.server.postgresql.replication.write_lag.time` | - `db.replication.host.id` - `db.replication.host.name` - `db.server.application_name` - `db.system` - `db.user.name` |
