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

3/2/2026 6:50 PM

Last published date

3/2/2026 6:50 PM

Overview

  1. Confirm PostgreSQL version

    On the server hosting PostgreSQL:

    psql --version
    

    Example from the investigated environment (Windows):

    psql (PostgreSQL) 18.1
    
  2. Connect to PostgreSQL with psql

    psql -U postgres
    

    (Use the appropriate user/connection string for the environment.)

  3. Check the active data directory

    In the psql prompt:

    SHOW data_directory;
    

    Example outputs observed:

    • Windows: C:/Program Files/PostgreSQL/18/data

    • Linux: /var/lib/pgsql/…

  4. Verify pg_hba.conf under that directory

    On the OS, navigate to the path from SHOW data_directory and confirm that pg_hba.conf is 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

Hybrid Cloud Observability

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.conf exists, but it resides under the active data_directory for the instance (for example, C:\Program Files\PostgreSQL\18\data on Windows or /var/lib/pgsql/<version>/data on 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_directory rather than hard-coded paths.

Resolution

  1. Locate the correct data directory

    • Connect using psql and run:

      SHOW data_directory;
      
    • Note the returned path (e.g., C:\Program Files\PostgreSQL\18\data or similar in linux OS ).

  2. Edit pg_hba.conf in 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.

  3. Reload or restart PostgreSQL

    • Reload configuration or restart the PostgreSQL service so the pg_hba.conf changes take effect (standard PostgreSQL administration step).

  4. 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.conf under the correct data directory.