check more status variables :

* wsrep_ready (ON)
    * wsrep_connected (ON)
    * wsrep_local_state_comment (Synced)

    Also add --batch and --skip-column-names to mysql command (get rid
    of grep)
This commit is contained in:
Guillaume Coré
2013-06-19 15:43:34 -04:00
parent 40869fb2b4
commit 10802af0c4
+21 -3
View File
@@ -104,9 +104,12 @@ if [ -z "$password" ]; then
exit $ST_UK
fi
r1=$(mysql -h$mysqlhost -P$port -u$mysqluser -p$password -e "show status like 'wsrep_cluster_size'"|grep wsrep_cluster_size|cut -f 2)
r2=$(mysql -h$mysqlhost -P$port -u$mysqluser -p$password -e "show status like 'wsrep_cluster_status'"|grep wsrep_cluster_status|cut -f 2)
r3=$(mysql -h$mysqlhost -P$port -u$mysqluser -p$password -e "show status like 'wsrep_flow_control_paused'"|grep wsrep_flow_control_paused|cut -f 2)
r1=$(mysql -h$mysqlhost -P$port -u$mysqluser -p$password -B -N -e "show status like 'wsrep_cluster_size'"|cut -f 2) # 3 (GALERA_CLUSTER_SIZE)
r2=$(mysql -h$mysqlhost -P$port -u$mysqluser -p$password -B -N -e "show status like 'wsrep_cluster_status'"|cut -f 2) # Primary
r3=$(mysql -h$mysqlhost -P$port -u$mysqluser -p$password -B -N -e "show status like 'wsrep_flow_control_paused'"|cut -f 2) # < 0.1
r4=$(mysql -h$mysqlhost -P$port -u$mysqluser -p$password -B -N -e "show status like 'wsrep_ready'"|cut -f 2) # ON
r5=$(mysql -h$mysqlhost -P$port -u$mysqluser -p$password -B -N -e "show status like 'wsrep_connected'"|cut -f 2) # ON
r6=$(mysql -h$mysqlhost -P$port -u$mysqluser -p$password -B -N -e "show status like 'wsrep_local_state_comment'"|cut -f 2) # Synced
if [ -z "$r3" ]; then
echo "UNKNOWN: wsrep_flow_control_paused is empty"
@@ -125,6 +128,21 @@ if [ "$primary" = 'TRUE' ]; then
fi
fi
if [ "$r4" != 'ON' ]; then
echo "CRITICAL: node is not ready"
ST_FINAL=$ST_CR
fi
if [ "$r5" != 'ON' ]; then
echo "CRITICAL: node is not connected"
ST_FINAL=$ST_CR
fi
if [ "$r6" != 'Synced' ]; then
echo "CRITICAL: node is not synced"
ST_FINAL=$ST_CR
fi
if [ $r1 -gt $warn ]; then
echo "OK: number of NODES = $r1"
ST_FINAL=${ST_FINAL-$ST_OK}