2014-05-29 16:36:43 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2014-10-01 20:39:18 +00:00
|
|
|
# These defaults are commented out because selinux doesn't like us running that
|
|
|
|
# hostname on rhel7 for some reason. Anyways, we always pass in the arguments
|
|
|
|
# via the collectd configuration information so wth. -- threebean
|
|
|
|
#pause=10
|
|
|
|
#host=$( /usr/bin/hostname -s )
|
2014-05-29 16:36:43 +00:00
|
|
|
|
|
|
|
while getopts "h:p:s:" c; do
|
|
|
|
case $c in
|
|
|
|
h) host=$OPTARG;;
|
|
|
|
p) pause=$OPTARG;;
|
|
|
|
*) echo "Usage: /bin/bash [-h <hostname>] [-p <seconds>]";;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
while [ $? -eq 0 ] ; do
|
|
|
|
time="$(date +%s)"
|
2014-05-29 16:40:13 +00:00
|
|
|
for db in {{ ' '.join(databases) }}
|
2014-05-29 16:36:43 +00:00
|
|
|
do
|
2014-10-01 22:52:24 +00:00
|
|
|
echo "PUTVAL $host/pg_conns/current_connections-$db $time:$(ps auxwww | grep -c $db)"
|
2014-05-29 16:36:43 +00:00
|
|
|
done
|
|
|
|
sleep $pause
|
|
|
|
done
|