Module: check_mk
Branch: master
Commit: 26adc507587cd8e7b6514190a6ff981fc5398c6a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=26adc507587cd8…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Wed Apr 18 14:51:13 2018 +0200
5991 win_computersystem: Inventorizes model, manufacturer and client hostname
Change-Id: I03a96cf36b97514767d4707e54694e9a2a1008c5
---
.werks/5991 | 10 +++++++
agents/windows/plugins/mk_inventory.vbs | 5 ++++
inventory/win_computersystem | 53 +++++++++++++++++++++++++++++++++
inventory/win_system | 3 +-
web/plugins/views/inventory.py | 50 +++++++++++++++----------------
5 files changed, 94 insertions(+), 27 deletions(-)
diff --git a/.werks/5991 b/.werks/5991
new file mode 100644
index 0000000..2f4201d
--- /dev/null
+++ b/.werks/5991
@@ -0,0 +1,10 @@
+Title: win_computersystem: Inventorizes model, manufacturer and client hostname
+Level: 1
+Component: inv
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1524055833
+Class: feature
+
+
diff --git a/agents/windows/plugins/mk_inventory.vbs
b/agents/windows/plugins/mk_inventory.vbs
index 21788f9..d4f2bdf 100644
--- a/agents/windows/plugins/mk_inventory.vbs
+++ b/agents/windows/plugins/mk_inventory.vbs
@@ -285,6 +285,11 @@ Call startSection("win_system",58,timeUntil)
systemVars = Array(
"Manufacturer","Name","Model","HotSwappable","InstallDate","PartNumber","SerialNumber"
)
Call getWMIObject("Win32_SystemEnclosure",systemVars)
+' ComputerSystem
+Call startSection("win_computersystem",58,timeUntil)
+systemVars = Array(
"Manufacturer","Name","Model","InstallDate" )
+Call getWMIObject("Win32_ComputerSystem",systemVars)
+
' Hard-Disk
Call startSection("win_disks",58,timeUntil)
diskVars = Array(
"Manufacturer","InterfaceType","Model","Name","SerialNumber","Size","MediaType","Signature"
)
diff --git a/inventory/win_computersystem b/inventory/win_computersystem
new file mode 100644
index 0000000..03afe68
--- /dev/null
+++ b/inventory/win_computersystem
@@ -0,0 +1,53 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2013 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.
+
+# win_computersystem is executed after win_system
+# and we overwrite some data.
+# Assumption: it's more precise
+
+# Example output:
+# <<<win_computersystem:sep(58)>>>
+# Manufacturer: FUJITSU
+# Model: PRIMERGY RX100 S7
+# Name: <WINDOWSHOST>
+
+
+def inv_win_computersystem(info):
+ node = inv_tree("hardware.system.")
+ for line in info:
+ key = line[0]
+ value = " ".join(line[1:])
+ if key == "Manufacturer":
+ node["manufacturer"] = value
+ elif key == "Model":
+ node["model"] = value
+ elif key == "Name":
+ node["family"] = value
+
+
+inv_info['win_computersystem'] = {
+ "inv_function": inv_win_computersystem,
+}
diff --git a/inventory/win_system b/inventory/win_system
index d634d9d..c566727 100644
--- a/inventory/win_system
+++ b/inventory/win_system
@@ -52,6 +52,7 @@ def inv_win_system(info):
elif varname == "Model":
node["family"] = value
+
inv_info['win_system'] = {
- "inv_function" : inv_win_system,
+ "inv_function": inv_win_system,
}
diff --git a/web/plugins/views/inventory.py b/web/plugins/views/inventory.py
index bc11e02..0f7d9ed 100644
--- a/web/plugins/views/inventory.py
+++ b/web/plugins/views/inventory.py
@@ -565,38 +565,36 @@ inventory_displayhints.update({
".hardware.system.serial" : { "title" :
_("Serial Number") },
".hardware.system.expresscode" : { "title" :
_("Express Servicecode") },
".hardware.system.model" : { "title" :
_("Model Name") },
+ ".hardware.system.manufacturer" : { "title" :
_("Manufacturer") },
# Legacy ones. Kept to not break existing views - DON'T use these values for new
plugins
".hardware.system.serial_number" : { "title" :
_("Serial Number - LEGACY, don't use") },
".hardware.system.model_name" : { "title" :
_("Model Name - LEGACY, don't use") },
- ".hardware.system.manufacturer" : { "title" :
_("Manufacturer") },
-
".hardware.components." : { "title" :
_("Physical Components") },
-
- ".hardware.components.others:" : { "title" :
_("Other entities"),
- "keyorder" : [
"index", "name", "description", "software",
"serial", "manufacturer", "model", "location" ],
- "view" :
"invother_of_host" },
- ".hardware.components.others:*.index" : { "title" :
_("Index") },
- ".hardware.components.others:*.name" : { "title" :
_("Name") },
- ".hardware.components.others:*.description" : { "title" :
_("Description") },
- ".hardware.components.others:*.software" : { "title" :
_("Software") },
- ".hardware.components.others:*.serial" : { "title" :
_("Serial Number") },
- ".hardware.components.others:*.manufacturer" : { "title" :
_("Manufacturer") },
- ".hardware.components.others:*.model" : { "title" :
_("Model Name") },
- ".hardware.components.others:*.location" : { "title" :
_("Location") },
-
- ".hardware.components.unknowns:" : { "title" :
_("Unknown entities"),
- "keyorder" : [
"index", "name", "description", "software",
"serial", "manufacturer", "model", "location" ],
- "view" :
"invunknown_of_host" },
- ".hardware.components.unknowns:*.index" : { "title" :
_("Index") },
- ".hardware.components.unknowns:*.name" : { "title" :
_("Name") },
- ".hardware.components.unknowns:*.description" : { "title" :
_("Description") },
- ".hardware.components.unknowns:*.software" : { "title" :
_("Software") },
- ".hardware.components.unknowns:*.serial" : { "title" :
_("Serial Number") },
- ".hardware.components.unknowns:*.manufacturer" : { "title" :
_("Manufacturer") },
- ".hardware.components.unknowns:*.model" : { "title" :
_("Model Name") },
- ".hardware.components.unknowns:*.location" : { "title" :
_("Location") },
+ ".hardware.components.others:" : { "title" :
_("Other entities"),
+ "keyorder" : [
"index", "name", "description", "software",
"serial", "manufacturer", "model", "location" ],
+ "view" :
"invother_of_host" },
+ ".hardware.components.others:*.index" : { "title" :
_("Index") },
+ ".hardware.components.others:*.name" : { "title" :
_("Name") },
+ ".hardware.components.others:*.description" : { "title" :
_("Description") },
+ ".hardware.components.others:*.software" : { "title" :
_("Software") },
+ ".hardware.components.others:*.serial" : { "title" :
_("Serial Number") },
+ ".hardware.components.others:*.manufacturer" : { "title" :
_("Manufacturer") },
+ ".hardware.components.others:*.model" : { "title" :
_("Model Name") },
+ ".hardware.components.others:*.location" : { "title" :
_("Location") },
+
+ ".hardware.components.unknowns:" : { "title" :
_("Unknown entities"),
+ "keyorder" : [
"index", "name", "description", "software",
"serial", "manufacturer", "model", "location" ],
+ "view" :
"invunknown_of_host" },
+ ".hardware.components.unknowns:*.index" : { "title" :
_("Index") },
+ ".hardware.components.unknowns:*.name" : { "title" :
_("Name") },
+ ".hardware.components.unknowns:*.description" : { "title" :
_("Description") },
+ ".hardware.components.unknowns:*.software" : { "title" :
_("Software") },
+ ".hardware.components.unknowns:*.serial" : { "title" :
_("Serial Number") },
+ ".hardware.components.unknowns:*.manufacturer" : { "title" :
_("Manufacturer") },
+ ".hardware.components.unknowns:*.model" : { "title" :
_("Model Name") },
+ ".hardware.components.unknowns:*.location" : { "title" :
_("Location") },
".hardware.components.chassis:" : { "title" :
_("Chassis"),
"keyorder" : [
"index", "name", "description", "software",
"serial", "manufacturer", "model", "location" ],