Module: check_mk
Branch: master
Commit: 615684631a64cfdec17b33c20140087492e0d7ec
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=615684631a64cf…
Author: Moritz Kiemer <mo(a)mathias-kettner.de>
Date: Fri May 25 07:59:16 2018 +0200
Handle OS and device info in HW/SW inventory
Change-Id: I4e8c824b7d7df9252230ea67d925ca53b0d4750d
---
agents/special/agent_fritzbox | 6 ++----
inventory/fritz | 46 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 48 insertions(+), 4 deletions(-)
diff --git a/agents/special/agent_fritzbox b/agents/special/agent_fritzbox
index fc26ac0..7e3f0a5 100755
--- a/agents/special/agent_fritzbox
+++ b/agents/special/agent_fritzbox
@@ -197,11 +197,9 @@ try:
if opt_debug:
raise
- sys.stdout.write('<<<check_mk>>>\n')
- sys.stdout.write('Version: %s\n' % g_version)
- sys.stdout.write('AgentOS: %s\n' % g_device)
-
sys.stdout.write('<<<fritz>>>\n')
+ sys.stdout.write('VersionOS %s\n' % g_version)
+ sys.stdout.write('VersionDevice %s\n' % g_device)
for key, value in status.items():
sys.stdout.write('%s %s\n' % (key, value))
diff --git a/inventory/fritz b/inventory/fritz
new file mode 100644
index 0000000..b7bd1b1
--- /dev/null
+++ b/inventory/fritz
@@ -0,0 +1,46 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2018 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.
+
+#<<<fritz>>>
+#VersionOS 74.06.05
+#VersionDevice AVM FRITZ!Box Fon WLAN 7270 v3
+#
+
+
+def inv_fritz(info):
+
+ parsed = {line[0]: ' '.join(line[1:])
+ for line in info}
+
+ node_hw = inv_tree('hardware.system.')
+ node_hw['model'] = parsed.get('VersionDevice')
+ node_sw = inv_tree('software.os.')
+ node_sw['version'] = parsed.get('VersionOS')
+
+inv_info['fritz'] = {
+ "inv_function" : inv_fritz,
+}
+