[check_postgres] Issue when using --dbservice and --dbname
Guillaume Lelarge
guillaume at lelarge.info
Wed Mar 3 17:23:06 UTC 2010
Hi,
It seems you cannot override the database name when you use a service
name. This only occurs for 8.3+ PostgreSQL releases.
Here is the part of the code that handles this:
1772 if (defined $db->{dbservice} and length $db->{dbservice}) { ## XX
Check for simple names
1773 $db->{pname} = "service=$db->{dbservice}";
1774 if ($psql_version >= 8.3) {
1775 push @args, qq{service=$db->{dbservice}};
1776 }
1777 else {
1778 $ENV{PGSERVICE} = $db->{dbservice};
1779 }
1780 }
1781 else {
1782 $db->{pname} = "port=$db->{port} host=$db->{host}
db=$db->{dbname} user=$db->{dbuser}";
1783 }
(numbers at the beginning are line numbers since my latest "git pull" 5
minutes ago)
If a user has an 8.2 or earlier release, check_postgres uses something
like :
PGSERVICE="service=servicename" psql dbname
Which works whatever releases you use.
If a user has at least an 8.3 release, check_postgres uses something like :
psql dbname "service=servicename"
This way causes psql to think that "service=servicename" is the
username. We end up with an error message like this one:
psql: FATAL: Ident authentication failed for user "service=servicename"
I don't see any value for the release check. I may be wrong :) I fixed
my issue by deleting lines 1774, 1775, 1776, 1777, and 1779. See patch
attached.
Regards.
--
Guillaume.
http://www.postgresqlfr.org
http://dalibo.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: servicename.patch
Type: text/x-patch
Size: 627 bytes
Desc: not available
Url : https://mail.endcrypt.com/pipermail/check_postgres/attachments/20100303/378424bd/attachment.bin
More information about the Check_postgres
mailing list