summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2015-07-28 02:43:51 (GMT)
committerChristian Pointner <equinox@helsinki.at>2015-07-28 02:43:51 (GMT)
commit2db3a2a6be414cfdb12fc63b81d9c07394cb379c (patch)
treec31733fbdc318658e5438678ead7b8efaeb853e3
parent52ed2e0cccc51ae0656fae0f8802c80d6c2a527a (diff)
added perfdata for 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,
}