Module: check_mk
Branch: master
Commit: 4cc9656485e1a6958027f41e484ebd7076772a29
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4cc9656485e1a6…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Feb 6 15:56:59 2015 +0100
Fixed different things in visual editing code for reporting
---
web/htdocs/dashboard.py | 6 +-----
web/htdocs/visuals.py | 20 ++++++++++++--------
2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/web/htdocs/dashboard.py b/web/htdocs/dashboard.py
index 1047389..3a99796 100644
--- a/web/htdocs/dashboard.py
+++ b/web/htdocs/dashboard.py
@@ -941,11 +941,7 @@ def page_edit_dashlet():
totext = dashlet_type['title'],
title = _('Dashlet Type'),
)),
- ('single_infos', FixedValue(single_infos,
- title = _('Show information of single'),
- totext = single_infos and ', '.join(single_infos) \
- or _('Not restricted to showing a specific object.'),
- )),
+ visuals.single_infos_spec(single_infos),
('background', Checkbox(
title = _('Colored Background'),
label = _('Render background'),
diff --git a/web/htdocs/visuals.py b/web/htdocs/visuals.py
index 8fca96b..e58c2ef 100644
--- a/web/htdocs/visuals.py
+++ b/web/htdocs/visuals.py
@@ -601,11 +601,7 @@ def page_edit_visual(what, all_visuals, custom_field_handler = None,
render = 'form',
optional_keys = None,
elements = [
- ('single_infos', FixedValue(single_infos,
- title = _('Specific objects'),
- totext = single_infos and ', '.join(single_infos) \
- or _('Showing information of multiple objects.'),
- )),
+ single_infos_spec(single_infos),
('name', TextAscii(
title = _('Unique ID'),
help = _("The ID will be used in URLs that point to a view, e.g. "
@@ -1089,14 +1085,15 @@ def SingleInfoSelection(info_keys, **args):
# Converts a context from the form { filtername : { ... } } into
# the for { infoname : { filtername : { } } for editing.
-def pack_context_for_editing(context):
+def pack_context_for_editing(visual, info_handler):
# We need to pack all variables into dicts with the name of the
# info. Since we have no mapping from info the the filter variable,
# we pack into every info every filter. The dict valuespec will
# pick out what it needs. Yurks.
packed_context = {}
- for info_name in infos.keys():
- packed_context[info_name] = context
+ info_keys = info_handler and info_handler(visual) or infos.keys()
+ for info_name in info_keys:
+ packed_context[info_name] = visual.get('context', {})
return packed_context
def unpack_context_after_editing(packed_context):
@@ -1119,6 +1116,13 @@ def unpack_context_after_editing(packed_context):
# | |
# '----------------------------------------------------------------------'
+def single_infos_spec(single_infos):
+ return ('single_infos', FixedValue(single_infos,
+ title = _('Show information of single'),
+ totext = single_infos and ', '.join(single_infos) \
+ or _('Not restricted to showing a specific object.'),
+ ))
+
def verify_single_contexts(what, visual):
for k, v in get_singlecontext_html_vars(visual).items():
if v == None:
Module: check_mk
Branch: master
Commit: bd618100b69fa6e0f8fff04d020bc59755c17f2b
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=bd618100b69fa6…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Fri Feb 6 12:46:41 2015 +0100
ibm_svc_portsas: Check checks agains the portstate on discovery
---
checkman/ibm_svc_portsas | 2 +-
checks/ibm_svc_portsas | 8 +++++---
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/checkman/ibm_svc_portsas b/checkman/ibm_svc_portsas
index ffca097..ff4e1d8 100644
--- a/checkman/ibm_svc_portsas
+++ b/checkman/ibm_svc_portsas
@@ -7,7 +7,7 @@ description:
Checks the status of SAS Ports in an IBM SVC / Storwize V3700 / V7000
device.
- Status {online} is {OK}, every other status is {CRIT}.
+ Every Status Change after Discovery results in a {CRIT} state.
Please note: You need the Special Agent agent_ibmsvc to retrieve the monitoring
data from the device. Your monitoring user must be able to SSH to the device
diff --git a/checks/ibm_svc_portsas b/checks/ibm_svc_portsas
index b4b1b70..e3fe838 100644
--- a/checks/ibm_svc_portsas
+++ b/checks/ibm_svc_portsas
@@ -28,9 +28,11 @@
def inventory_ibm_svc_portsas(info):
for line in info:
if len(line) in (10, 12) and line[6] != "offline_unconfigured":
- yield line[0], None
+ yield line[0], {'current_state' : line[6]}
-def check_ibm_svc_portsas(item, _no_params, info):
+def check_ibm_svc_portsas(item, params, info):
+ if not params:
+ params = { 'current_state' : 'offline' }
for line in info:
if len(line) in (10, 12) and line[0] == item:
sasport_status = line[6]
@@ -38,7 +40,7 @@ def check_ibm_svc_portsas(item, _no_params, info):
sasport_type = line[9]
infotext = "Status: %s" % sasport_status
- if sasport_status == "online":
+ if sasport_status == params['current_state']:
state = 0
else:
state = 2