Module: check_mk
Branch: master
Commit: 6061cd8d1b6c9bc1e09da79eface2a14b096dd4b
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6061cd8d1b6c9b…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Apr 28 11:10:44 2016 +0200
3447 mssql_versions: Added inventory plugin for MSSQL instances
---
.werks/3447 | 9 ++++++
ChangeLog | 1 +
inventory/mssql_versions | 59 ++++++++++++++++++++++++++++++++++++++++
web/plugins/views/inventory.py | 14 ++++++++--
4 files changed, 81 insertions(+), 2 deletions(-)
diff --git a/.werks/3447 b/.werks/3447
new file mode 100644
index 0000000..d7447ba
--- /dev/null
+++ b/.werks/3447
@@ -0,0 +1,9 @@
+Title: mssql_versions: Added inventory plugin for MSSQL instances
+Level: 1
+Component: inv
+Compatible: compat
+Version: 1.2.9i1
+Date: 1461834633
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 84873f2..6ea00c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -378,6 +378,7 @@
* 3319 HW/SW-Inventory service can now be OK in case of unreachable host...
* 3322 esx_vsphere_hostsystem: inventory now adds information about memory, uuid and
service tag...
* 3028 statgrab_mem, solaris_mem: updated inventory plugins for solaris systems...
+ * 3447 mssql_versions: Added inventory plugin for MSSQL instances
* 3219 FIX: lnx_distro: Now detecting Oracle VM Server correctly
* 3229 FIX: lnx_distro: SLES based systems have now an OS name inventorized\
* 3265 FIX: mk_inventory.solaris: fix problem on Solaris 10, do prtdiag and prtpicl
only in global zone
diff --git a/inventory/mssql_versions b/inventory/mssql_versions
new file mode 100644
index 0000000..bcf6b7e
--- /dev/null
+++ b/inventory/mssql_versions
@@ -0,0 +1,59 @@
+#!/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.
+
+# pre 1.4.0i1 output (without edition, space separated)
+# <<<mssql_versions>>>
+# MSSQL_SQLEXPRESS 10.50.1600.1
+
+# 1.4.0i1 output
+# <<<mssql_versions:sep(124)>>>
+# MSSQL_MSSQLSERVER|10.50.1600.1|Enterprise Edition
+
+def inv_mssql_versions(info):
+ node = inv_tree("software.applications.mssql.instances")
+
+ for line in info:
+ if len(line) not in [2, 4]:
+ continue
+
+ instance_id = line[0].split("_", 1)[1]
+ version = line[1]
+ edition = len(line) == 4 and line[2] or ""
+ clustered = len(line) == 4 and line[3] != ""
+ cluster_name = len(line) == 4 and line[3] or ""
+
+ instance = {
+ "name" : instance_id,
+ "version" : version,
+ "edition" : edition,
+ "clustered" : clustered,
+ "cluster_name" : cluster_name,
+ }
+ node.append(instance)
+
+inv_info["mssql_versions"] = {
+ "inv_function" : inv_mssql_versions,
+}
diff --git a/web/plugins/views/inventory.py b/web/plugins/views/inventory.py
index ecc72d1..15905c2 100644
--- a/web/plugins/views/inventory.py
+++ b/web/plugins/views/inventory.py
@@ -474,6 +474,10 @@ def inv_paint_if_available(available):
return "if_state " + (available and "if_available" or
"if_not_available"), \
(available and _("free") or _("used"))
+def inv_paint_mssql_is_clustered(clustered):
+ return "mssql_" + (clustered and "is_clustered" or
"is_not_clustered"), \
+ (clustered and _("is clustered") or _("is not clustered"))
+
def inv_paint_ipv4_network(nw):
if nw == "0.0.0.0/0":
return "", _("Default")
@@ -685,8 +689,14 @@ inventory_displayhints.update({
".software.applications.citrix.vm.catalog" : {
"title" : _("Catalog"), },
".software.applications.citrix.vm.agent_version" : {
"title" : _("Agent Version"), },
- ".software.applications.vmwareesx:*." : { "title" :
_("Datacenter %d") },
- ".software.applications.vmwareesx:*.clusters:*." : { "title" :
_("Cluster %d") },
+ ".software.applications.vmwareesx:*." : { "title" :
_("Datacenter %d") },
+ ".software.applications.vmwareesx:*.clusters:*." : { "title" :
_("Cluster %d") },
+
+ ".software.applications.mssql." : { "title" :
_("MSSQL") },
+ ".software.applications.mssql.instances:" : { "title" :
_("Instances"), "render" : render_inv_dicttable,
+ "keyorder" : [
"name", "edition", "version", "clustered",
"cluster_name" ],
+ },
+ ".software.applications.mssql.instances:*.clustered" : { "title"
: _("Clustered"), "paint" : "mssql_is_clustered"},
".networking." : { "title" :
_("Networking"), "icon" : "networking" },
".networking.total_interfaces" : { "title" :
_("Interfaces"), "paint" : "count", },