github.com/netdata/go.d.plugin@v0.58.1/modules/pgbouncer/integrations/pgbouncer.md (about)

     1  <!--startmeta
     2  custom_edit_url: "https://github.com/netdata/go.d.plugin/edit/master/modules/pgbouncer/README.md"
     3  meta_yaml: "https://github.com/netdata/go.d.plugin/edit/master/modules/pgbouncer/metadata.yaml"
     4  sidebar_label: "PgBouncer"
     5  learn_status: "Published"
     6  learn_rel_path: "Data Collection/Databases"
     7  most_popular: False
     8  message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE COLLECTOR'S metadata.yaml FILE"
     9  endmeta-->
    10  
    11  # PgBouncer
    12  
    13  
    14  <img src="https://netdata.cloud/img/postgres.svg" width="150"/>
    15  
    16  
    17  Plugin: go.d.plugin
    18  Module: pgbouncer
    19  
    20  <img src="https://img.shields.io/badge/maintained%20by-Netdata-%2300ab44" />
    21  
    22  ## Overview
    23  
    24  This collector monitors PgBouncer servers.
    25  
    26  Executed queries:
    27  
    28  - `SHOW VERSION;`
    29  - `SHOW CONFIG;`
    30  - `SHOW DATABASES;`
    31  - `SHOW STATS;`
    32  - `SHOW POOLS;`
    33  
    34  Information about the queries can be found in the [PgBouncer Documentation](https://www.pgbouncer.org/usage.html).
    35  
    36  
    37  
    38  
    39  This collector is supported on all platforms.
    40  
    41  This collector supports collecting metrics from multiple instances of this integration, including remote instances.
    42  
    43  
    44  ### Default Behavior
    45  
    46  #### Auto-Detection
    47  
    48  This integration doesn't support auto-detection.
    49  
    50  #### Limits
    51  
    52  The default configuration for this integration does not impose any limits on data collection.
    53  
    54  #### Performance Impact
    55  
    56  The default configuration for this integration is not expected to impose a significant performance impact on the system.
    57  
    58  
    59  ## Metrics
    60  
    61  Metrics grouped by *scope*.
    62  
    63  The scope defines the instance that the metric belongs to. An instance is uniquely identified by a set of labels.
    64  
    65  
    66  
    67  ### Per PgBouncer instance
    68  
    69  These metrics refer to the entire monitored application.
    70  
    71  This scope has no labels.
    72  
    73  Metrics:
    74  
    75  | Metric | Dimensions | Unit |
    76  |:------|:----------|:----|
    77  | pgbouncer.client_connections_utilization | used | percentage |
    78  
    79  ### Per database
    80  
    81  These metrics refer to the database.
    82  
    83  Labels:
    84  
    85  | Label      | Description     |
    86  |:-----------|:----------------|
    87  | database | database name |
    88  | postgres_database | Postgres database name |
    89  
    90  Metrics:
    91  
    92  | Metric | Dimensions | Unit |
    93  |:------|:----------|:----|
    94  | pgbouncer.db_client_connections | active, waiting, cancel_req | connections |
    95  | pgbouncer.db_server_connections | active, idle, used, tested, login | connections |
    96  | pgbouncer.db_server_connections_utilization | used | percentage |
    97  | pgbouncer.db_clients_wait_time | time | seconds |
    98  | pgbouncer.db_client_max_wait_time | time | seconds |
    99  | pgbouncer.db_transactions | transactions | transactions/s |
   100  | pgbouncer.db_transactions_time | time | seconds |
   101  | pgbouncer.db_transaction_avg_time | time | seconds |
   102  | pgbouncer.db_queries | queries | queries/s |
   103  | pgbouncer.db_queries_time | time | seconds |
   104  | pgbouncer.db_query_avg_time | time | seconds |
   105  | pgbouncer.db_network_io | received, sent | B/s |
   106  
   107  
   108  
   109  ## Alerts
   110  
   111  There are no alerts configured by default for this integration.
   112  
   113  
   114  ## Setup
   115  
   116  ### Prerequisites
   117  
   118  #### Create netdata user
   119  
   120  Create a user with `stats_users` permissions to query your PgBouncer instance.
   121  
   122  To create the `netdata` user:
   123  
   124  - Add `netdata` user to the `pgbouncer.ini` file:
   125  
   126    ```text
   127    stats_users = netdata
   128    ```
   129  
   130  - Add a password for the `netdata` user to the `userlist.txt` file:
   131  
   132    ```text
   133    "netdata" "<PASSWORD>"
   134    ```
   135  
   136  - To verify the credentials, run the following command
   137  
   138    ```bash
   139    psql -h localhost -U netdata -p 6432 pgbouncer -c "SHOW VERSION;" >/dev/null 2>&1 && echo OK || echo FAIL
   140    ```
   141  
   142    When it prompts for a password, enter the password you added to `userlist.txt`.
   143  
   144  
   145  
   146  ### Configuration
   147  
   148  #### File
   149  
   150  The configuration file name for this integration is `go.d/pgbouncer.conf`.
   151  
   152  
   153  You can edit the configuration file using the `edit-config` script from the
   154  Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/configure/nodes.md#the-netdata-config-directory).
   155  
   156  ```bash
   157  cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata
   158  sudo ./edit-config go.d/pgbouncer.conf
   159  ```
   160  #### Options
   161  
   162  The following options can be defined globally: update_every, autodetection_retry.
   163  
   164  
   165  <details><summary>Config options</summary>
   166  
   167  | Name | Description | Default | Required |
   168  |:----|:-----------|:-------|:--------:|
   169  | update_every | Data collection frequency. | 5 | no |
   170  | autodetection_retry | Recheck interval in seconds. Zero means no recheck will be scheduled. | 0 | no |
   171  | dsn | PgBouncer server DSN (Data Source Name). See [DSN syntax](https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING). | postgres://postgres:postgres@127.0.0.1:6432/pgbouncer | yes |
   172  | timeout | Query timeout in seconds. | 1 | no |
   173  
   174  </details>
   175  
   176  #### Examples
   177  
   178  ##### TCP socket
   179  
   180  An example configuration.
   181  
   182  <details><summary>Config</summary>
   183  
   184  ```yaml
   185  jobs:
   186    - name: local
   187      dsn: 'postgres://postgres:postgres@127.0.0.1:6432/pgbouncer'
   188  
   189  ```
   190  </details>
   191  
   192  ##### Unix socket
   193  
   194  An example configuration.
   195  
   196  <details><summary>Config</summary>
   197  
   198  ```yaml
   199  jobs:
   200    - name: local
   201      dsn: 'host=/tmp dbname=pgbouncer user=postgres port=6432'
   202  
   203  ```
   204  </details>
   205  
   206  ##### Multi-instance
   207  
   208  > **Note**: When you define multiple jobs, their names must be unique.
   209  
   210  Local and remote instances.
   211  
   212  
   213  <details><summary>Config</summary>
   214  
   215  ```yaml
   216  jobs:
   217    - name: local
   218      dsn: 'postgres://postgres:postgres@127.0.0.1:6432/pgbouncer'
   219  
   220    - name: remote
   221      dsn: 'postgres://postgres:postgres@203.0.113.10:6432/pgbouncer'
   222  
   223  ```
   224  </details>
   225  
   226  
   227  
   228  ## Troubleshooting
   229  
   230  ### Debug Mode
   231  
   232  To troubleshoot issues with the `pgbouncer` collector, run the `go.d.plugin` with the debug option enabled. The output
   233  should give you clues as to why the collector isn't working.
   234  
   235  - Navigate to the `plugins.d` directory, usually at `/usr/libexec/netdata/plugins.d/`. If that's not the case on
   236    your system, open `netdata.conf` and look for the `plugins` setting under `[directories]`.
   237  
   238    ```bash
   239    cd /usr/libexec/netdata/plugins.d/
   240    ```
   241  
   242  - Switch to the `netdata` user.
   243  
   244    ```bash
   245    sudo -u netdata -s
   246    ```
   247  
   248  - Run the `go.d.plugin` to debug the collector:
   249  
   250    ```bash
   251    ./go.d.plugin -d -m pgbouncer
   252    ```
   253  
   254