A question about the permissions

From: Tim Uckun <timuckun(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: A question about the permissions
Date: 2009-07-27 23:55:57
Message-ID: 855e4dcf0907271655n47764902r4f1cd5534afef416@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I am trying to monitor replication lag using zabbix. I have written a
simple script in ruby to get the lag it goes like this.

require 'date'
require 'yaml'

y = YAML.load `/usr/lib/postgresql/8.3/bin/pg_controldata
/var/lib/postgresql/8.3/main`
last_checkpoint = DateTime.parse( y['Time of latest checkpoint'])
hours, mins, secs, fractions = Date::day_fraction_to_time(DateTime.now
- last_checkpoint)
puts hours * 60 * 60 + mins * 60 + secs

When I try to run this script as the zabbix user (or any user other
than postgres or root) I get the error

pg_controldata: could not open file
"/var/lib/postgresql/8.3/main/global/pg_control" for reading:
Permission denied

This is because everything under the 8.3 directory is readable by the
postgres user only (not group permissions).

Is there any harm to giving the postgres group the same rights as the
postgres group and adding the zabbix user to the postgres group?

What is the rationale for not giving the group any permissions at all?

Thanks.

BTW I think it's really cool that the output of pg_controldata is a
YAML parseable format. I am pretty sure that's by accident but don't
change it :)

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joshua D. Drake 2009-07-28 00:04:31 Re: For production: 8.4 or 8.3?
Previous Message Christophe Pettus 2009-07-27 23:53:19 Building from source vs RPMs