From c69a5761dc1b5502f5fc6e53cd9eb60ca20de849 Mon Sep 17 00:00:00 2001 From: Konstantin Kuklin Date: Sat, 4 Oct 2014 14:34:51 +0400 Subject: [PATCH] fixed graph category, graph types --- plugins/mysql/hs_read | 22 ++++++++++------------ plugins/mysql/hs_write | 22 ++++++++++------------ 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/plugins/mysql/hs_read b/plugins/mysql/hs_read index 4e2dd0ca..a7c0b967 100644 --- a/plugins/mysql/hs_read +++ b/plugins/mysql/hs_read @@ -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"; diff --git a/plugins/mysql/hs_write b/plugins/mysql/hs_write index 88ee6d80..df02adaa 100644 --- a/plugins/mysql/hs_write +++ b/plugins/mysql/hs_write @@ -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";