@@ -44,7 +44,7 @@ main() {
44
44
-u) shift ; OPT_UTC=1; ;;
45
45
-w) shift ; OPT_WARN=" ${1} " ; shift ; ;;
46
46
--master-conn) shift ; OPT_MASTERCONN=" ${1} " ; shift ; ;;
47
- --channel) shift ; OPT_CHANNEL=" ${1} " ; shift ; ;;
47
+ --channel) shift ; OPT_CHANNEL=" ${1} " ; shift ; ;;
48
48
--unconfigured) shift ; OPT_REPLNOTSET=1; ;;
49
49
--ensure-sbm) shift ; OPT_ENSURE_SBM=1; ;;
50
50
--version) grep -A2 ' ^=head1 VERSION' " $0 " | tail -n1; exit 0 ;;
@@ -91,6 +91,9 @@ main() {
91
91
# Check for SQL thread errors
92
92
LAST_SLAVE_ERRNO=$( awk ' /Last_SQL_Errno/{print $2}' " ${TEMP_SLAVEDATA} " )
93
93
94
+ # Prevent Negative value due to NTP
95
+ # Keep the highest value between 0 and level
96
+ LEVEL=$( [ " ${LEVEL:- 0} " -le " 0" ] && echo 0 || echo $LEVEL )
94
97
# Build the common perf data output for graph trending
95
98
PERFDATA=" replication_delay=${LEVEL:- 0} ;${OPT_WARN} ;${OPT_CRIT} ;0;"
96
99
@@ -150,7 +153,7 @@ get_slave_status() {
150
153
# MariaDB multi-source replication
151
154
mysql_exec " SHOW SLAVE '${OPT_MASTERCONN} ' STATUS\G" > " ${TEMP_SLAVEDATA} "
152
155
elif [ " ${OPT_CHANNEL} " ]; then
153
- mysql_exec " SHOW SLAVE STATUS FOR CHANNEL '${OPT_CHANNEL} '\G" > " ${TEMP_SLAVEDATA} "
156
+ mysql_exec " SHOW SLAVE STATUS FOR CHANNEL '${OPT_CHANNEL} '\G" > " ${TEMP_SLAVEDATA} "
154
157
else
155
158
# Leverage lock-free SHOW SLAVE STATUS if available
156
159
mysql_exec " SHOW SLAVE STATUS NONBLOCKING\G" > " ${TEMP_SLAVEDATA} " 2> /dev/null ||
0 commit comments