Module: check_mk
Branch: master
Commit: a1c629ea05362efcccf68100be299fc5dd4f47c8
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a1c629ea05362e…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Jul 10 13:52:37 2014 +0200
FIX mysql_slave: Only monitor the age of the slave when it is running
---
.werks/1054 | 8 ++++++++
ChangeLog | 1 +
checks/mysql_slave | 23 ++++++++++++-----------
3 files changed, 21 insertions(+), 11 deletions(-)
diff --git a/.werks/1054 b/.werks/1054
new file mode 100644
index 0000000..0390c42
--- /dev/null
+++ b/.werks/1054
@@ -0,0 +1,8 @@
+Title: mysql_slave: Only monitor the age of the slave when it is running
+Level: 1
+Component: checks
+Version: 1.2.5i5
+Date: 1404993134
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 6231ef2..e2b59e4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -37,6 +37,7 @@
* 1072 FIX: printer_supply: fix colors of Perf-O-Meter on HP OfficeJet...
* 0950 FIX: check_mkevents: now able to resolve the hostname of the remote hosts...
* 0177 FIX: esx_vsphere_hostsystem.multipath: Fixed return state in case of paths in
standby...
+ * 1054 FIX: mysql_slave: Only monitor the age of the slave when it is running
Multisite:
* 1013 Sort host names naturally, e.g. foobar11 comes after foobar2...
diff --git a/checks/mysql_slave b/checks/mysql_slave
index cf413d6..657cfa2 100644
--- a/checks/mysql_slave
+++ b/checks/mysql_slave
@@ -62,20 +62,21 @@ def check_mysql_slave(_unused, params, info):
if data['Slave_SQL_Running']:
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:
+ state = 2
+ out += '(!!)'
+ elif warn != None and data['Seconds_Behind_Master'] > warn:
+ state = 1
+ out += '(!)'
+ output.append(out)
+ perfdata.append(('seconds_behind_master',
data['Seconds_Behind_Master'], warn, crit))
else:
output.append('Slave-SQL: not 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:
- state = 2
- out += '(!!)'
- elif warn != None and data['Seconds_Behind_Master'] > warn:
- state = 1
- out += '(!)'
- output.append(out)
- perfdata.append(('seconds_behind_master',
data['Seconds_Behind_Master'], warn, crit))
-
return state, ', '.join(output), perfdata
check_info['mysql_slave'] = {