Observability
PostgreSQL monitoring in SAM when pg_hba.conf is not in the documented location
When configuring SolarWinds SAM to monitor PostgreSQL, customers may not find the pg_hba.conf file in the path documented in the SAM PostgreSQL template article (which is based on PostgreSQL 9). In these cases, the PostgreSQL data directory is configured in a non-default location, so pg_hba.conf is present but not in the expected folder. You can locate the correct data directory by running SHOW data_directory; in psql, then edit pg_hba.conf there and proceed with the SAM documentation steps.
First published date
Last published date
Overview
-
Confirm PostgreSQL version
On the server hosting PostgreSQL:
psql --versionExample from the investigated environment (Windows):
psql (PostgreSQL) 18.1 -
Connect to PostgreSQL with
psqlpsql -U postgres(Use the appropriate user/connection string for the environment.)
-
Check the active data directory
In the
psqlprompt:SHOW data_directory;Example outputs observed:
-
Windows:
C:/Program Files/PostgreSQL/18/data -
Linux:
/var/lib/pgsql/…
-
-
Verify
pg_hba.confunder that directoryOn the OS, navigate to the path from
SHOW data_directoryand confirm thatpg_hba.confis present there (not necessarily under the version‑9 path used in the original doc examples).
If pg_hba.conf is found under the data_directory path but not under the documented path, this article applies.
Product section
Cause
-
The PostgreSQL instance is installed with a non-default data directory, so:
-
The documentation’s sample path does not match the actual installation.
-
pg_hba.confexists, but it resides under the activedata_directoryfor the instance (for example,C:\Program Files\PostgreSQL\18\dataon Windows or/var/lib/pgsql/<version>/dataon Linux).
-
-
The existing SAM documentation focuses on PostgreSQL 9 and does not clearly call out newer versions (15–18) or the need to rely on
SHOW data_directoryrather than hard-coded paths.
Resolution
-
Locate the correct data directory
-
Connect using
psqland run:SHOW data_directory; -
Note the returned path (e.g.,
C:\Program Files\PostgreSQL\18\dataorsimilar in linux OS).
-
-
Edit
pg_hba.confin that directory-
In the data directory from step 1, open
pg_hba.conf. -
Apply the access rules required by the SAM PostgreSQL component template article PostgreSQL , typically to allow connections from the SAM polling engine host using the appropriate authentication method.
-
-
Reload or restart PostgreSQL
-
Reload configuration or restart the PostgreSQL service so the
pg_hba.confchanges take effect (standard PostgreSQL administration step).
-
-
Configure SAM PostgreSQL monitoring as documented
-
In the SolarWinds web console, configure the PostgreSQL component monitor/template as per SAM documentation.
-
Use the same connection details (host, port, user/database) that are now allowed by
pg_hba.confunder the correct data directory.
-