History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: RHQ-253
Type: Bug Bug
Status: Integrated Integrated
Resolution: Fixed
Priority: Major Major
Assignee: Greg Hinkle
Reporter: Jessica Sant
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
RHQ Project

Unable to inventory a postgres instance owned by 'postgres' user

Created: 08/Apr/08 09:25 AM   Updated: Friday 02:45 PM
Component/s: Plugins
Affects Version/s: 1.1pre
Fix Version/s: 1.1

Time Tracking:
Not Specified

Environment: r9832, r554, fedora 8, postgres 8.2.6 installed via yum
Issue Links:
Relation
 

Resolution Date: 04/Aug/08 03:25 PM
Date of First Response: 20/Jul/08 10:56 PM
Tester: Jeff Weiss
VCS Revision: 1,163


 Description  « Hide
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.


 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Jessica Sant - 09/Apr/08 07:49 AM
similar to RHQ-261, I'm able to auto-discover postgres if I run my rhq agent as root.

Joseph Marques - 20/Jul/08 10:56 PM
this is a known limitation. work-around is to run both processes as the same user, or run the agent as root.

Greg Hinkle - 22/Jul/08 05:47 PM
I have the fix for this lying around

Greg Hinkle - 22/Jul/08 05:49 PM
Works in degraded mode (the config tab gives an error), but at least you can do the basic monitoring.

Jeff Weiss - 04/Aug/08 02:30 PM
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

Greg Hinkle - 04/Aug/08 03:25 PM
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.

Jeff Weiss - 20/Aug/08 10:03 AM
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?