I am using the check_postgres.pl plugin for Nagios. I am trying to monitor how long since the last checkpoint has been run using the check_postgres_checkpoint option. When I run the command from CLI as root I am getting the output but I am not able to get the output in the Nagios web interface. The error which it shows is,
ERROR: pg_controldata could not read the given data directory: "/opt/PostgreSQL/9.1/data"
It is trying to access the pg_control file in the 'global' directory present beneath the data directory which has only read access to the postgres user.
Can anyone please suggest me how this can be resolved ?