Module: check_mk
Branch: master
Commit: 59636587f34e62875ce183b909e1e87d11180620
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=59636587f34e62…
Author: Götz Golla <gg(a)mathias-kettner.de>
Date: Tue Aug 13 18:09:53 2013 +0200
new check ups_test
---
checks/ups_test | 136 ++++++++++++++++++++++++++++++++++
web/plugins/wato/check_parameters.py | 17 ++++-
2 files changed, 152 insertions(+), 1 deletion(-)
diff --git a/checks/ups_test b/checks/ups_test
new file mode 100644
index 0000000..d5d0497
--- /dev/null
+++ b/checks/ups_test
@@ -0,0 +1,136 @@
+#!/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.
+
+# Description of OIDs used from RFC 1628
+# OID: 1.3.6.1.2.1.33.1.7.3
+# upsTestResultsSummary OBJECT-TYPE
+# SYNTAX INTEGER {
+# donePass(1),
+# doneWarning(2),
+# doneError(3),
+# aborted(4),
+# inProgress(5),
+# noTestsInitiated(6)
+# }
+# MAX-ACCESS read-only
+# STATUS current
+# DESCRIPTION
+# "The results of the current or last UPS diagnostics
+# test performed. The values for donePass(1),
+# doneWarning(2), and doneError(3) indicate that the
+# test completed either successfully, with a warning, or
+# with an error, respectively. The value aborted(4) is
+# returned for tests which are aborted by setting the
+# value of upsTestId to upsTestAbortTestInProgress.
+# Tests which have not yet concluded are indicated by
+# inProgress(5). The value noTestsInitiated(6)
+# indicates that no previous test results are available,
+# such as is the case when no tests have been run since
+# the last reinitialization of the network management
+# subsystem and the system has no provision for non-
+# volatile storage of test results."
+
+# OID: 1.3.6.1.2.1.33.1.7.4
+# upsTestResultsDetail OBJECT-TYPE
+# SYNTAX DisplayString (SIZE (0..255))
+# MAX-ACCESS read-only
+# STATUS current
+# DESCRIPTION
+# "Additional information about upsTestResultsSummary.
+# If no additional information available, a zero length
+# string is returned."
+
+# OID: 1.3.6.1.2.1.33.1.7.5
+# Description:
+# upsTestStartTime OBJECT-TYPE
+# SYNTAX TimeStamp
+# MAX-ACCESS read-only
+# STATUS current
+# DESCRIPTION
+# "The value of sysUpTime at the time the test in
+# progress was initiated, or, if no test is in progress,
+# the time the previous test was initiated. If the
+# value of upsTestResultsSummary is noTestsInitiated(6),
+# upsTestStartTime has the value 0."
+
+# OID: 1.3.6.1.2.1.33.1.7.6
+# Description:
+# upsTestElapsedTime OBJECT-TYPE
+# SYNTAX TimeInterval
+# MAX-ACCESS read-only
+# STATUS current
+# DESCRIPTION
+# "The amount of time, in TimeTicks, since the test in
+# progress was initiated, or, if no test is in progress,
+# the previous test took to complete. If the value of
+# TestResultsSummary is noTestsInitiated(6),
+# upsTestElapsedTime has the value 0."
+
+ups_test_default = (None, None )
+
+def inventory_ups_test(info):
+ if len(info) > 0:
+ return [ (None, "ups_test_default") ]
+
+def check_ups_test(item, params, info):
+ warn, crit = params
+ line = info[0]
+ ResultsSummary, StartTime, ElapsedTime = map(saveint, line[:-1])
+ ElapsedTime = ElapsedTime/100
+ etime = get_age_human_readable(ElapsedTime)
+
+ state = 0
+ state_label = ""
+ if ResultsSummary in [ 3, 4 ]:
+ state = 2
+ state_label = "(!!)"
+ elif ResultsSummary in [ 2, 6 ]:
+ state = 1
+ state_label = "(!)"
+
+ time_label = ""
+ if crit and ElapsedTime >= crit:
+ state = 2
+ time_label = "(!!)"
+ elif warn and ElapsedTime >= warn:
+ state = max(state, 1)
+ time_label = "(!)"
+
+ ResultsDetail = "%s%s Time elapsed since test: %s%s" % (line[-1],
state_label, etime, time_label)
+
+ perf = [ ( "ElapsedTime", ElapsedTime, warn, crit) ]
+ return (state, ResultsDetail, perf )
+
+check_info['ups_test'] = {
+ "inventory_function" : inventory_ups_test,
+ "check_function" : check_ups_test,
+ "service_description" : "UPS Test",
+ "has_perfdata" : True,
+ "group" : "ups_test",
+ "snmp_info" : ( ".1.3.6.1.2.1.33.1.7", [3,5,6,4 ] ),
+ "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0") in
[".1.3.6.1.4.1.534.1"]
+
+}
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 9e90ee0..212c77b 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -699,6 +699,21 @@ register_check_parameters(
)
register_check_parameters(
+ subgroup_environment,
+ "ups_test",
+ _("Time since last UPS selftest"),
+ Tuple(
+ title = _("Time since last UPS selftest"),
+ elements = [
+ Age(title = _("Warning if above")),
+ Age(title = _("Critical if above")),
+ ]
+ ),
+ None,
+ "first"
+)
+
+register_check_parameters(
subgroup_storage,
"fileinfo",
_("Size and age of single files"),
@@ -2865,7 +2880,7 @@ register_check_parameters(
register_check_parameters(
subgroup_os,
"apc_symentra",
- _("Levels for APC Symentra Check"),
+ _("APC Symentra Checks"),
Tuple(
elements = [
Integer(