mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
Slight change to default connection options for postgresql_active_backends postgresql_database_ratio so they are more likely to work with a default postgres setup.
This commit is contained in:
parent
2912117ad4
commit
9765abcb96
@ -20,14 +20,16 @@
|
||||
#
|
||||
# Log info:
|
||||
# 2007/11/30 - Review on comments
|
||||
# 2012/12/19 - Updated to connect locally instead of localhost by default
|
||||
# (PostgreSQL has different permissions for these).
|
||||
#
|
||||
|
||||
dbserver='localhost'
|
||||
dbserver='' #'-h hostname'
|
||||
dbuser='postgres'
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
maximum=$(psql -h ${dbserver} -U ${dbuser} -tc "SHOW max_connections;" | bc)
|
||||
reserved=$(psql -h ${dbserver} -U ${dbuser} -tc "SHOW superuser_reserved_connections;" | bc)
|
||||
maximum=$(psql ${dbserver} -U ${dbuser} -tc "SHOW max_connections;" | bc)
|
||||
reserved=$(psql ${dbserver} -U ${dbuser} -tc "SHOW superuser_reserved_connections;" | bc)
|
||||
warning=$(((maximum-reserved)*70/100))
|
||||
critical=$(((maximum-reserved)*90/100))
|
||||
echo 'graph_args --base 1000 --lower-limit 0 --upper-limit '${maximum}
|
||||
@ -46,4 +48,4 @@ if [ "$1" = "config" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo 'backends.value '$(psql -h ${dbserver} -U ${dbuser} -tc "SELECT SUM(numbackends) FROM pg_stat_database;" | bc)
|
||||
echo 'backends.value '$(psql ${dbserver} -U ${dbuser} -tc "SELECT SUM(numbackends) FROM pg_stat_database;" | bc)
|
||||
|
@ -54,4 +54,4 @@ if [ "$1" = "config" ]; then
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
psql -h ${dbserver} -U ${dbuser} -tc "SELECT '\n'||datname||'.value '||(CASE WHEN (blks_hit > 0) THEN ROUND((blks_hit::NUMERIC / (blks_hit + blks_read)::NUMERIC) * 100, 2) ELSE 0 END)::TEXT FROM pg_stat_database WHERE datname != 'template0' ORDER BY datname;"
|
||||
psql -h ${dbserver} -U ${dbuser} -tc "SELECT datname||'.value '||(CASE WHEN (blks_hit > 0) THEN ROUND((blks_hit::NUMERIC / (blks_hit + blks_read)::NUMERIC) * 100, 2) ELSE 0 END)::TEXT FROM pg_stat_database WHERE datname != 'template0' ORDER BY datname;"
|
||||
|
Loading…
Reference in New Issue
Block a user