File tree Expand file tree Collapse file tree 1 file changed +5
-17
lines changed
Expand file tree Collapse file tree 1 file changed +5
-17
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ period=${1-daily}
1414
1515# Includes
1616source $VESTA /func/main.sh
17+ source $VESTA /func/db.sh
1718source $VESTA /conf/vesta.conf
1819
1920
@@ -66,23 +67,10 @@ for host in $hosts; do
6667 fi
6768
6869 if [ " $period " = ' daily' ]; then
69- # Defining host credentials
70- host_str=$( grep " HOST='$host '" $conf )
71- for key in $host_str ; do
72- eval ${key%% =* } =${key#* =}
73- done
74- sql=" mysql -h $HOST -u $USER -p$PASSWORD -e"
75-
76- # Checking empty vars
77- if [ -z $HOST ] || [ -z $USER ] || [ -z $PASSWORD ]; then
78- echo " Error: config is broken"
79- log_event " $E_PARSING " " $ARGUMENTS "
80- exit $E_PARSING
81- fi
82-
83- # Parsing data
84- status=$( $sql " SHOW GLOBAL STATUS" 2> /dev/null) ; code=" $? "
85- if [ ' 0' -ne " $code " ]; then
70+ mysql_connect $host
71+ query=' SHOW GLOBAL STATUS'
72+ status=$( mysql_query " $query " 2> /dev/null)
73+ if [ $? -ne 0 ]; then
8674 active=0
8775 slow=0
8876 else
You can’t perform that action at this time.
0 commit comments