Module: check_mk
Branch: master
Commit: f2edeb354c743bdd9fac89e3ece867bd5ff535cb
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f2edeb354c743b…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Dec 16 16:40:45 2013 +0100
FIX mysql_capacity: Did use wrong calculated warn / crit thresholds
The warn / crit values are given as MB, but the check did not use them
as MB values. The thresholds were always applied wrong.
---
.werks/363 | 11 +++++++++++
ChangeLog | 1 +
checks/mysql_capacity | 13 ++++++-------
3 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/.werks/363 b/.werks/363
new file mode 100644
index 0000000..d0f5994
--- /dev/null
+++ b/.werks/363
@@ -0,0 +1,11 @@
+Title: mysql_capacity: Did use wrong calculated warn / crit thresholds
+Level: 1
+Component: checks
+Class: fix
+State: unknown
+Version: 1.2.5i1
+Date: 1387208376
+Targetversion: future
+
+The warn / crit values are given as MB, but the check did not use them
+as MB values. The thresholds were always applied wrong.
diff --git a/ChangeLog b/ChangeLog
index c5fa6b4..8366da0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -31,6 +31,7 @@
* 0360 FIX: multipath: Inventory handles non loaded kernel module now...
* 0339 FIX: blade_bays blade_blades blade_blowers blade_health blade_mediatray
blade_powerfan blade_powermod: fix scan function...
* 0340 FIX: blade_health: fix check, it was totally broken...
+ * 0363 FIX: mysql_capacity: Did use wrong calculated warn / crit thresholds...
Multisite:
* 0302 FIX: Fixed highlight of choosen elements in foldertee/views snapin in
Chrome/IE
diff --git a/checks/mysql_capacity b/checks/mysql_capacity
index a2be13d..b0d6472 100644
--- a/checks/mysql_capacity
+++ b/checks/mysql_capacity
@@ -40,6 +40,7 @@ def inventory_mysql_size(info):
return inventory
def check_mysql_size(item, params, info):
+ # size and avail are given as bytes
for dbname, size, avail in info:
if item == dbname:
size = int(size)
@@ -49,13 +50,13 @@ def check_mysql_size(item, params, info):
warn, crit = params # in MB
warn_b = warn * 1048576
crit_b = crit * 1048576
- perfdata = [("size", size, warn, crit)]
- if size > crit:
+ perfdata = [("size", size, warn_b, crit_b)]
+ if size > crit_b:
state = 2
- infotext += " (critical at %s)" %
get_bytes_human_readable(crit)
- elif size > warn:
+ infotext += " (critical at %s)" %
get_bytes_human_readable(crit_b)
+ elif size > warn_b:
state = 1
- infotext += " (warning at %s)" %
get_bytes_human_readable(crit)
+ infotext += " (warning at %s)" %
get_bytes_human_readable(crit_b)
else:
state = 0
perfdata = [("size", size)]
@@ -69,6 +70,4 @@ check_info['mysql_capacity'] = {
"service_description" : "MySQL DB %s Size",
"has_perfdata" : True,
"group" : "dbsize",
-# "default_levels_variable" : "filesystem_default_levels",
-# "includes" : [ "dbsize.include" ],
}