2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01: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
echo 'graph_title HS Read port connections'
echo "graph_args --base 100 -r --lower-limit 0 --upper-limit $graphlimit"
echo 'graph_category network'
echo "graph_args --base 1000 -l 0"
echo 'graph_category mysql'
echo 'total.label Total'
echo 'total.draw AREA'
echo 'total.type DERIVE'
echo 'total.min 0'
echo 'active.label Active'
echo 'active.draw LINE2'
echo 'active.type DERIVE'
echo 'active.min 0'
exit 0
fi
@ -56,26 +54,26 @@ fi
# query
command='mysql';
if [![ -z $mysql_host ]]; then
if [[ ! -z $mysql_host ]]; then
command="$command -h $mysql_host"
fi
if [![ -z $mysql_user ]]; then
command="$command -u $mysql_user"
else
if [ -z $mysql_user ]; then
command="$command -u root"
else
command="$command -u $mysql_user"
fi
if [![ -z $mysql_password ]]; then
if [[ ! -z $mysql_password ]]; then
command="$command -p$mysql_password"
fi
if [![ -z $mysql_port ]]; then
if [[ ! -z $mysql_port ]]; then
command="$command -P $mysql_port"
fi
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}')
echo "total.$totalConnections";
echo "active.$totalActiveConnections";
echo "total.value $totalConnections";
echo "active.value $totalActiveConnections";

View File

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