Module: check_mk
Branch: master
Commit: aa4228b6e543ba780b9d580f2563711ab82cd0f2
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=aa4228b6e543ba…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Fri Feb 24 16:31:47 2017 +0100
8751 netapp_api_systemtime: new check which monitors the age of Netapp devices
Change-Id: I93739598be49d7c43780a65aeaed075e9ae8a185
---
.werks/8751 | 10 +++++
checkman/netapp_api_systemtime | 14 +++++++
checks/netapp_api_systemtime | 75 ++++++++++++++++++++++++++++++++++++
web/plugins/wato/check_parameters.py | 22 +++++++++++
4 files changed, 121 insertions(+)
diff --git a/.werks/8751 b/.werks/8751
new file mode 100644
index 0000000..2fa4763
--- /dev/null
+++ b/.werks/8751
@@ -0,0 +1,10 @@
+Title: netapp_api_system_time: new check which monitors the age of Netapp devices
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cee
+Version: 1.5.0i1
+Date: 1487835373
+Class: feature
+
+
diff --git a/checkman/netapp_api_systemtime b/checkman/netapp_api_systemtime
new file mode 100644
index 0000000..348f349
--- /dev/null
+++ b/checkman/netapp_api_systemtime
@@ -0,0 +1,14 @@
+title: NetApp Filer: Systemtime
+agents: netapp
+catalog: hw/storagehw/netapp
+license: GPL
+distribution: check_mk
+description:
+ The check monitors the time difference between system and agent time for a NetApp filer.
+ There are no default levels set. You can configure upper levels for the time difference.
+
+item:
+ The node name.
+
+inventory:
+ One check is created for node.
diff --git a/checks/netapp_api_systemtime b/checks/netapp_api_systemtime
new file mode 100644
index 0000000..cafe43d
--- /dev/null
+++ b/checks/netapp_api_systemtime
@@ -0,0 +1,75 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2017 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.
+
+
+# 7 mode
+# <<<netapp_api_systemtime:sep(9)>>>
+# name 76123 123
+
+# Cluster mode
+# <<<netapp_api_systemtime:sep(9)>>>
+# node1 76123 123123
+# node2 7612311 123123
+
+
+def inventory_netapp_api_systemtime(info):
+ for line in info:
+ yield line[0], {}
+
+
+def check_netapp_api_systemtime(item, params, info):
+ for line in info:
+ if line[0] == item:
+ agent_time = int(line[1])
+ system_time = int(line[2])
+ timediff = agent_time - system_time
+ warn, crit = params.get("levels", (None, None))
+
+ if crit is not None and timediff >= crit:
+ state = 2
+ elif warn is not None and timediff >= warn:
+ state = 1
+ else:
+ state = 0
+
+ infotext = "System time: %s, Time difference: %s" % \
+ (get_timestamp_human_readable(system_time),
+ get_age_human_readable(timediff))
+
+ if state > 0:
+ infotext += " (warn/crit at %s/%s)" % (
+ get_age_human_readable(warn),
+ get_age_human_readable(crit))
+
+ return state, infotext
+
+
+check_info['netapp_api_systemtime'] = {
+ 'inventory_function' : inventory_netapp_api_systemtime,
+ 'check_function' : check_netapp_api_systemtime,
+ 'service_description' : 'Systemtime %s',
+ 'group' : 'netapp_systemtime'
+}
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index a42d706..ba5a8bc 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -3467,6 +3467,28 @@ register_check_parameters(
)
register_check_parameters(
+ subgroup_applications,
+ "netapp_systemtime",
+ _("Netapp systemtime"),
+ Dictionary(
+ elements = [
+ ( "levels", Tuple(
+ title = _("Set upper levels for the time difference"),
+ help = _("Here you can Set upper levels for the time difference "
+ "between agent and system time."),
+ elements = [
+ Age(title = _("Warning if at")),
+ Age(title = _("Critical if at")),
+ ])),
+ ]),
+ TextAscii(
+ title = _("Name of the node"),
+ allow_empty = False,
+ ),
+ match_type = "dict",
+)
+
+register_check_parameters(
subgroup_applications,
"jvm_sessions",
_("JVM session count"),