Révision 48b1e5aa
Allow to specify database password
| plugins/postgresql/postgresql_tablespace_size | ||
|---|---|---|
| 23 | 23 |
|
| 24 | 24 |
dbserver='localhost' |
| 25 | 25 |
dbuser='postgres' |
| 26 |
dbpass='' |
|
| 26 | 27 |
|
| 27 | 28 |
if [ "$1" = "config" ]; then |
| 28 | 29 |
echo 'graph_args --base 1024 --lower-limit 0' |
| ... | ... | |
| 31 | 32 |
echo 'graph_title PostgreSQL Tablespace Sizes' |
| 32 | 33 |
echo 'graph_vlabel Size (bytes)' |
| 33 | 34 |
|
| 34 |
psql -h ${dbserver} -U ${dbuser} -tc "SELECT spcname FROM pg_tablespace ORDER BY 1;" | while read name
|
|
| 35 |
PGPASSWORD="${dbpass}" psql -h ${dbserver} -U ${dbuser} -tc "SELECT spcname FROM pg_tablespace ORDER BY 1;" | while read name
|
|
| 35 | 36 |
do |
| 36 | 37 |
test -z "${name}" && continue
|
| 37 | 38 |
echo ${name}'.label '${name}
|
| ... | ... | |
| 47 | 48 |
exit 0 |
| 48 | 49 |
fi |
| 49 | 50 |
|
| 50 |
psql -h ${dbserver} -U ${dbuser} -tc "SELECT spcname, PG_TABLESPACE_SIZE(oid) FROM pg_tablespace ORDER BY 1;" | while read name sep num
|
|
| 51 |
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
|
|
| 51 | 52 |
do |
| 52 | 53 |
test -z "${name}" && continue
|
| 53 | 54 |
echo ${name}'.value '${num}
|
Formats disponibles : Unified diff