diff options
author | Christian Pointner <equinox@spreadspace.org> | 2015-07-28 01:04:22 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2015-07-28 01:04:22 (GMT) |
commit | 52ed2e0cccc51ae0656fae0f8802c80d6c2a527a (patch) | |
tree | 8cf6d1357b899ab2099b74cf7f5caea8e9785d2f /checks | |
parent | aac38b5a8f1bf5eb9888b79bf7d8e599c271e99b (diff) |
renamed agent plugin and added check for mysql_repl
Diffstat (limited to 'checks')
-rw-r--r-- | checks/mysql_repl | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/checks/mysql_repl b/checks/mysql_repl new file mode 100644 index 0000000..372eeb5 --- /dev/null +++ b/checks/mysql_repl @@ -0,0 +1,45 @@ +OK = 0 +WARN = 1 +CRIT = 2 +UNKNOWN = 3 + +def extract_values(info): + values = {} + for line in info: + key = line[0].replace(':','') + value = " ".join(line[1:]) + values[key] = value + + return values + +def inventory_mysql_repl_status(info): + inventory = [] + try: + values = extract_values(info) + if 'Slave_IO_Running' in values: + inventory.append(('Slave_IO_Running', ['IO'])) + if 'Slave_SQL_Running' in values: + inventory.append(('Slave_SQL_Running', ['SQL'])) + return inventory + except Exception, e: + return [] + +def check_mysql_repl_status(item, params, info): + try: + values = extract_values(info) + if item in values: + if values[item] == 'Yes': + return (OK, 'Slave %s is running' % params[0]) + + return (CRIT, 'Slave %s is not(!!) running' % params[0]) + + except Exception, e: + return (UNKNOWN, "mysql_repl check failed: %", e.message) + + +check_info["mysql_repl"] = { + 'check_function': check_mysql_repl_status, + 'inventory_function': inventory_mysql_repl_status, + 'service_description': 'mySQL Replication CLient Status', +} + |