Module: check_mk
Branch: master
Commit: 0378ed2502fa79dcb2d0f5ee82e335a282c26fc7
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0378ed2502fa79…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Mon Oct 8 14:40:52 2018 +0200
6742 mgmt_snmp_info: New check for SNMP management board
Change-Id: I225171505df5c506d411d3f45923c25012599cab
---
.werks/6742 | 10 ++++++++++
checkman/mgmt_snmp_info | 11 +++++++++++
checkman/snmp_info | 6 ------
checks/mgmt_snmp_info | 36 ++++++++++++++++++++++++++++++++++++
checks/snmp_info | 13 ++-----------
checks/snmp_info.include | 35 +++++++++++++++++++++++++++++++++++
6 files changed, 94 insertions(+), 17 deletions(-)
diff --git a/.werks/6742 b/.werks/6742
new file mode 100644
index 0000000..d62e88b
--- /dev/null
+++ b/.werks/6742
@@ -0,0 +1,10 @@
+Title: mgmt_snmp_info: New check for SNMP management board
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1539002444
+Class: feature
+
+
diff --git a/checkman/mgmt_snmp_info b/checkman/mgmt_snmp_info
new file mode 100644
index 0000000..2d5f153
--- /dev/null
+++ b/checkman/mgmt_snmp_info
@@ -0,0 +1,11 @@
+title: SNMP Management board: Retrieve informational SNMP data about host
+agents: snmp
+catalog: os/misc
+license: GPL
+distribution: check_mk
+description:
+ This check retrieves the values {sysDescr}, {sysContact}, {sysName} and
+ {sysLocation} and displays them. It is alwas OK.
+
+inventory:
+ One check per SNMP host will be created.
diff --git a/checkman/snmp_info b/checkman/snmp_info
index 09ba4b7..566386e 100644
--- a/checkman/snmp_info
+++ b/checkman/snmp_info
@@ -9,9 +9,3 @@ description:
inventory:
One check per SNMP host will be created.
-
- Please note: This check is not found be then SNMP scan (which you do with
- a simple {cmk -I}). You need to explicitely specify the check, if you
- want to inventorize it ({cmk --checks snmp_info -I}). Alternatively you
- can specify it as a manual check.
-
diff --git a/checks/mgmt_snmp_info b/checks/mgmt_snmp_info
new file mode 100644
index 0000000..4aeb963
--- /dev/null
+++ b/checks/mgmt_snmp_info
@@ -0,0 +1,36 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2014 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.
+
+
+check_info["mgmt_snmp_info"] = {
+ 'check_function': check_snmp_info,
+ 'inventory_function': inventory_snmp_info,
+ 'service_description': 'Management Interface: SNMP Info',
+ 'snmp_info': ('.1.3.6.1.2.1.1', ['1.0',
'4.0', '5.0', '6.0']),
+ 'snmp_scan_function': lambda oid: oid(".1.3.6.1.2.1.1.1.0") is
not None,
+ 'includes': ['snmp_info.include'],
+ "management_board": MGMT_ONLY,
+}
diff --git a/checks/snmp_info b/checks/snmp_info
index 64ff07c..862b494 100644
--- a/checks/snmp_info
+++ b/checks/snmp_info
@@ -24,17 +24,6 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
-def inventory_snmp_info(info):
- if len(info[0]) >= 4:
- return [ (None, None) ]
-
-def check_snmp_info(checktype, params, info):
- if len(info[0]) >= 4:
- return (0, ', '.join([ info[0][i] for i in [0, 2, 3, 1] if info[0][i]
]))
- return (3, "No data retrieved")
-
-
-# This check works on all SNMP hosts
check_info["snmp_info"] = {
'check_function': check_snmp_info,
@@ -42,4 +31,6 @@ check_info["snmp_info"] = {
'service_description': 'SNMP Info',
'snmp_info': ('.1.3.6.1.2.1.1', ['1.0',
'4.0', '5.0', '6.0']),
'snmp_scan_function': lambda oid: oid(".1.3.6.1.2.1.1.1.0") is
not None,
+ 'includes': ['snmp_info.include'],
+ "management_board": HOST_ONLY,
}
diff --git a/checks/snmp_info.include b/checks/snmp_info.include
new file mode 100644
index 0000000..687fef3
--- /dev/null
+++ b/checks/snmp_info.include
@@ -0,0 +1,35 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2014 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.
+
+
+def inventory_snmp_info(info):
+ if len(info[0]) >= 4:
+ return [ (None, None) ]
+
+def check_snmp_info(checktype, params, info):
+ if len(info[0]) >= 4:
+ return (0, ', '.join([ info[0][i] for i in [0, 2, 3, 1] if info[0][i]
]))
+ return (3, "No data retrieved")