Module: check_mk
Branch: master
Commit: 28589543751652344d53df9e631c7cd61b44bbfd
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=28589543751652…
Author: Goetz Golla <gg(a)mathias-kettner.de>
Date: Sun Jul 6 20:17:45 2014 +0200
lnx_video, win_video: added inventory function and agent for linux video cards, modified
windows inventory function
---
.werks/627 | 8 +++++
ChangeLog | 1 +
agents/plugins/mk_inventory.linux | 4 +++
inventory/lnx_video | 62 +++++++++++++++++++++++++++++++++++++
inventory/win_video | 17 +++++-----
web/plugins/views/inventory.py | 8 ++++-
6 files changed, 90 insertions(+), 10 deletions(-)
diff --git a/.werks/627 b/.werks/627
new file mode 100644
index 0000000..3ab82a1
--- /dev/null
+++ b/.werks/627
@@ -0,0 +1,8 @@
+Title: lnx_video, win_video: added inventory function and agent for linux video cards,
modified windows inventory function
+Level: 1
+Component: inv
+Version: 1.2.5i5
+Date: 1404670606
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 590b48f..d164279 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -63,6 +63,7 @@
HW/SW-Inventory:
* 0625 hw/sw inventory now reads the kernel version and architecture for linux and
windows
+ * 0627 lnx_video, win_video: added inventory function and agent for linux video
cards, modified windows inventory function
* 0167 FIX: mk_inventory.linux: Changed field separator from pipe to tab...
* 1005 FIX: Fix exception when using pretty-print output format
* 0946 FIX: hw/sw inventory: fixed display bug for byte fields with the value 0...
diff --git a/agents/plugins/mk_inventory.linux b/agents/plugins/mk_inventory.linux
index 75a1e8d..d7d89bd 100755
--- a/agents/plugins/mk_inventory.linux
+++ b/agents/plugins/mk_inventory.linux
@@ -50,6 +50,10 @@ then
uname -m
uname -r
fi
+ if type lspci > /dev/null ; then
+ echo "<<<lnx_vga:sep(58):persist($UNTIL)>>>"
+ lspci -v -s $(lspci | grep VGA | cut -d" " -f 1)
+ fi
fi
diff --git a/inventory/lnx_video b/inventory/lnx_video
new file mode 100644
index 0000000..08cd57e
--- /dev/null
+++ b/inventory/lnx_video
@@ -0,0 +1,62 @@
+#!/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-
+# 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.
+
+# Example output
+# <<<lnx_video>>>
+# 05:00.0 VGA compatible controller: Advanced Micro Devices [AMD] nee ATI Cape Verde PRO
[Radeon HD 7700 Series] (prog-if 00 [VGA controller])
+# Subsystem: Hightech Information System Ltd. Device 200b
+# Flags: bus master, fast devsel, latency 0, IRQ 58
+# Memory at d0000000 (64-bit, prefetchable) [size=256M]
+# Memory at fe8c0000 (64-bit, non-prefetchable) [size=256K]
+# I/O ports at c000 [size=256]
+# Expansion ROM at fe8a0000 [disabled] [size=128K]
+# Capabilities: [48] Vendor Specific Information: Len=08 <?>
+# Capabilities: [50] Power Management version 3
+# Capabilities: [58] Express Legacy Endpoint, MSI 00
+# Capabilities: [a0] MSI: Enable+ Count=1/1 Maskable- 64bit+
+# Capabilities: [100] Vendor Specific Information: ID=0001 Rev=1 Len=010
<?>
+# Capabilities: [150] Advanced Error Reporting
+# Capabilities: [270] #19
+# Kernel driver in use: fglrx_pci
+
+
+def inv_lnx_video(info):
+ node = inv_tree("hardware.video:")
+ array = {}
+ for line in info:
+ if len(line) > 1:
+ if re.search("VGA compatible controller", line[1]):
+ array["name"] = line[2]
+ elif line[0] == "Subsystem":
+ array["subsystem"] = line[1]
+ elif line[0] == "Kernel driver in use":
+ array["driver"] = line[1]
+ node.append(array)
+
+
+inv_info['lnx_video'] = {
+ "inv_function" : inv_lnx_video,
+}
diff --git a/inventory/win_video b/inventory/win_video
index e50a2e5..4eebf19 100644
--- a/inventory/win_video
+++ b/inventory/win_video
@@ -37,20 +37,19 @@
def inv_win_video(info):
- node = inv_tree("hardware.video.")
+ node = inv_tree("hardware.video:")
+ array = {}
for varname, value in info:
varname = re.sub(" *","", varname)
value = re.sub("^ ", "", value)
- if varname == "Description":
- node["description"] = value
- elif varname == "Name":
- node["product"] = value
- elif varname == "VideoModeDescription":
- node["video_mode"] = value
+ if varname == "Name":
+ array["name"] = value
elif varname == "DriverVersion":
- node["driver_version"] = value
+ array["driver_version"] = value
elif varname == "DriverDate":
- node["driver_date"] =
int(time.mktime(time.strptime(value.split(".")[0], "%Y%m%d%H%M%S")))
+ array["driver_date"] =
int(time.mktime(time.strptime(value.split(".")[0], "%Y%m%d%H%M%S")))
+ node.append(array)
+
inv_info['win_video'] = {
"inv_function" : inv_win_video,
diff --git a/web/plugins/views/inventory.py b/web/plugins/views/inventory.py
index 95027fa..7ba2214 100644
--- a/web/plugins/views/inventory.py
+++ b/web/plugins/views/inventory.py
@@ -572,7 +572,13 @@ inventory_displayhints.update({
".hardware.memory.arrays:*.devices:*.speed" : { "title" :
_("Speed"), "paint" : "hz", },
".hardware.system." : { "title" :
_("System") },
".hardware.harddisks." : { "title" :
_("Hard Disks") },
- ".hardware.video." : { "title" :
_("Video Cards") },
+ ".hardware.video:" : { "title" :
_("Graphic Cards") },
+ ".hardware.video:*." : { "title" :
_("Graphic Card %d") },
+ ".hardware.video.*.name" : { "title" :
_("Graphic Card Name"), "short" : _("Card Name") },
+ ".hardware.video.*.subsystem" : { "title" :
_("Vendor and Device ID"), "short" : _("Vendor") },
+ ".hardware.video.*.driver" : { "title" :
_("Driver"), "short" : _("Driver") },
+ ".hardware.video.*.driver_date" : { "title" :
_("Driver Date"), "short" : _("Driver Date") },
+ ".hardware.video.*.driver_version" : { "title" :
_("Driver Version"), "short" : _("Driver Version") },
".software." : { "title" :
_("Software"), "icon" : "software" },
".software.os." : { "title" :
_("Operating System") },