From a2bab26ded1298b8613151527978b12627844f91 Mon Sep 17 00:00:00 2001 From: Greg Sabino Mullane Date: Mon, 30 Apr 2012 10:48:11 -0400 Subject: Better --dbservice docs, as pointed out by Jason Ryan on the mailing list. --- check_postgres.pl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'check_postgres.pl') diff --git a/check_postgres.pl b/check_postgres.pl index 2afb72d5d..cc75dfd04 100755 --- a/check_postgres.pl +++ b/check_postgres.pl @@ -7981,10 +7981,17 @@ Instead, one should use a .pgpass or pg_service.conf file. =item B<--dbservice=NAME> -The name of a service inside of the pg_service.conf file. This file is in your home directory by -default and contains a simple list of connection options. You can also pass additional information +The name of a service inside of the pg_service.conf file. Before version 9.0 of Postgres, this is +a global file, usually found in /etc/pg_service.conf. If you are using version 9.0 or higher of +Postgres, you can use the file ".pg_service.conf" in the home directory of the user running +the script, e.g. nagios. + +This file contains a simple list of connection options. You can also pass additional information when using this option such as --dbservice="maindatabase sslmode=require" +The documentation for this file can be found at +http://www.postgresql.org/docs/current/static/libpq-pgservice.html + =back The database connection options can be grouped: I<--host=a,b --host=c --port=1234 --port=3344> -- cgit v1.2.3 From 700ae911b534b1e567cd887a777ba3ffd1404d7f Mon Sep 17 00:00:00 2001 From: Ryan P. Kelly Date: Wed, 9 May 2012 10:18:59 -0400 Subject: Ignore sequences in the temporary namespace --- check_postgres.pl | 1 + 1 file changed, 1 insertion(+) (limited to 'check_postgres.pl') diff --git a/check_postgres.pl b/check_postgres.pl index 2afb72d5d..a15ecdb7a 100755 --- a/check_postgres.pl +++ b/check_postgres.pl @@ -7148,6 +7148,7 @@ FROM ( JOIN pg_namespace nsp ON nsp.oid = relnamespace WHERE relkind = 'S' ) AS seqs +WHERE nspname !~ '^pg_temp.*' ORDER BY nspname, seqname, typname }; ## use critic -- cgit v1.2.3 From 7c706ca3208b6f5be038fe31df46c90ff6846b97 Mon Sep 17 00:00:00 2001 From: Greg Sabino Mullane Date: Thu, 10 May 2012 15:21:33 -0400 Subject: Cache the pg_typmod lookups. --- check_postgres.pl | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'check_postgres.pl') diff --git a/check_postgres.pl b/check_postgres.pl index cc75dfd04..f575a21a6 100755 --- a/check_postgres.pl +++ b/check_postgres.pl @@ -7045,14 +7045,15 @@ sub find_catalog_info { ## For a function, we also want to put the args into the name if ($type eq 'function') { - ## Grab all type mappings - $SQL = 'SELECT oid, typname FROM pg_type'; - my %oid2type; - my $tinfo = run_command($SQL, { dbnumber => $dbnum }); - for my $row (@{ $tinfo->{db}[0]{slurp} }) { - $oid2type{$row->{oid}} = $row->{typname}; - } - (my $args = $row->{proargtypes}) =~ s/(\d+)/$oid2type{$1}||$1/ge; + ## Once per database, grab all mappings + if (! exists $opt{oid2type}{$dbnum}) { + $SQL = 'SELECT oid, typname FROM pg_type'; + my $tinfo = run_command($SQL, { dbnumber => $dbnum }); + for my $row (@{ $tinfo->{db}[0]{slurp} }) { + $opt{oid2type}{$dbnum}{$row->{oid}} = $row->{typname}; + } + } + (my $args = $row->{proargtypes}) =~ s/(\d+)/$opt{oid2type}{$dbnum}{$1}||$1/ge; $args =~ s/ /,/g; $args =~ s/ints/smallint/g; $args =~ s/int4/int/g; -- cgit v1.2.3