Module: check_mk
Branch: master
Commit: 38a13253fd1681272dd77d08a249a4d946e64677
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=38a13253fd1681…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Dec 3 12:36:46 2014 +0100
#1604 FIX mysql_slave: Dealing with situation where connection with master is lost
---
.werks/1604 | 9 +++++++++
ChangeLog | 1 +
checks/mysql_slave | 22 +++++++++++++---------
3 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/.werks/1604 b/.werks/1604
new file mode 100644
index 0000000..f62db71
--- /dev/null
+++ b/.werks/1604
@@ -0,0 +1,9 @@
+Title: mysql_slave: Dealing with situation where connection with master is lost
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.5i7
+Date: 1417606584
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 78d6d59..45a6025 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -59,6 +59,7 @@
* 1591 FIX: netapp_volumes: The state mixed_raid_type is now treated as non-critical
state
* 1602 FIX: dell_om_esmlog: Fixed typo in plugin output
* 1603 FIX: ad_replication: fixed typo in plugin output
+ * 1604 FIX: mysql_slave: Dealing with situation where connection with master is lost
Multisite:
* 1508 Allow input of plugin output and perfdata when faking check results...
diff --git a/checks/mysql_slave b/checks/mysql_slave
index 33cc4d4..7631081 100644
--- a/checks/mysql_slave
+++ b/checks/mysql_slave
@@ -65,16 +65,20 @@ def check_mysql_slave(_unused, params, info):
output.append('Slave-SQL: running')
# Makes only sense to monitor the age when the SQL slave is running
- out = 'Time behind Master: %s' %
get_age_human_readable(data['Seconds_Behind_Master'])
- warn, crit = params.get('seconds_behind_master', (None, None))
- if crit != None and data['Seconds_Behind_Master'] > crit:
+ if data['Seconds_Behind_Master'] == 'NULL':
+ output.append('Time behind master: NULL (Lost connection?)(!!)')
state = 2
- out += '(!!)'
- elif warn != None and data['Seconds_Behind_Master'] > warn:
- state = max(state, 1)
- out += '(!)'
- output.append(out)
- perfdata.append(('seconds_behind_master',
data['Seconds_Behind_Master'], warn, crit))
+ else:
+ out = 'Time behind Master: %s' %
get_age_human_readable(data['Seconds_Behind_Master'])
+ warn, crit = params.get('seconds_behind_master', (None, None))
+ if crit != None and data['Seconds_Behind_Master'] > crit:
+ state = 2
+ out += '(!!)'
+ elif warn != None and data['Seconds_Behind_Master'] > warn:
+ state = max(state, 1)
+ out += '(!)'
+ output.append(out)
+ perfdata.append(('seconds_behind_master',
data['Seconds_Behind_Master'], warn, crit))
else:
output.append('Slave-SQL: not running(!!)')
state = 2