I have a monitor user that does a SSH from a remote location onto a database's host then runs commands of the form:
/usr/bin/psql -c "SELECT COUNT(*) FROM pg_stat_activity; ;" -U monitor -d db1 -q -A -t
The current pg_hba.conf is
# IPv4 local connections:
host all all 123.0.0.1/32 trust
which is far from ideal!
Am I right to presume that I have to change pg_hba.conf to
host db1 monitor 123.0.0.1/32 trust
host db1 user1 123.0.0.1/32 ident
host db1 user2 123.0.0.1/32 ident
then continue this format with individual entries for all the users in db1?
Or is there a 'better' way of running psql commands from a remote location?
Thanks
Austen
Austen Birchall Senior Database Administrator, Met Office