1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

fixed graph category, graph types

This commit is contained in:
Konstantin Kuklin 2014-10-04 14:34:51 +04:00
parent 75d48c9630
commit c69a5761dc
2 changed files with 20 additions and 24 deletions

View file

@ -40,15 +40,13 @@ fi
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then
echo 'graph_title HS Read port connections' echo 'graph_title HS Read port connections'
echo "graph_args --base 100 -r --lower-limit 0 --upper-limit $graphlimit" echo "graph_args --base 1000 -l 0"
echo 'graph_category network' echo 'graph_category mysql'
echo 'total.label Total' echo 'total.label Total'
echo 'total.draw AREA' echo 'total.draw AREA'
echo 'total.type DERIVE'
echo 'total.min 0' echo 'total.min 0'
echo 'active.label Active' echo 'active.label Active'
echo 'active.draw LINE2' echo 'active.draw LINE2'
echo 'active.type DERIVE'
echo 'active.min 0' echo 'active.min 0'
exit 0 exit 0
fi fi
@ -56,26 +54,26 @@ fi
# query # query
command='mysql'; command='mysql';
if [![ -z $mysql_host ]]; then if [[ ! -z $mysql_host ]]; then
command="$command -h $mysql_host" command="$command -h $mysql_host"
fi fi
if [![ -z $mysql_user ]]; then if [ -z $mysql_user ]; then
command="$command -u $mysql_user"
else
command="$command -u root" command="$command -u root"
else
command="$command -u $mysql_user"
fi fi
if [![ -z $mysql_password ]]; then if [[ ! -z $mysql_password ]]; then
command="$command -p$mysql_password" command="$command -p$mysql_password"
fi fi
if [![ -z $mysql_port ]]; then if [[ ! -z $mysql_port ]]; then
command="$command -P $mysql_port" command="$command -P $mysql_port"
fi fi
totalConnections=$(echo 'show processlist;' | $command | awk ' /'mode=rd'/ {x += $11}; END {print x}') totalConnections=$(echo 'show processlist;' | $command | awk ' /'mode=rd'/ {x += $11}; END {print x}')
totalActiveConnections=$(echo 'show processlist;' | $command | awk ' /'mode=rd'/ {x += $13}; END {print x}') totalActiveConnections=$(echo 'show processlist;' | $command | awk ' /'mode=rd'/ {x += $13}; END {print x}')
echo "total.$totalConnections"; echo "total.value $totalConnections";
echo "active.$totalActiveConnections"; echo "active.value $totalActiveConnections";

View file

@ -41,15 +41,13 @@ fi
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then
echo 'graph_title HS Write port connections' echo 'graph_title HS Write port connections'
echo "graph_args --base 100 -r --lower-limit 0 --upper-limit $graphlimit" echo "graph_args --base 1000 -l 0"
echo 'graph_category network' echo 'graph_category mysql'
echo 'total.label Total' echo 'total.label Total'
echo 'total.draw AREA' echo 'total.draw AREA'
echo 'total.type DERIVE'
echo 'total.min 0' echo 'total.min 0'
echo 'active.label Active' echo 'active.label Active'
echo 'active.draw LINE2' echo 'active.draw LINE2'
echo 'active.type DERIVE'
echo 'active.min 0' echo 'active.min 0'
exit 0 exit 0
fi fi
@ -57,26 +55,26 @@ fi
# query # query
command='mysql'; command='mysql';
if [![ -z $mysql_host ]]; then if [[ ! -z $mysql_host ]]; then
command="$command -h $mysql_host" command="$command -h $mysql_host"
fi fi
if [![ -z $mysql_user ]]; then if [[ ! -z $mysql_user ]]; then
command="$command -u $mysql_user" command="$command -u $mysql_user"
else else
command="$command -u root" command="$command -u root"
fi fi
if [![ -z $mysql_password ]]; then if [[ ! -z $mysql_password ]]; then
command="$command -p$mysql_password" command="$command -p$mysql_password"
fi fi
if [![ -z $mysql_port ]]; then if [[ ! -z $mysql_port ]]; then
command="$command -P $mysql_port" command="$command -P $mysql_port"
fi fi
totalConnections=$(echo 'show processlist;' | $command | awk ' /'mode=rw'/ {x += $11}; END {print x}') totalConnections=$(echo 'show processlist;' | $command | awk ' /'mode=wr'/ {x += $11}; END {print x}')
totalActiveConnections=$(echo 'show processlist;' | $command | awk ' /'mode=rw'/ {x += $13}; END {print x}') totalActiveConnections=$(echo 'show processlist;' | $command | awk ' /'mode=wr'/ {x += $13}; END {print x}')
echo "total.$totalConnections"; echo "total.value $totalConnections";
echo "active.$totalActiveConnections"; echo "active.value $totalActiveConnections";