Module: check_mk
Branch: master
Commit: cb0dd6a06f0effd3aba0c65013067c1589debf4e
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=cb0dd6a06f0eff…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Mon Jan 25 15:45:33 2016 +0100
#2973 FIX showing subfolder info in WATO if there are more than four groups
---
.werks/2973 | 9 +++++++++
ChangeLog | 1 +
web/htdocs/wato.py | 4 ++--
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/.werks/2973 b/.werks/2973
new file mode 100644
index 0000000..a8ad5b7
--- /dev/null
+++ b/.werks/2973
@@ -0,0 +1,9 @@
+Title: showing subfolder info in WATO if there are more than four groups
+Level: 1
+Component: wato
+Compatible: compat
+Version: 1.2.7i4
+Date: 1453732849
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 147db2d..7b49a8c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -288,6 +288,7 @@
* 2905 FIX: Check plugins: Non existant man pages now result in helpful error messages
* 2943 FIX: Preventing issues with password completion of browsers on user and profile edit pages
* 2831 FIX: Removing a previously set custom attribute for a contact did not work as intented...
+ * 2973 FIX: showing subfolder info in WATO if there are more than four groups
Notifications:
* 2811 Mail notifications: Now able to add Host/Service Notes Url...
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 3f3d552..504aa60 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -604,8 +604,8 @@ def show_subfolder_infos(subfolder):
cgalias = groups.get(pg, {'alias': pg})['alias']
html.icon(_("Contactgroups that have permission on this folder"), "contactgroups")
html.write(' %s<br>' % cgalias)
- if num > 1 and len(perm_groups) > 4:
- html.write(_('<i>%d more contact groups</i><br>') % (len(perm_groups) - num - 1))
+ if num > 1 and len(permitted_groups) > 4:
+ html.write(_('<i>%d more contact groups</i><br>') % (len(permitted_groups) - num - 1))
break
num_hosts = subfolder.num_hosts_recursively()
Module: check_mk
Branch: master
Commit: 9aa0ced982695f98350fcae1dbac45738872f4ad
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9aa0ced982695f…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Jan 25 15:02:51 2016 +0100
lnx_if: Short refactoring for slightly better readability
---
checks/lnx_if | 71 ++++++++++++++++++++++++++++++---------------------------
1 file changed, 37 insertions(+), 34 deletions(-)
diff --git a/checks/lnx_if b/checks/lnx_if
index 7f75e19..21c5df1 100644
--- a/checks/lnx_if
+++ b/checks/lnx_if
@@ -58,19 +58,22 @@ check_includes['lnx_if'] = [ "if.include" ]
linux_nic_check = "lnx_if"
-def if_lnx_convert_to_if64(info):
+def if_lnx_extract_nic_info(info):
nic_info = {}
current_nic = None
index = 0
lines = iter(info)
- try:
- iplink_stats = {}
- while True:
+ iplink_stats = {}
+ while True:
+ try:
line = lines.next()
+ except StopIteration:
+ break
- # This extra info from 'ip link' is used as fallback in case ethtool is missing
- if line[0].startswith("[start_iplink]"):
- iplink_stats = {}
+ # This extra info from 'ip link' is used as fallback in case ethtool is missing
+ if line[0].startswith("[start_iplink]"):
+ iplink_stats = {}
+ try:
while True:
line = lines.next()
if line[0].startswith("[end_iplink]"):
@@ -85,36 +88,36 @@ def if_lnx_convert_to_if64(info):
iplink_stats[nic_name].update(dict(zip(status_info[3::2], status_info[4::2])))
except: # In case of parse errors we simply ignore these lines
pass
+ except StopIteration:
+ break
+
+ # Be careful! On clustered hosts we have more than one perf-counters section
+ # and ethtool section. This needs to be handled. Sadly we have no section
+ # headers. Try to detect it by data format.
+ if line[0].startswith('['):
+ current_nic = line[0][1:-1]
+ index += 1
+ nic_info[current_nic]['index'] = index
+ # The iplink_stats are only used within the perf-counters
+ # The (optional) ethtool section invalidates this info, otherwise it would
+ # be incorrectly reused in a followup section of another cluster node
+ # When the ethtool section is missing the data is also reset by the next [start_iplink]
+ iplink_stats = {}
+ elif len(line) == 2 and len(line[1].split()) >= 16:
+ # This looks like a perf-counter line
+ nic = line[0]
+ nic_info[nic] = { "counters": map(int, line[1].split()) }
+ if nic in iplink_stats:
+ nic_info[nic]['iplink_stats'] = iplink_stats[nic]
+ else:
+ # ethtool data line
+ nic_info[current_nic][line[0].strip()] = ":".join(line[1:]).strip()
- # Be careful! On clustered hosts we have more than one perf-counters section
- # and ethtool section. This needs to be handled. Sadly we have no section
- # headers. Try to detect it by data format.
- if line[0].startswith('['):
- current_nic = line[0][1:-1]
- index += 1
- nic_info[current_nic]['index'] = index
- # The iplink_stats are only used within the perf-counters
- # The (optional) ethtool section invalidates this info, otherwise it would
- # be incorrectly reused in a followup section of another cluster node
- # When the ethtool section is missing the data is also reset by the next [start_iplink]
- iplink_stats = {}
- elif len(line) == 2 and len(line[1].split()) >= 16:
- # This looks like a perf-counter line
- nic = line[0]
- nic_info[nic] = { "counters": map(int, line[1].split()) }
- if nic in iplink_stats:
- nic_info[nic]['iplink_stats'] = iplink_stats[nic]
- else:
- # ethtool data line
- nic_info[current_nic][line[0].strip()] = ":".join(line[1:]).strip()
+ return nic_info
- except StopIteration:
- pass
- # if index is 0 we either have found no nics or no information
- # from ethtool is present. In the latter case we continue and
- # just monitor the performance. We set the state to 'unknown'
- # in that case.
+def if_lnx_convert_to_if64(info):
+ nic_info = if_lnx_extract_nic_info(info)
if_table = []
index = 0