Module: check_mk
Branch: master
Commit: a6434dbab9b4643daa66044641572a27c76d1dc0
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a6434dbab9b464…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Mar 3 13:58:18 2017 +0100
Updated bug entries #2462
Change-Id: I0736166b83de8e24ed154572074c0b2a79d205ce
---
.bugs/2462 | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/.bugs/2462 b/.bugs/2462
index 54dd441..1372250 100644
--- a/.bugs/2462
+++ b/.bugs/2462
@@ -9,3 +9,15 @@ When viewing an event of a host which the user is not permitted to see
while the user has "see all events permission", the user sees the
service states in the last column. The user can also add more columns
to the view to see all information about the host.
+
+----
+
+The EC tables are already capable of returning "empty" data for unrelated
+events. This needs to be handled equal in case a user has set "see all events"
+and is not permitted on a host.
+
+This should make the user see the event and prevent the user from seeing
+the monitoring data of that host.
+
+This needs to be filtered either in the core (then we need the AuthUser header and
+the info that the user has "see all" permission) or in web/plugins/views/mkeventd.py query_ec_table().
Module: check_mk
Branch: master
Commit: 3bedb9f0a5f9e883851f8f83706b289884eb8472
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3bedb9f0a5f9e8…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Mon Mar 6 08:19:59 2017 +0100
4483 cisco_vlans: New inventory plugin which collects vlan information of Cisco devices supporting CISCO-VLAN-MEMBERSHIP mib
Change-Id: I39886067f23eca5cfa540ca1ab0604b3adcd4e7e
---
.werks/4483 | 10 ++++
inventory/cisco_vlans | 124 +++++++++++++++++++++++++++++++++++++++++
web/plugins/views/inventory.py | 2 +
3 files changed, 136 insertions(+)
diff --git a/.werks/4483 b/.werks/4483
new file mode 100644
index 0000000..1bfb91a
--- /dev/null
+++ b/.werks/4483
@@ -0,0 +1,10 @@
+Title: cisco_vlans: New inventory plugin which collects vlan information of Cisco devices supporting CISCO-VLAN-MEMBERSHIP mib
+Level: 1
+Component: inv
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1488784681
+Class: feature
+
+
diff --git a/inventory/cisco_vlans b/inventory/cisco_vlans
new file mode 100644
index 0000000..d3e7641
--- /dev/null
+++ b/inventory/cisco_vlans
@@ -0,0 +1,124 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2016 mk(a)mathias-kettner.de |
+# +------------------------------------------------------------------+
+#
+# This file is part of Check_MK.
+# The official homepage is at http://mathias-kettner.de/check_mk.
+#
+# check_mk is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation in version 2. check_mk is distributed
+# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more de-
+# tails. You should have received a copy of the GNU General Public
+# License along with GNU Make; see the file COPYING. If not, write
+# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Boston, MA 02110-1301 USA.
+
+
+# 1.3.6.1.4.1.9.9.68.1.2.2.1.1 --> vmVlanType: static(1), dynamic(2), multiVlan(3)
+# 1.3.6.1.4.1.9.9.68.1.2.2.1.2 --> vmVlan: id of the vlan the port is asssigned to
+# if type = 1 or 2.
+# it's 0 if the port is not assigned to a vlan
+# 1.3.6.1.4.1.9.9.68.1.2.2.1.4 --> vmVlans: the vlans the port is assigned to
+# if the type = 3
+
+# "The VLAN(s) the port is assigned to when the
+# port's vmVlanType is set to multiVlan.
+# This object is not instantiated if not applicable.
+
+# The port is always assigned to one or more VLANs
+# and the object may not be set so that there are
+# no vlans assigned.
+
+# Each octet within the value of this object specifies a
+# set of eight VLANs, with the first octet specifying
+# VLAN id 1 through 8, the second octet specifying VLAN
+# ids 9 through 16, etc. Within each octet, the most
+# significant bit represents the lowest numbered
+# VLAN id, and the least significant bit represents the
+# highest numbered VLAN id. Thus, each VLAN of the
+# port is represented by a single bit within the
+# value of this object. If that bit has a value of
+# '1' then that VLAN is included in the set of
+# VLANs; the VLAN is not included if its bit has a
+# value of '0'."
+
+
+# This function compresses a list of vlans, eg [1,3,4,7,8,9,...,1024],
+# into a readable format: "1, 3-4, 7-1024" in case of multi-vlans
+def parse_multi_vlan(vlan_multi):
+
+ def concatenate_vlans(vlan, subinfo):
+ if vlan not in subinfo:
+ subinfo.append(vlan)
+ return "-".join(map(str, subinfo))
+
+ vlans = []
+ for k, hex in enumerate(vlan_multi):
+ for l, bit in enumerate(bin(ord(hex))[2:]):
+ if bit == '1':
+ vlans.append(k*8 + l+1)
+
+ infotexts = []
+ subinfo = vlans[:1]
+ last_vlan = vlans[0]
+
+ for vlan in vlans[1:]:
+ if vlan - last_vlan > 1:
+ infotexts.append(concatenate_vlans(last_vlan, subinfo))
+ subinfo = [vlan]
+
+ if vlan == vlans[-1]:
+ infotexts.append(concatenate_vlans(vlan, subinfo))
+
+ last_vlan = vlan
+
+ return ", ".join(infotexts)
+
+
+def inv_cisco_vlans(info, params):
+ node = inv_tree("networking.interfaces:")
+ map_vlans = {
+ '1' : 'static',
+ '2' : 'dynamic',
+ '3' : 'multi-VLAN',
+ }
+
+ for if_id, vlan_type, vlan_single, vlan_multi in info:
+ vlan_readable = map_vlans.get(vlan_type, "")
+ vlans = None
+ if vlan_single != '0' and vlan_type in ['1', '2']:
+ vlans = vlan_single
+ elif vlan_type == '3':
+ vlans = parse_multi_vlan(vlan_multi)
+
+ if vlans:
+ for if_info in node:
+ if if_info["index"] == int(if_id):
+ if_info["vlans"] = vlans
+ if_info["vlantype"] = vlan_readable
+ break
+
+ return node
+
+
+inv_info['inv_cisco_vlans'] = {
+ "inv_function" : inv_cisco_vlans,
+ 'snmp_info' : (".1.3.6.1.4.1.9.9.68.1.2.2.1", [
+ OID_END,
+ "1", # vmVlanType
+ "2", # vmVlan
+ "4", # vmVlans
+ ]),
+ 'snmp_scan_function': lambda oid: "cisco" in oid(".1.3.6.1.2.1.1.1.0").lower(),
+}
diff --git a/web/plugins/views/inventory.py b/web/plugins/views/inventory.py
index 850122c..70e5583 100644
--- a/web/plugins/views/inventory.py
+++ b/web/plugins/views/inventory.py
@@ -846,6 +846,8 @@ inventory_displayhints.update({
".networking.interfaces:*.speed" : { "title" : _("Speed"), "paint" : "nic_speed", },
".networking.interfaces:*.port_type" : { "title" : _("Type"), "paint" : "if_port_type", "filter" : visuals.FilterInvtableInterfaceType },
".networking.interfaces:*.last_change" : { "title" : _("Last Change"), "paint" : "timestamp_as_age_days", "filter" : visuals.FilterInvtableTimestampAsAge },
+ ".networking.interfaces:*.vlans" : { "title" : _("VLANs") },
+ ".networking.interfaces:*.vlantype" : { "title" : _("VLAN type") },
".networking.wlan" : { "title" : _("WLAN") },
".networking.wlan.controller" : { "title" : _("Controller") },