Bug 535842 - (RHQ-253) Unable to inventory a postgres instance owned by 'postgres' user
Unable to inventory a postgres instance owned by 'postgres' user
Status: CLOSED NEXTRELEASE
Product: RHQ Project
Classification: Other
Component: Plugins (Show other bugs)
1.1pre
All All
medium Severity medium (vote)
: ---
: ---
Assigned To: Greg Hinkle
Jeff Weiss
http://jira.rhq-project.org/browse/RH...
:
Depends On:
Blocks: RHQ-778
  Show dependency treegraph
 
Reported: 2008-04-08 10:25 EDT by Jessica Sant
Modified: 2014-11-09 17:49 EST (History)
1 user (show)

See Also:
Fixed In Version: 1.1
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
r9832, r554, fedora 8, postgres 8.2.6 installed via yum
Last Closed:
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Jessica Sant 2008-04-08 10:25:00 EDT
I have a postgres 8.2.6 instance that I've installed via yum. 
When I run postgres, it is owned by the 'postgres' user.
When I run the rhq-agent, it is owned by my 'jsant' user.

In my agent log, I get the following error:
2008-04-07 09:41:47,288 INFO  [InventoryManager.discovery-1] (rhq.core.pc.inventory.AutoDiscoveryExecutor)- Process scan auto-detected new server resource: scan=[ProcessScan: query=[process|basename|match=^(postgres|postmaster)$,process|basename|nomatch|parent=^(postgres|postmaster)$], name=[unix]], discovered-process=[process: pid=[3749], name=[postmaster], ppid=[1]]
2008-04-07 09:41:47,309 INFO  [InventoryManager.discovery-1] (org.rhq.plugins.postgres.PostgresDiscoveryComponent)- Discovered a postgres process: ProcessScanResult: scan=[ProcessScan: query=[process|basename|match=^(postgres|postmaster)$,process|basename|nomatch|parent=^(postgres|postmaster)$], name=[unix]], info=[process: pid=[3749], name=[postmaster], ppid=[1]]
2008-04-07 09:41:47,310 ERROR [InventoryManager.discovery-1] (org.rhq.plugins.postgres.PostgresDiscoveryComponent)- PostgreSQL data directory (/var/lib/pgsql/data) does not exist.

The /var/lib/pgsql/data directory, however does exist -- but it is owned by the postgres user, and thus inaccessible by the jsant user running the agent.
Comment 1 Jessica Sant 2008-04-09 08:49:22 EDT
similar to RHQ-261, I'm able to auto-discover postgres if I run my rhq agent as root.
Comment 2 Joseph Marques 2008-07-20 23:56:16 EDT
this is a known limitation.  work-around is to run both processes as the same user, or run the agent as root.
Comment 3 Greg Hinkle 2008-07-22 18:47:14 EDT
I have the fix for this lying around
Comment 4 Greg Hinkle 2008-07-22 18:49:10 EDT
Works in degraded mode (the config tab gives an error), but at least you can do the basic monitoring.
Comment 5 Jeff Weiss 2008-08-04 15:30:15 EDT
not working with my latest postgres install
 ghinkle: ^^ trying to figure out why
<ghinkle> well, all i did jweiss, was to not fail if i couldn't read the postgresql.conf
<ghinkle> are there any agent messages?
<jweiss> ghinkle: where does it look?
<ghinkle> it tries to determine the data path from the environment
* jweiss pastebins messages
<ghinkle> do you see: "Unable to obtain data directory for postgres process with pid"
<jweiss> http://wwwapps.rdu.redhat.com/w3xpastebin/pastebin.php?show=6701
<ghinkle> hmm, ok i see
 is your PG_DATA_PATH readable by the agent user, but not the postgresql.conf ?
<jweiss> that file /usr/local/pgsql/data/postgresql.conf actually does exist, but the dir and file are only readable by postgres user.  let me check on the env var
<ghinkle> if the pddata dir exists but is not readable, it should've just been a warn and continued
<jweiss> PG_DATA_PATH is not set for either the agent user, nor the postgres user
<ghinkle> its probably starting with -D though
 which this will also read from
<jweiss> yeah, /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data
<ghinkle> well, i suppose i shouldn't fail in any of these cases, since I still try to connect on the defaults
<jweiss> is it supposed to fail in this case anyway?  i thought you said it should have just warned about the perms
<ghinkle> yea, this isn't a code path i expected
<jweiss> let me double check
<ghinkle> no need. i see it now
 i can fix this
Comment 6 Greg Hinkle 2008-08-04 16:25:32 EDT
Be even more flexible with permission failures while attempting to load the conf file. Should work even if the directory holding the data directory is readable but the data dir and/or the conf file are not readable.
Comment 7 Jeff Weiss 2008-08-20 11:03:34 EDT
I was able to get this inventoried manually.  Is it supposed to be auto-discoverable?  

In the agent log i get:
2008-08-20 11:01:15,941 INFO  [InventoryManager.discovery-1] (rhq.core.pc.inventory.AutoDiscoveryExecutor)- Process scan auto-detected new server resource: scan=[ProcessScan: query=[process|basename|match=^(postgres|postmaster)$,process|basename|nomatch|parent=^(postgres|postmaster)$], name=[unix]], discovered-process=[process: pid=[26045], name=[postgres], ppid=[1]]
2008-08-20 11:01:15,943 INFO  [InventoryManager.discovery-1] (org.rhq.plugins.postgres.PostgresDiscoveryComponent)- Discovered a postgres process: ProcessScanResult: scan=[ProcessScan: query=[process|basename|match=^(postgres|postmaster)$,process|basename|nomatch|parent=^(postgres|postmaster)$], name=[unix]], info=[process: pid=[26045], name=[postgres], ppid=[1]]
2008-08-20 11:01:15,943 ERROR [InventoryManager.discovery-1] (org.rhq.plugins.postgres.PostgresDiscoveryComponent)- Unable to obtain data directory for postgres process with pid 26045 (tried checking both -D command line argument, as well as PGDATA environment variable).

I don't get any metrics, but I suspect that's expected.  Greg can you confirm this is the expected behavior?
Comment 8 Jeff Weiss 2008-09-02 11:12:45 EDT
I am closing this bug out (refer to my comments above).  The auto-discover failure has been opened as a separate bug (see the "is a dependency of" of this bug).
Comment 9 Red Hat Bugzilla 2009-11-10 16:05:36 EST
This bug was previously known as http://jira.rhq-project.org/browse/RHQ-253
This bug is related to RHQ-261

Note You need to log in before you can comment on or make changes to this bug.