Module: check_mk
Branch: master
Commit: 4d193c1b689575f93d05d6f18073f4851ab53515
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4d193c1b689575…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Thu Jan 14 09:10:46 2016 +0100
#2889 snmp_extended_info: new inventory function which discovers the model name and serial
number
The information about model name and serial number is discovered on all SNMP devices on
which
the OIDs "1.3.6.1.2.1.47.1.1.1.1.4.1" or
"1.3.6.1.2.1.47.1.1.1.1.4.1001" have value zero.
This means the device itself.
---
.werks/2889 | 11 ++++++++
ChangeLog | 1 +
inventory/snmp_extended_info | 56 ++++++++++++++++++++++++++++++++++++++++
web/plugins/views/inventory.py | 2 ++
4 files changed, 70 insertions(+)
diff --git a/.werks/2889 b/.werks/2889
new file mode 100644
index 0000000..ad05caa
--- /dev/null
+++ b/.werks/2889
@@ -0,0 +1,11 @@
+Title: snmp_extended_info: new inventory function which discovers the model name and
serial number
+Level: 1
+Component: inv
+Compatible: compat
+Version: 1.2.7i4
+Date: 1452758542
+Class: feature
+
+The information about model name and serial number is discovered on all SNMP devices on
which
+the OIDs "1.3.6.1.2.1.47.1.1.1.1.4.1" or
"1.3.6.1.2.1.47.1.1.1.1.4.1001" have value zero.
+This means the device itself.
diff --git a/ChangeLog b/ChangeLog
index c8db707..170cbe1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -266,6 +266,7 @@
HW/SW-Inventory:
* 2436 NetApp monitoring: Now able to gather data for inventory...
* 2440 VMware ESX inventory: Now able to display ESX hostsystems and virtualmachines
of clusters
+ * 2889 snmp_extended_info: new inventory function which discovers the model name and
serial number...
* 2667 FIX: solaris_mem: fix exception in inventory plugin
* 2714 FIX: Fixed visibility of folding arrows by making them dark
* 2439 FIX: solaris_prtdiag: Can now handle Oracle Corporation SUN FIRE X4170 M2
SERVER...
diff --git a/inventory/snmp_extended_info b/inventory/snmp_extended_info
new file mode 100644
index 0000000..9f5c9e5
--- /dev/null
+++ b/inventory/snmp_extended_info
@@ -0,0 +1,56 @@
+#!/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-
+# ails. 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.2.1.47.1.1.1.1.4.1 0 --> ENTITY-MIB::entPhysicalContainedIn.1
+# .1.3.6.1.2.1.47.1.1.1.1.11.1 SMG0926A0CR --> ENTITY-MIB::entPhysicalSerialNum.1
+# .1.3.6.1.2.1.47.1.1.1.1.13.1 WS-C6509 --> ENTITY-MIB::entPhysicalModelName.1
+
+
+
+def inv_snmp_extended_info(info):
+ node = inv_tree("hardware.system.")
+
+ if len(info) >= 3:
+ if info[0][0].split(".")[-1] == "0":
+ node["serial_number"] = info[1][0].split(".")[-1]
+ node["model_name"] = info[2][0].split(".")[-1]
+ elif info[0][1].split(".")[-1] == "0":
+ node["serial_number"] = info[1][1].split(".")[-1]
+ node["model_name"] = info[2][1].split(".")[-1]
+
+ return node
+
+
+inv_info['snmp_extended_info'] = {
+ 'inv_function' : inv_snmp_extended_info,
+ 'snmp_info' : ('.1.3.6.1.2.1.47.1.1.1.1', [
+ "4", # entPhysicalContainedIn.1
+ "11", # entPhysicalSerialNum.1
+ "13" # entPhysicalModelName.1
+ ], [ "1", "1001" ]),
+ 'snmp_scan_function' : lambda oid:
oid(".1.3.6.1.2.1.47.1.1.1.1.*"),
+}
diff --git a/web/plugins/views/inventory.py b/web/plugins/views/inventory.py
index 9016478..1fb802b 100644
--- a/web/plugins/views/inventory.py
+++ b/web/plugins/views/inventory.py
@@ -571,6 +571,8 @@ inventory_displayhints.update({
".hardware.memory.arrays:*.devices:*.speed" : { "title" :
_("Speed"), "paint" : "hz", },
".hardware.system." : { "title" :
_("System") },
".hardware.system.product" : { "title" :
_("Product") },
+ ".hardware.system.serial_number" : { "title" :
_("Serial Number") },
+ ".hardware.system.model_name" : { "title" :
_("Model Name") },
".hardware.storage." : { "title" :
_("Storage") },
".hardware.storage.disks:" : { "title" :
_("Block Devices") },
".hardware.storage.disks:*." : { "title" :
_("Block Device %d") },