Module: check_mk
Branch: master
Commit: 90ffb0b658ec09bcddae638d62c25cf04ae929de
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=90ffb0b658ec09…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Oct 12 08:59:14 2011 +0200
New check dmi_sysinfo to gather basic hardware information
---
ChangeLog | 1 +
agents/plugins/dmi_sysinfo | 6 +++++
checkman/dmi_sysinfo | 16 ++++++++++++++
checks/dmi_sysinfo | 50 ++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 73 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a53518a..c8b53e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,7 @@
not on clients
* FIX: mbg_lantime_state: Fixed output UOM to really be miliseconds
* FIX: ntp: Handling large times in "poll" column correctly
+ * New check dmi_sysinfo to gather basic hardware information
Multisite:
* FIX: fix rescheduling of host check
diff --git a/agents/plugins/dmi_sysinfo b/agents/plugins/dmi_sysinfo
new file mode 100644
index 0000000..d0ed1c8
--- /dev/null
+++ b/agents/plugins/dmi_sysinfo
@@ -0,0 +1,6 @@
+#/bin/sh
+
+if which dmidecode >/dev/null 2>&1; then
+ echo "<<<dmi_sysinfo>>>"
+ dmidecode -t 1 -q
+fi
diff --git a/checkman/dmi_sysinfo b/checkman/dmi_sysinfo
new file mode 100644
index 0000000..b6edb6c
--- /dev/null
+++ b/checkman/dmi_sysinfo
@@ -0,0 +1,16 @@
+title: Collects basic hardware infos using dmi
+agents: linux
+author: Lars Michelsen <lm(a)mathias-kettner.de>
+license: GPL
+distribution: check_mk
+description:
+ This check displays basic dmi information provided by hosts using dmidecode like
+ the manufacturer, product-name, version and serial number.
+ The check always reports OK.
+
+ To be able to use this check the binary {dmidecode} needs to be installed on the
+ monitored host and the agent plugin {agents/plugins/dmi_sysinfo} needs to be
+ installed on the system to be monitored.
+
+inventory:
+ One service per host will be created when all requirements are met.
diff --git a/checks/dmi_sysinfo b/checks/dmi_sysinfo
new file mode 100644
index 0000000..936a215
--- /dev/null
+++ b/checks/dmi_sysinfo
@@ -0,0 +1,50 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2010 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.
+# Target
+
+def inventory_dmi_sysinfo(checkname, info):
+ if len(info) > 0 and info[0] == ['System', 'Information']:
+ return [(None, None)]
+
+def check_dmi_sysinfo(item, param, info):
+ if len(info) == 0 or info[0] != ['System', 'Information']:
+ return (3, "UNKNOWN - Invalid information")
+ data = {}
+ for line in info:
+ line = " ".join(line)
+ if ":" in line:
+ key, value = line.split(":")
+ data[key.strip()] = value.strip()
+
+ return (0, "Manufacturer: %s, Product-Name: %s, Version: %s, S/N: %s" % (
+ data.get("Manufacturer", "Unknown"),
+ data.get("Product Name", "Unknown"),
+ data.get("Version", "Unknown"),
+ data.get("Serial Number", "Unknown"),
+ ))
+
+
+check_info['dmi_sysinfo'] = (check_dmi_sysinfo, "DMI Sysinfo", 0,
inventory_dmi_sysinfo)