Module: check_mk
Branch: master
Commit: afcc661063ec51e8ea7f282504dbdd33b94e251b
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=afcc661063ec51…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Aug 28 15:38:55 2015 +0200
In previous versions Check_MK raised exceptions when a view is using sorters
or painters that do not exist anymore. This could easily happen for the painters
and sorters created dynamically for each tag group.
Check_MK is now silently skipping these sorters and painters to prevent the
exception and make use of such views possible again. You can then remove
those sorters / painters using the view editor.
Conflicts:
web/htdocs/views.py
---
.werks/2549 | 16 ++++++++++++++++
ChangeLog | 1 +
web/htdocs/views.py | 9 ++++++---
3 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/.werks/2549 b/.werks/2549
new file mode 100644
index 0000000..3387011
--- /dev/null
+++ b/.werks/2549
@@ -0,0 +1,16 @@
+Title: Silently ignore not existing painters and sorters in views
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i3
+Date: 1440768969
+
+In previous versions Check_MK raised exceptions when a view is using sorters
+or painters that do not exist anymore. This could easily happen for the painters
+and sorters created dynamically for each tag group.
+
+Check_MK is now silently skipping these sorters and painters to prevent the
+exception and make use of such views possible again. You can then remove
+those sorters / painters using the view editor.
diff --git a/ChangeLog b/ChangeLog
index f4c5847..b9c9ed3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -179,6 +179,7 @@
* 2510 FIX: Fixed sidebar frame scaling in chrome when using browser zoom
* 2544 FIX: Fixed links to availability timeline using the context buttons
* 2548 FIX: Fixed exceptions in different places in case of user errors...
+ * 2549 FIX: Silently ignore not existing painters and sorters in views...
WATO:
* 2365 Removed old deprecated notification global options for plain emails...
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index 98802ed..a0a10bb 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -1006,15 +1006,18 @@ def show_view(view, show_heading = False, show_buttons = True,
# Sorting - use view sorters and URL supplied sorters
if not only_count:
sorter_list = html.has_var('sort') and parse_url_sorters(html.var('sort')) or view["sorters"]
- sorters = [ (multisite_sorters[s[0]],) + s[1:] for s in sorter_list ]
+ sorters = [ (multisite_sorters[s[0]],) + s[1:] for s in sorter_list
+ if s[0] in multisite_sorters ]
else:
sorters = []
# Prepare grouping information
- group_painters = [ (multisite_painters[e[0]],) + e[1:] for e in view["group_painters"] ]
+ group_painters = [ (multisite_painters[e[0]],) + e[1:] for e in view["group_painters"]
+ if e[0] in multisite_painters ]
# Prepare columns to paint
- painters = [ (multisite_painters[e[0]],) + e[1:] for e in view["painters"] if e[0] in multisite_painters ]
+ painters = [ (multisite_painters[e[0]],) + e[1:] for e in view["painters"]
+ if e[0] in multisite_painters ]
# Now compute the list of all columns we need to query via Livestatus.
# Those are: (1) columns used by the sorters in use, (2) columns use by
Module: check_mk
Branch: master
Commit: a528220e4171af099b96314293265828af558b4a
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a528220e4171af…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Aug 28 15:21:47 2015 +0200
In different places, e.g. during login errors it could happen that
exceptions like this occur:
AttributeError: MKUserError instance has no attribute 'message'
It seems that this occurance depends on the used Python version.
Internal note: Never use e.message to get the text of an exception.
Better directly put the exception into a string format: "%s" % e
Conflicts:
ChangeLog
web/htdocs/forms.py
---
.werks/2548 | 18 ++++++++++++++++++
ChangeLog | 1 +
web/htdocs/dashboard.py | 10 +++++-----
web/htdocs/forms.py | 12 ++++++------
web/htdocs/htmllib.py | 7 ++++++-
web/htdocs/login.py | 4 ++--
web/htdocs/mobile.py | 4 ++--
web/htdocs/valuespec.py | 2 +-
web/htdocs/views.py | 8 ++++----
web/htdocs/visuals.py | 12 ++++++------
web/htdocs/wato.py | 10 +++++-----
web/plugins/views/availability.py | 4 ++--
12 files changed, 58 insertions(+), 34 deletions(-)
Diff: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=a528220e41…
Module: check_mk
Branch: master
Commit: 5d759f26bad0521ad4bdbdda2e462ece3591ee8a
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5d759f26bad052…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Fri Aug 28 09:35:46 2015 +0200
fixed typo
---
web/htdocs/wato.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 791e393..658c028 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -15480,7 +15480,7 @@ def mode_edit_rule(phase, new = False):
# Host tags
forms.section(_("Host tags"))
render_condition_editor(tag_specs)
- html.help(_("The rule will only be applied to hosts fullfilling all of "
+ html.help(_("The rule will only be applied to hosts fullfilling all "
"of the host tag conditions listed here, even if they appear "
"in the list of explicit host names."))
Module: check_mk
Branch: master
Commit: 152f8b0a5e0acc918ae9bf24d5adcc180b4cc302
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=152f8b0a5e0acc…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Aug 27 15:39:47 2015 +0200
The mysql checks support monitoring multiple instances per host since some versions. There was a bug when
only a single instance is running on a host where an empty instance id is reported by the agent. The checks
were discoverying wrong service names and resulting in exceptions during checking.
Conflicts:
ChangeLog
checks/mysql_slave
---
.werks/2547 | 12 ++++++++++++
ChangeLog | 1 +
checks/mysql | 3 +++
checks/mysql_capacity | 10 ++++++++++
checks/mysql_ping | 3 +++
checks/mysql_slave | 3 +++
6 files changed, 32 insertions(+)
diff --git a/.werks/2547 b/.werks/2547
new file mode 100644
index 0000000..97a1488
--- /dev/null
+++ b/.werks/2547
@@ -0,0 +1,12 @@
+Title: mysql mysql_capacity mysql_ping mysql_slave: Fixed broken service discovery when instance id is empty
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i3
+Date: 1440682635
+
+The mysql checks support monitoring multiple instances per host since some versions. There was a bug when
+only a single instance is running on a host where an empty instance id is reported by the agent. The checks
+were discoverying wrong service names and resulting in exceptions during checking.
diff --git a/ChangeLog b/ChangeLog
index 55443fe..32a70b6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -145,6 +145,7 @@
* 1287 FIX: akcp_temperature: Fixed interpretation of device levels...
* 2545 FIX: akcp_daisy_temp: sensorProbe8-X20 not trying to discover services on these devices
* 2546 FIX: brocade_mlx_power: Only discover power supplies in state normal/failure, skip other states...
+ * 2547 FIX: mysql mysql_capacity mysql_ping mysql_slave: Fixed broken service discovery when instance id is empty...
Multisite:
* 2385 SEC: Fixed possible reflected XSS on all GUI pages where users can produce unhandled exceptions...
diff --git a/checks/mysql b/checks/mysql
index dd670cb..11ed3f2 100644
--- a/checks/mysql
+++ b/checks/mysql
@@ -53,6 +53,7 @@ def inventory_mysql(parsed):
if len(values.keys()) > 200: # should be at least 321 line
return [(instance, {})]
+# FIXME: Crapy copy n paste! Consolidate with other mysql_* parse functions
def parse_mysql(info):
def parse_line(line):
if len(line) == 2:
@@ -71,6 +72,8 @@ def parse_mysql(info):
for line in info:
if line[0].startswith("[["):
instance = line[0][2:-2]
+ if instance == "":
+ instance = "mysql"
parsed[instance] = {}
elif instance:
varname, value = parse_line(line)
diff --git a/checks/mysql_capacity b/checks/mysql_capacity
index ca6d358..3f42989 100644
--- a/checks/mysql_capacity
+++ b/checks/mysql_capacity
@@ -32,13 +32,23 @@
# performance_schema 0 0
# wa-confluence 15499264 13805551616
+# new: can have instance headers (can be empty), e.g.:
+# <<<mysql_capacity>>>
+# [[]]
+# information_schema 147456 0
+# mysql 665902 292
+# performance_schema 0 0
+# test 409255936 54525952
+# FIXME: Crapy copy n paste! Consolidate with other mysql_* parse functions
def parse_mysql_capacity(info):
parsed = {}
instance = False
for line in info:
if line[0].startswith("[["):
instance = line[0][2:-2]
+ if instance == "":
+ instance = "mysql"
parsed[instance] = []
elif instance:
parsed[instance].append(line)
diff --git a/checks/mysql_ping b/checks/mysql_ping
index c116fbd..c4033b5 100644
--- a/checks/mysql_ping
+++ b/checks/mysql_ping
@@ -35,12 +35,15 @@
# "error: 'Access denied for user 'root'@'localhost' (using password: NO)'" ]
# }
+# FIXME: Crapy copy n paste! Consolidate with other mysql_* parse functions
def parse_mysql_ping(info):
parsed = {}
instance = False
for line in info:
if line[0].startswith("[["):
instance = line[0][2:-2]
+ if instance == "":
+ instance = "mysql"
parsed[instance] = []
elif instance:
parsed[instance].append(" ".join(line))
diff --git a/checks/mysql_slave b/checks/mysql_slave
index 64edea4..f07b3c8 100644
--- a/checks/mysql_slave
+++ b/checks/mysql_slave
@@ -24,6 +24,7 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
+# FIXME: Crapy copy n paste! Consolidate with other mysql_* parse functions
def parse_mysql_slave(info):
def parse_line(l):
if ':' in l[0]:
@@ -49,6 +50,8 @@ def parse_mysql_slave(info):
for line in info:
if line[0].startswith("[["):
instance = line[0][2:-2]
+ if instance == "":
+ instance = "mysql"
parsed[instance] = {}
elif instance:
key, value = parse_line(line)
Module: check_mk
Branch: master
Commit: 902cf619a38f160c55dbbbb83ff9e1ac18bf6906
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=902cf619a38f16…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Aug 27 13:06:21 2015 +0000
#2546 FIX brocade_mlx_power: Only discover power supplies in state normal/failure, skip other states
When power supplies are removed from a device, they remain in the SNMP data with state "other".
Check_MK was still discovering those power supplies but should not.
---
.werks/2546 | 11 +++++++++++
ChangeLog | 1 +
checks/brocade_mlx_power | 3 ++-
3 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/.werks/2546 b/.werks/2546
new file mode 100644
index 0000000..e2411d4
--- /dev/null
+++ b/.werks/2546
@@ -0,0 +1,11 @@
+Title: brocade_mlx_power: Only discover power supplies in state normal/failure, skip other states
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i3
+Date: 1440680714
+
+When power supplies are removed from a device, they remain in the SNMP data with state "other".
+Check_MK was still discovering those power supplies but should not.
diff --git a/ChangeLog b/ChangeLog
index 496d6a2..55443fe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -144,6 +144,7 @@
* 2522 FIX: check_mk_agent.aix: now handles different output formats of the uptime function
* 1287 FIX: akcp_temperature: Fixed interpretation of device levels...
* 2545 FIX: akcp_daisy_temp: sensorProbe8-X20 not trying to discover services on these devices
+ * 2546 FIX: brocade_mlx_power: Only discover power supplies in state normal/failure, skip other states...
Multisite:
* 2385 SEC: Fixed possible reflected XSS on all GUI pages where users can produce unhandled exceptions...
diff --git a/checks/brocade_mlx_power b/checks/brocade_mlx_power
index 50fa03b..6bc62fb 100644
--- a/checks/brocade_mlx_power
+++ b/checks/brocade_mlx_power
@@ -33,7 +33,8 @@ def brocade_mlx_power_combine_item(id, descr):
def inventory_brocade_mlx_power(info):
inventory = []
for power_id, power_descr, power_state in info:
- inventory.append( (brocade_mlx_power_combine_item(power_id, power_descr), None) )
+ if power_state != "1":
+ inventory.append( (brocade_mlx_power_combine_item(power_id, power_descr), None) )
return inventory
def check_brocade_mlx_power(item, _no_params, info):
Module: check_mk
Branch: master
Commit: 9bc41187eb92e7e5b2223310a92700b934c9a31e
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9bc41187eb92e7…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Aug 27 11:37:56 2015 +0200
Implemented check validation to find broken check groups
---
checks/cmctc_lcp | 2 +-
checks/esx_vsphere_counters | 2 +-
checks/icom_repeater | 2 +-
checks/websphere_mq_queues | 2 +-
modules/check_mk.py | 32 ++++++++++++++++++++++++++++++++
5 files changed, 36 insertions(+), 4 deletions(-)
diff --git a/checks/cmctc_lcp b/checks/cmctc_lcp
index b0383bf..28c1b94 100644
--- a/checks/cmctc_lcp
+++ b/checks/cmctc_lcp
@@ -130,7 +130,7 @@ for _s, _i in cmctc_lcp_sensortypes.items():
"check_function" : (lambda st: lambda item,params,info: check_cmctc_lcp(item, params, info, st))(_s),
"inventory_function" : (lambda st: lambda info: inventory_cmctc_lcp(info, st))(_s),
"has_perfdata" : True,
- "service_description" : _i[1],
+ "service_description" : _i[1] + " %s",
}
# Set WATO check group for temperature checks
diff --git a/checks/esx_vsphere_counters b/checks/esx_vsphere_counters
index dcc3f85..6cf392e 100644
--- a/checks/esx_vsphere_counters
+++ b/checks/esx_vsphere_counters
@@ -100,7 +100,7 @@ def check_esx_vsphere_counters_diskio(item, params, parsed):
check_info['esx_vsphere_counters.diskio'] = {
'inventory_function' : inventory_esx_vsphere_counters_diskio,
'check_function' : check_esx_vsphere_counters_diskio,
- 'service_description' : 'Disk IO',
+ 'service_description' : 'Disk IO %s',
'has_perfdata' : True,
'group' : 'diskstat',
'includes' : [ "diskstat.include" ],
diff --git a/checks/icom_repeater b/checks/icom_repeater
index f0e0615..baa7b3c 100644
--- a/checks/icom_repeater
+++ b/checks/icom_repeater
@@ -231,7 +231,7 @@ check_info["icom_repeater.temp"] = {
"inventory_function" : inventory_icom_repeater_temp,
"default_levels_variable" : "icom_repeater_temp_default_levels",
"check_function" : check_icom_repeater_temp,
- "service_description" : "Temperature",
+ "service_description" : "Temperature %s",
"has_perfdata" : True,
"group" : "temperature",
"includes" : [ "temperature.include" ],
diff --git a/checks/websphere_mq_queues b/checks/websphere_mq_queues
index c1a4fa2..4ef4002 100644
--- a/checks/websphere_mq_queues
+++ b/checks/websphere_mq_queues
@@ -70,7 +70,7 @@ check_info["websphere_mq_queues"] = {
"group" : "websphere_mq",
"check_function" : check_websphere_mq_queues,
"inventory_function" : inventory_websphere_mq_queues,
- "service_description" : "MQ Queue",
+ "service_description" : "MQ Queue %s",
"has_perfdata" : True,
}
diff --git a/modules/check_mk.py b/modules/check_mk.py
index be1f312..829fc4b 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -368,6 +368,38 @@ def load_checks():
# Now convert check_info to new format.
convert_check_info()
+ verify_checkgroups()
+
+
+# This function validates the checks which are members of checkgroups to have either
+# all or none an item. Mixed checkgroups lead to strange exceptions when processing
+# the check parameters. So it is much better to catch these errors in a central place
+# with a clear error message.
+def verify_checkgroups():
+ groups = {}
+ for check_type, check in check_info.items():
+ group_name = check["group"]
+ if group_name:
+ groups.setdefault(group_name, [])
+ groups[group_name].append((check_type, check))
+
+ for group_name, checks in groups.items():
+ with_item, without_item = [], []
+ for check_type, check in checks:
+ # Trying to detect whether or not the check has an item. But this mechanism is not
+ # 100% reliable since Check_MK appends an item to the service_description when "%s"
+ # is not in the checks service_description template.
+ # Maybe we need to define a new rule which enforces the developer to use the %s in
+ # the service_description. At least for grouped checks.
+ if "%s" in check["service_description"]:
+ with_item.append(check_type)
+ else:
+ without_item.append(check_type)
+
+ if with_item and without_item:
+ raise MKGeneralException("Checkgroup %s has checks with and without item! At least one of "
+ "the checks in this group needs to be changed (With item: %s, "
+ "Without item: %s)" % (group_name, ", ".join(with_item), ", ".join(without_item)))
#.