Add wsrep_flow_control_paused check
If this value is > 0.1 usually there is a problem. Also add default exit value to UNKNOWN.
This commit is contained in:
@@ -6,7 +6,7 @@ Version 1.0, Guillaume Coré <g@fridim.org>
|
|||||||
|
|
||||||
check_galera_cluster is a Nagios plugin to monitor Galera cluster status.
|
check_galera_cluster is a Nagios plugin to monitor Galera cluster status.
|
||||||
|
|
||||||
check_galera_cluster -u USER -p PASSWORD [-H HOST] [-P PORT] [-w SIZE] [-c SIZE] [-0]
|
check_galera_cluster -u USER -p PASSWORD [-H HOST] [-P PORT] [-w SIZE] [-c SIZE] [-f FLOAT] [-0]
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
u)
|
u)
|
||||||
@@ -21,5 +21,7 @@ Version 1.0, Guillaume Coré <g@fridim.org>
|
|||||||
Sets minimum number of nodes in the cluster when WARNING is raised. (default is same as critical).
|
Sets minimum number of nodes in the cluster when WARNING is raised. (default is same as critical).
|
||||||
c)
|
c)
|
||||||
Sets minimum number of nodes in the cluster when CRITICAL is raised. (default is 2).
|
Sets minimum number of nodes in the cluster when CRITICAL is raised. (default is 2).
|
||||||
|
f)
|
||||||
|
Sets critical value of wsrep_flow_control_paused (default is 0.1).
|
||||||
0)
|
0)
|
||||||
Rise CRITICAL if the node is not primary
|
Rise CRITICAL if the node is not primary
|
||||||
|
|||||||
+20
-2
@@ -7,6 +7,7 @@ ST_OK=0
|
|||||||
ST_WR=1
|
ST_WR=1
|
||||||
ST_CR=2
|
ST_CR=2
|
||||||
ST_UK=3
|
ST_UK=3
|
||||||
|
ST_FINAL=$ST_UK
|
||||||
|
|
||||||
print_version() {
|
print_version() {
|
||||||
echo "$VERSION $AUTHOR"
|
echo "$VERSION $AUTHOR"
|
||||||
@@ -17,7 +18,7 @@ print_help() {
|
|||||||
echo ""
|
echo ""
|
||||||
echo "$PROGNAME is a Nagios plugin to monitor Galera cluster status."
|
echo "$PROGNAME is a Nagios plugin to monitor Galera cluster status."
|
||||||
echo ""
|
echo ""
|
||||||
echo "$PROGNAME -u USER -p PASSWORD [-H HOST] [-P PORT] [-w SIZE] [-c SIZE] [-0]"
|
echo "$PROGNAME -u USER -p PASSWORD [-H HOST] [-P PORT] [-w SIZE] [-c SIZE] [-f FLOAT] [-0]"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Options:"
|
echo "Options:"
|
||||||
echo " u)"
|
echo " u)"
|
||||||
@@ -32,6 +33,8 @@ print_help() {
|
|||||||
echo " Sets minimum number of nodes in the cluster when WARNING is raised. (default is same as critical)."
|
echo " Sets minimum number of nodes in the cluster when WARNING is raised. (default is same as critical)."
|
||||||
echo " c)"
|
echo " c)"
|
||||||
echo " Sets minimum number of nodes in the cluster when CRITICAL is raised. (default is 2)."
|
echo " Sets minimum number of nodes in the cluster when CRITICAL is raised. (default is 2)."
|
||||||
|
echo " f)"
|
||||||
|
echo " Sets critical value of wsrep_flow_control_paused (default is 0.1)."
|
||||||
echo " 0)"
|
echo " 0)"
|
||||||
echo " Rise CRITICAL if the node is not primary"
|
echo " Rise CRITICAL if the node is not primary"
|
||||||
exit $ST_UK
|
exit $ST_UK
|
||||||
@@ -41,8 +44,9 @@ print_help() {
|
|||||||
crit=2
|
crit=2
|
||||||
port='3306'
|
port='3306'
|
||||||
mysqlhost='localhost'
|
mysqlhost='localhost'
|
||||||
|
fcp=0.1
|
||||||
|
|
||||||
while getopts “hvu:p:H:P:w:c:0” OPTION; do
|
while getopts “hvu:p:H:P:w:c:f:0” OPTION; do
|
||||||
case $OPTION in
|
case $OPTION in
|
||||||
h)
|
h)
|
||||||
print_help
|
print_help
|
||||||
@@ -70,6 +74,9 @@ while getopts “hvu:p:H:P:w:c:0” OPTION; do
|
|||||||
c)
|
c)
|
||||||
crit=$OPTARG
|
crit=$OPTARG
|
||||||
;;
|
;;
|
||||||
|
f)
|
||||||
|
fcp=$OPTARG
|
||||||
|
;;
|
||||||
0)
|
0)
|
||||||
primary='TRUE'
|
primary='TRUE'
|
||||||
;;
|
;;
|
||||||
@@ -100,6 +107,17 @@ 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)
|
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)
|
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)
|
||||||
|
|
||||||
|
if [ -z "$r3" ]; then
|
||||||
|
echo "UNKNOWN: wsrep_flow_control_paused is empty"
|
||||||
|
ST_FINAL=$ST_UK
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $(echo "$r3 > $fcp" | bc) = 1 ]; then
|
||||||
|
echo "CRITICAL: wsrep_flow_control_paused is > $fcp"
|
||||||
|
ST_FINAL=$ST_CR
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$primary" = 'TRUE' ]; then
|
if [ "$primary" = 'TRUE' ]; then
|
||||||
if [ "$r2" != 'Primary' ]; then
|
if [ "$r2" != 'Primary' ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user