table of contents
PMDAPOSTGRESQL(1) | General Commands Manual | PMDAPOSTGRESQL(1) |
NAME¶
pmdapostgresql - PostgreSQL database PMDA
DESCRIPTION¶
pmdapostgresql is a Performance Co-Pilot PMDA which extracts live performance data from a running PostgreSQL database server.
Many of the staticstics available from a PostgreSQL server may not be enabled by default. Refer to the online documentation at https://www.postgresql.org/docs/current/static/monitoring-stats.html which describes each of the available parameters related to statistics collection and how to enable them.
INSTALLATION¶
pmdapostgresql uses a configuration file from $PCP_PMDAS_DIR/postgresql/postgresql.conf
This file currently contains only one section [authentication] which specifies values for the following default settings:
- host - hostname, [default: 'local']
- port - port number, [default: '5432']
- dbname - database name, [default: 'postgres']
- username - username to run as and to connect to the database [default: 'postgres']
- password - password to connect to the database [default: 'password']
- osuser - operating system user the PMDA runs as [default: not set]
The defaults (as above) will result in the PMDA running as the current user, using a UNIX domain socket connection to the PostgreSQL server on the localhost. If osuser is not specified in the configuration file, the PMDA will run as the current user. A host specification of "local" will use a UNIX domain socket, which uses peer authentication, see comments in the pg_hba.conf file. In this case, the osuser setting should probably be set to postgres.
It is generally not necessary to alter the default configuration file for monitoring the local PostgreSQL server instance with a default server configuration. Note the port number is required even for a UNIX domain connection because it's used as the socket filename by the server.
Once this is setup, you can access the names and values for the postgresql performance metrics by doing the following as root:
# cd $PCP_PMDAS_DIR/postgresql
# ./Install
To uninstall, do the following as root:
# cd $PCP_PMDAS_DIR/postgresql
# ./Remove
pmdapostgresql is launched by pmcd(1) and should never be executed directly. The Install and Remove scripts notify pmcd(1) when the agent is installed or removed.
pmdapostgresql will automatically attempt to reconnect to the PostgreSQL server if it's connection is lost - e.g. if the PostgreSQL service is restarted.
SUPPORTED VERSIONS¶
pmdapostgresql has been tested and verified with PostgreSQL server version 10.2 and earlier. Later versions will probably also work correctly because the PMDA probes the various performance tables on start-up to determine the column ordering. It also tolerates missing or renamed tables and/or columns.
FILES¶
- $PCP_PMDAS_DIR/postgresql/pmdapostgresql.conf
- configuration file for pmdapostgresql
- $PCP_PMDAS_DIR/postgresql/Install
- installation script for the pmdapostgresql agent
- $PCP_PMDAS_DIR/postgresql/Remove
- undo installation script for the pmdapostgresql agent
- $PCP_LOG_DIR/pmcd/postgresql.log
- default log file for error messages from pmdapostgresql
Note the usual/default value for $PCP_PMDAS_DIR is /var/lib/pcp/pmdas and the default for $PCP_LOG_DIR is /var/log/pcp but these settings are platform dependent.
PCP ENVIRONMENT¶
Environment variables with the prefix PCP_ are used to parameterize the file and directory names used by PCP. On each installation, the file /etc/pcp.conf contains the local values for these variables. The $PCP_CONF variable may be used to specify an alternative configuration file, as described in pcp.conf(5).
SEE ALSO¶
PCPIntro(1), PMCD(1) and https://www.postgresql.org/docs/current/static/monitoring-stats.html
PCP | Performance Co-Pilot |