PMDAPOSTGRESQL(1)

πŸ’… PMDAPOSTGRESQL(1) β€” the PostgreSQL database PMDA, bestie edition ✨

okay so first things first: this is a General Commands Manual page, section 1, for the command literally called pmdapostgresql. yes that's a mouthful. yes we're gonna get through it together. grab a snack πŸ“


🌸 NAME 🌸

pmdapostgresql β€” the PostgreSQL database PMDA. that's it, that's the name, no notes. πŸ‘‘


✨ DESCRIPTION ✨

so pmdapostgresql is a Performance Co-Pilot (aka PCP) Performance Metrics Domain Agent β€” a PMDA, iykyk β€” and what it does is it goes and extracts live performance data from a PostgreSQL database server that's actually running. like it's out here pulling real-time stats, no cap. πŸ”₯

ngl, big heads-up: a LOT of the statistics that a PostgreSQL server could give you are not enabled by default. like, they're just sitting there turned off. so go read the online docs at https://postgresql.org/docs/current/static/monitoring-stats.html β€” that page describes every single available parameter related to statistics collection and tells you how to turn them on. fr fr, go read it. πŸ“–

πŸŽ€ CONFIGURATION πŸŽ€

pmdapostgresql reads a mandatory ini-style config file:

$PCP_PMDAS_DIR/postgresql/pmdapostgresql.conf

right now this file has literally just one section: [authentication]. and that section specifies values for these settings. the file that ships with it has commented-out examples in it β€” so you have to configure all the required settings before you install the PMDA. no skipping steps bestie. πŸ™ˆ

  • host (local) β€” the hostname to connect to.
  • port (5432) β€” the port number to use.
  • dbname (postgres) β€” the database name.
  • user (postgres) β€” the username to connect to the database.
  • password (password) β€” the password to connect to the database.
  • osuser (unset) β€” the operating system user the PMDA runs as.
πŸ’€ important, do not skip: those values up there are examples only. the configuration that ships with it is not sufficient to install the PMDA. you gotta uncomment and configure host, port, dbname, user, and password β€” even for a local server using the default PostgreSQL configuration. yes, even then. yes really.

so here's the tea on osuser: if it's not specified in the config file, the PMDA just runs as the current user. and if you set host to local, it'll use a UNIX domain socket, which uses peer authentication β€” go check the comments in the pg_hba.conf file for that. in that case, you should probably set osuser to postgres. πŸ’…

also, not me pointing out that the port number is required even for a UNIX domain connection, because it's used as the socket filename by the server. so like, don't leave it out. 🫢


πŸ¦‹ INSTALLATION πŸ¦‹

to install it, the following must be done as root:

# cd $PCP_PMDAS_DIR/postgresql
# ./Install

to uninstall it, the following must be done as root:

# cd $PCP_PMDAS_DIR/postgresql
# ./Remove

pmdapostgresql is launched by pmcd(1) and should never be executed directly. like, ever. don't do it. the Install and Remove scripts are the ones that notify pmcd(1) when the agent gets installed or removed. they handle the communication, you don't gotta. 😌

and good news: pmdapostgresql will automatically attempt to reconnect to the PostgreSQL server if its connection is lost β€” like, say, if the PostgreSQL service gets restarted. it just does that. main character energy honestly. ✨


⭐ SUPPORTED VERSIONS ⭐

this version of 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 figure out the column ordering. it also tolerates missing or renamed tables and/or columns. so like... it's pretty chill about it. 🌈


πŸ’– FILES πŸ’–

  • $PCP_PMDAS_DIR/postgresql/pmdapostgresql.conf β€” the configuration file for the pmdapostgresql agent.
  • $PCP_PMDAS_DIR/postgresql/Install β€” the installation script for the pmdapostgresql agent.
  • $PCP_PMDAS_DIR/postgresql/Remove β€” the undo installation script for the pmdapostgresql agent.
  • $PCP_LOG_DIR/pmcd/postgresql.log β€” the default log file for messages from the pmdapostgresql agent.
πŸ“Œ quick 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, so don't come for me if yours looks different. πŸ’œ

🌸 PCP ENVIRONMENT 🌸

environment variables with the prefix PCP_ are used to parameterize the file and directory names that PCP uses. every installation has a file at /etc/pcp.conf that contains the local values for these variables. πŸ—‚οΈ

and the $PCP_CONF variable can be used to specify an alternative configuration file, as described in pcp.conf(5). slay. πŸ’…


πŸ‘‘ SEE ALSO πŸ‘‘

PCPIntro(1), pmcd(1) and https://postgresql.org/docs/current/static/monitoring-stats.html.


and that's the whole page bestie, we ate and left no crumbs πŸ“βœ¨ this iconic little number came to you from Performance Co-Pilot β€” yes, the PCP girlies β€” and that's the vibe check passed. mwah πŸ’–πŸ¦‹πŸŽ€

πŸ“¦ where this page comes from