mirror of
https://github.com/munin-monitoring/contrib.git
synced 2024-09-10 10:42:43 +02:00
Merge branch 'master' of git.munin-monitoring.org:munin-contrib
This commit is contained in:
commit
52f40c980d
1 changed files with 37 additions and 0 deletions
37
plugins/db2/db2_cnx
Executable file
37
plugins/db2/db2_cnx
Executable file
|
@ -0,0 +1,37 @@
|
|||
#! /bin/sh
|
||||
# (c) 2012 - Steve Schnepp - LGPL
|
||||
|
||||
# XXX - coded hastily
|
||||
|
||||
# Source the DB2 profile
|
||||
. /home/db2inst1/sqllib/db2profile
|
||||
|
||||
echo "graph_title Number of connections"
|
||||
echo "graph_category DB2"
|
||||
echo "graph_args -l 0"
|
||||
|
||||
db2 list application | tail +5 | awk ' /^[A-Z]/ { print $1 }' | sort | uniq -c > $HOME/run/$(basename $0).txt
|
||||
|
||||
# Get users list
|
||||
touch $HOME/run/$(basename $0).users
|
||||
awk '{ print $2 }' $HOME/run/$(basename $0).txt | cat $HOME/run/$(basename $0).users - | sort -ru > $HOME/run/$(basename $0).users.tmp
|
||||
mv $HOME/run/$(basename $0).users.tmp $HOME/run/$(basename $0).users
|
||||
|
||||
# Emit config
|
||||
if [ "$1" = "config" ]
|
||||
then
|
||||
awk ' { print $1 ".label " $1 "\n" $1 ".draw AREASTACK" }' $HOME/run/$(basename $0).users
|
||||
fi
|
||||
|
||||
# Emit values
|
||||
for i in $( cat $HOME/run/$(basename $0).users )
|
||||
do
|
||||
TMPLINE=$(awk -v i=$i '($2 == i) { print }' $HOME/run/$(basename $0).txt)
|
||||
if [ -z "$TMPLINE" ]
|
||||
then
|
||||
echo "$i.value 0"
|
||||
else
|
||||
echo "$TMPLINE" | awk ' { print $2 ".value " $1 }'
|
||||
|
||||
fi
|
||||
done
|
Loading…
Reference in a new issue