summaryrefslogtreecommitdiff
path: root/checks/mysql_repl
diff options
context:
space:
mode:
Diffstat (limited to 'checks/mysql_repl')
-rw-r--r--checks/mysql_repl13
1 files changed, 11 insertions, 2 deletions
diff --git a/checks/mysql_repl b/checks/mysql_repl
index 372eeb5..a5aa0bf 100644
--- a/checks/mysql_repl
+++ b/checks/mysql_repl
@@ -24,14 +24,22 @@ def inventory_mysql_repl_status(info):
except Exception, e:
return []
+
+def str2float(str):
+ try:
+ return float(str)
+ except ValueError:
+ return 0.0
+
def check_mysql_repl_status(item, params, info):
try:
values = extract_values(info)
+ perfdata = [ ("Seconds_Behind_Master", str2float(values['Seconds_Behind_Master']), 5, 10, "", "") ]
if item in values:
if values[item] == 'Yes':
- return (OK, 'Slave %s is running' % params[0])
+ return (OK, 'Slave %s is running' % params[0], perfdata)
- return (CRIT, 'Slave %s is not(!!) running' % params[0])
+ return (CRIT, 'Slave %s is not(!!) running: %s' % (params[0], values['Last_%s_Error' % params[0]]), perfdata)
except Exception, e:
return (UNKNOWN, "mysql_repl check failed: %", e.message)
@@ -41,5 +49,6 @@ check_info["mysql_repl"] = {
'check_function': check_mysql_repl_status,
'inventory_function': inventory_mysql_repl_status,
'service_description': 'mySQL Replication CLient Status',
+ 'has_perfdata': True,
}