Infrastructure Integration

Configuration

  1. Create a read-only netsil user with proper access to your PostgreSQL Server. Start psql on your PostgreSQL database and run

    CREATE USER netsil WITH PASSWORD '
        <Generate Password>
    ';
    GRANT SELECT ON pg_stat_database TO netsil;
    


    psql -h localhost -U netsil postgres -c "SELECT * FROM pg_stat_database LIMIT(1);"  
     && echo -e "\e[0;32mPostgres connection - OK\e[0m" || \ ||  
    echo -e "\e[0;31mCannot connect to Postgres\e[0m"
    

Enter the password when prompted.

  1. In your PGBouncer userlist.txt file add

     "netsil" 
     "<Generate Password>"
    
  2. Configure the agent by editing /etc/netsil-dd-agent/conf.d/pgbouncer.yamlin the collectors.

Example:

    init_config:

    instances:
    #   - host: localhost
    #     port: 15433
    #     username: my_username
    #     password: my_password
    #     tags:
    #       - optional_tag1
    #       - optional_tag2
    #
    #   - database_url: postgresql://user:pass@host:5432/dbname?sslmode=require
    #     tags:
    #       - optional_tag3
    #       - optional_tag4
  1. Check and make sure that all yaml files are valid with following command:

    /etc/init.d/netsil-collectors configcheck
    
  2. Restart the Agent using the following command:

    /etc/init.d/netsil-collectors restart
    
  3. Execute the info command to verify that the integration check has passed:

    /etc/init.d/netsil-collectors info
    

The output of the command should contain a section similar to the following:

    Checks
    ======

      [...]

      pgbouncer
      ---------
          - instance #0 [OK]
          - Collected 8 metrics & 0 events

Infrastructure Datasources

Datasource Available Aggregations Unit Description
pgbouncer.stats.requests_per_second avg max min sum request/second The request rate
pgbouncer.stats.bytes_received_per_second avg max min sum byte/second The total network traffic received
pgbouncer.stats.bytes_sent_per_second avg max min sum byte/second The total network traffic sent
pgbouncer.stats.total_query_time avg max min sum microsecond Time spent by pgbouncer actively querying PostgreSQL
pgbouncer.stats.avg_req avg max min sum request/second The average number of requests per second in last stat period
pgbouncer.stats.avg_recv avg max min sum byte/second The client network traffic received
pgbouncer.stats.avg_sent avg max min sum byte/second The client network traffic sent
pgbouncer.stats.avg_query avg max min sum microsecond The average query duration
pgbouncer.pools.cl_active avg max min sum connection Client connections linked to server connection and able to process queries
pgbouncer.pools.cl_waiting avg max min sum connection Client connections waiting on a server connection
pgbouncer.pools.sv_active avg max min sum connection Server connections linked to a client connection
pgbouncer.pools.sv_idle avg max min sum connection Server connections idle and ready for a client query
pgbouncer.pools.sv_used avg max min sum connection Server connections idle more than server_check_delay, needing server_check_query
pgbouncer.pools.sv_tested avg max min sum connection Server connections currently running either server_reset_query or server_check_query
pgbouncer.pools.sv_login avg max min sum connection Server connections currently in the process of logging in
pgbouncer.pools.maxwait avg max min sum second Age of oldest unserved client connection