I’ve followed the instructions here:
but am not getting the desired results.
When I configure /root/.pgpass as defined here:
I also make sure I set the DBuser and the path:
correctly in the /etc/snmp/postgres file.
When I then run the /etc/snmp/postgres script, I get:
/etc/snmp/postgres 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ERROR: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
the reason is, we have the postgres running on port 5598, so technically, the check_postgres perl script needs the port information (for some reason it isn’t picking it up from .pgpass).
So when I change the line in /etc/snmp/postgres to:
$cpg -u $DBuser -p 5598 --action dbstats | awk -F ' ' '
and then re-run the script, I then get output.
I then go to the web GUI, turn on unix_agent, go to Apps, turn on Postgres, go to the Apps tab and check the output, and basically still see -nan and 0’s.
Is there a “right way” to do this monitoring?
Note 1: we also have another DB running on port 5599 on the same host, so am wondering how this script detects multiple databases on the one host when it seems to require the port to be defined in the /etc/snmp/postgres script.
Note 2: We get the check_postgres.pl script v2.22 from here: