1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 10:39:53 +00:00

Merge pull request #864 from adekock11/patch-1

Allow to specify database password
This commit is contained in:
sumpfralle 2018-06-10 14:16:33 +02:00 committed by GitHub
commit 8647618f95
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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}