From 48b1e5aa6f8d2f5c3b306ffaf1a81c8678de2e37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20de=20Kock?= Date: Thu, 20 Jul 2017 18:13:11 +0200 Subject: [PATCH] Allow to specify database password --- plugins/postgresql/postgresql_tablespace_size | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/postgresql/postgresql_tablespace_size b/plugins/postgresql/postgresql_tablespace_size index cae81458..044969ce 100755 --- a/plugins/postgresql/postgresql_tablespace_size +++ b/plugins/postgresql/postgresql_tablespace_size @@ -23,6 +23,7 @@ dbserver='localhost' dbuser='postgres' +dbpass='' if [ "$1" = "config" ]; then echo 'graph_args --base 1024 --lower-limit 0' @@ -31,7 +32,7 @@ if [ "$1" = "config" ]; then echo 'graph_title PostgreSQL Tablespace Sizes' echo 'graph_vlabel Size (bytes)' - psql -h ${dbserver} -U ${dbuser} -tc "SELECT spcname FROM pg_tablespace ORDER BY 1;" | while read name + PGPASSWORD="${dbpass}" psql -h ${dbserver} -U ${dbuser} -tc "SELECT spcname FROM pg_tablespace ORDER BY 1;" | while read name do test -z "${name}" && continue echo ${name}'.label '${name} @@ -47,7 +48,7 @@ if [ "$1" = "config" ]; then exit 0 fi -psql -h ${dbserver} -U ${dbuser} -tc "SELECT spcname, PG_TABLESPACE_SIZE(oid) FROM pg_tablespace ORDER BY 1;" | while read name sep num +PGPASSWORD="${dbpass}" psql -h ${dbserver} -U ${dbuser} -tc "SELECT spcname, PG_TABLESPACE_SIZE(oid) FROM pg_tablespace ORDER BY 1;" | while read name sep num do test -z "${name}" && continue echo ${name}'.value '${num}