diff options
author | am <am@d66ca3ae-40d7-4aa7-90d4-87d79ca94279> | 2008-02-01 11:46:02 +0000 |
---|---|---|
committer | am <am@d66ca3ae-40d7-4aa7-90d4-87d79ca94279> | 2008-02-01 11:46:02 +0000 |
commit | 85c9964402016623ed48b66716ce8ece9753df56 (patch) | |
tree | 0d5152effd48a7424cfda84140a97e77afcd683a /files/plugins/pg_conn | |
parent | 4eb04b7906f4ab46160ddb0e89f487ba636990d3 (diff) |
neuer versuch mit munin für immer1-5
git-svn-id: https://rfd.cronopios.org/ipuppet/trunk/modules/munin@662 d66ca3ae-40d7-4aa7-90d4-87d79ca94279
Diffstat (limited to 'files/plugins/pg_conn')
-rwxr-xr-x | files/plugins/pg_conn | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/files/plugins/pg_conn b/files/plugins/pg_conn new file mode 100755 index 0000000..aa2ebb7 --- /dev/null +++ b/files/plugins/pg_conn @@ -0,0 +1,51 @@ +#!/bin/sh +# +# Plugin to monitor PostgreSQL connections. +# +# Parameters: +# +# config (required) +# autoconf (optional - only used by munin-config) +# Based on netstat plugin +# $Log$ +# eric@ohmforce.com +# +# +# Magic markers (optional - used by munin-config and some installation +# scripts): +#%# family=auto +#%# capabilities=autoconf + + + +if [ "$1" = "autoconf" ]; then + if ( netstat -s 2>/dev/null >/dev/null ); then + echo yes + exit 0 + else + if [ $? -eq 127 ] + then + echo "no (netstat program not found)" + exit 1 + else + echo no + exit 1 + fi + fi +fi + +if [ "$1" = "config" ]; then + + echo 'graph_title PostgreSQL' + echo 'graph_args -l 0 ' + echo 'graph_vlabel Number of PostgreSQL connections' + echo 'graph_category postgresql' + echo 'graph_period second' + echo 'graph_info This graph shows the number of opened connections on PostgreSQL.' + echo 'established.label established' + echo 'established.type GAUGE' + echo 'established.max 500' + echo 'established.info The number of currently open connections.' + exit 0 +fi +netstat -a | awk '{ print $4 }'| grep postgres | wc -l | xargs echo established.value |