Module: check_mk
Branch: master
Commit: b01536a45b5847e4db50b39658c5afbd1a3f167b
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b01536a45b5847…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Thu Dec 17 09:12:04 2015 +0100
windows agent: each section can now be flushed to socket individually
and crash_log remains open between requests so that realtime updates can log as well.
---
agents/windows/Configuration.cc | 16 +++++
agents/windows/check_mk_agent.cc | 135 ++++++++++++++++++++++++--------------
agents/windows/logging.cc | 18 ++---
3 files changed, 113 insertions(+), 56 deletions(-)
Diff: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=b01536a45b…
Module: check_mk
Branch: master
Commit: ec4d9b1aaae1abdd58bf07b2160e986bacd7465b
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ec4d9b1aaae1ab…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Wed Dec 16 16:00:54 2015 +0100
#2817 cmc_temp: New temperature check for Rittal devices using the CMC MIB
---
.werks/2817 | 9 +++++++++
ChangeLog | 1 +
checkman/cmc_temp | 19 ++++++++++++++++++
checks/cmc_temp | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 86 insertions(+)
diff --git a/.werks/2817 b/.werks/2817
new file mode 100644
index 0000000..bc8f20f
--- /dev/null
+++ b/.werks/2817
@@ -0,0 +1,9 @@
+Title: cmc_temp: New temperature check for Rittal devices using the CMC MIB
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i4
+Date: 1450278026
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index cf852c5..57fc82e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -66,6 +66,7 @@
* 2812 Avaya Series 88xx / 45xx: New temperature, fan and CPU utilization checks...
* 2870 dotnet_clrmemory, wmi_cpuload, wmi_webservices, msexch_activesync, msexch_autodiscovery, msexch_availability, msexch_isstore, msexch_owa, msexch_rpcclientaccess: a whole slew of new checks relating to monitoring MS Exchange...
* 2816 check_mail_loop: now supports STARTTLS for IMAP authentification
+ * 2817 cmc_temp: New temperature check for Rittal devices using the CMC MIB
* 2660 FIX: fixed windows agent using the wrong working directory...
* 2664 FIX: ps: Speedup in situation with many matching processes...
* 2661 FIX: windows agent: fixed incomplete process list...
diff --git a/checkman/cmc_temp b/checkman/cmc_temp
new file mode 100644
index 0000000..2d171bc
--- /dev/null
+++ b/checkman/cmc_temp
@@ -0,0 +1,19 @@
+title: Rittal CMC: Temperature
+agents: snmp
+catalog: hw/environment/rittal
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the temperature levels of Rittal devices
+ supporting the CMC MIB. The temperature levels can be configured (default to 45, 50).
+ The configured levels on the device can also get taken into account.
+
+item:
+ The sensor number: "1" or "2".
+
+perfdata:
+ One variable: the current temperature in degrees celsius.
+
+inventory:
+ There are always two temperature sensors detected. Creates one service for each sensor.
+
diff --git a/checks/cmc_temp b/checks/cmc_temp
new file mode 100644
index 0000000..cf02e5f
--- /dev/null
+++ b/checks/cmc_temp
@@ -0,0 +1,57 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2014 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.
+
+
+# [[[u'26', u'26']], [[u'45', u'15', u'45', u'15']]]
+
+factory_settings["cmc_temp_default_levels"] = {
+ "levels" : (45, 50),
+}
+
+def inventory_cmc_temp(info):
+ # There are always two sensors
+ return [("1", {}), ("2", {})]
+
+def check_cmc_temp(item, params, info):
+ offset = int(item) - 1
+ current_temp = int(info[0][0][offset])
+ dev_high, dev_low = map(int, info[1][0][offset * 2:][:2])
+ return check_temperature(current_temp, params, dev_levels = (dev_high, dev_high),
+ dev_levels_lower = (dev_low, dev_low))
+
+check_info['cmc_temp'] = {
+ "inventory_function" : inventory_cmc_temp,
+ "check_function" : check_cmc_temp,
+ "has_perfdata" : True,
+ "group" : "temperature",
+ "default_levels_variable": "cmc_temp_default_levels",
+ "service_description" : "Temperature Sensor %s",
+ "snmp_scan_function" : lambda oid: ".1.3.6.1.4.1.2606.1" in oid(".1.3.6.1.2.1.1.2.0"),
+ # valueTemperature1, valueTemperature2
+ "snmp_info" : [(".1.3.6.1.4.1.2606.1.1", [ 1, 2 ]),
+ # setpointHighTemperature1, setpointLowTemperature1, setpointHighTemperature2, setpointLowTemperature2
+ (".1.3.6.1.4.1.2606.1.4", [4, 5, 6, 7])]
+}
Module: check_mk
Branch: master
Commit: 080cc2641fad78a599ab23859d8f4789be80f27f
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=080cc2641fad78…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Dec 16 14:48:15 2015 +0100
New valuespec for Check_MK version numbers
---
web/htdocs/valuespec.py | 21 ++++++++++++++++-----
web/htdocs/wato.py | 27 +++++++++++++++++----------
2 files changed, 33 insertions(+), 15 deletions(-)
diff --git a/web/htdocs/valuespec.py b/web/htdocs/valuespec.py
index b52d3e9..82532a8 100644
--- a/web/htdocs/valuespec.py
+++ b/web/htdocs/valuespec.py
@@ -622,18 +622,20 @@ class AbsoluteDirname(TextAscii):
self._regex_error = _("Please enter a valid absolut pathname with / as a path separator.")
-# Valuespec for a HTTP Url (not HTTPS), that
-# automatically adds http:// to the value
+# Valuespec for a HTTP or HTTPS Url, that
+# automatically adds http:// to the value if no protocol has
+# been specified
class HTTPUrl(TextAscii):
def __init__(self, **kwargs):
+ kwargs.setdefault("size", 64)
TextAscii.__init__(self, **kwargs)
self._target = kwargs.get("target")
def validate_value(self, value, varprefix):
TextAscii.validate_value(self, value, varprefix)
if value:
- if not value.startswith("http://"):
- raise MKUserError(varprefix, _("The URL must begin with http://"))
+ if not value.startswith("http://") and not value.startswith("https://"):
+ raise MKUserError(varprefix, _("The URL must begin with http:// or https://"))
ValueSpec.custom_validate(self, value, varprefix)
def from_html_vars(self, varprefix):
@@ -644,7 +646,7 @@ class HTTPUrl(TextAscii):
return value
def value_to_text(self, url):
- if not url.startswith("http://"):
+ if not url.startswith("http://") and not value.startswith("https://"):
url = "http://" + url
try:
parts = urlparse.urlparse(url)
@@ -661,6 +663,15 @@ class HTTPUrl(TextAscii):
(self._target and 'target="%s" ' % self._target or ""),
html.attrencode(url), html.attrencode(text))
+def CheckMKVersion(**args):
+ args = args.copy()
+ regex_unstable = "(1\.[1234]\.(1|3|5|7|9|11|13|15)i[1-9](p[0-9]+)?)"
+ regex_stable = "(1\.[1234]\.(0|2|4|6|8|10|12|14)([bp][1-9]?[0-9]+)?)"
+ args["regex"] = "(" + regex_unstable + "|" + regex_stable + ")"
+ args["regex_error"] = _("This is not a valid Check_MK version number")
+ return TextAscii(**args)
+
+
class TextAreaUnicode(TextUnicode):
def __init__(self, **kwargs):
TextUnicode.__init__(self, **kwargs)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index ac46a43..6cc74b7 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -141,15 +141,7 @@ def page_handler():
raise MKGeneralException(_("WATO is disabled. Please set <tt>wato_enabled = True</tt>"
" in your <tt>multisite.mk</tt> if you want to use WATO."))
current_mode = html.var("mode") or "main"
- modeperms, modefunc = modes.get(current_mode, ([], None))
- if type(modefunc) != type(lambda: None):
- mode_class = modefunc
- modefunc = mode_class.create_mode_function()
-
-
- if modeperms != None and not config.may("wato.use"):
- raise MKAuthException(_("You are not allowed to use WATO."))
-
+ modeperms, modefunc = get_mode_function(current_mode)
# If we do an action, we aquire an exclusive lock on the complete
# WATO.
@@ -212,7 +204,7 @@ def page_handler():
html.write("</div>")
html.footer()
return
- modeperms, modefunc = modes.get(newmode)
+ modeperms, modefunc = get_mode_function(newmode)
current_mode = newmode
html.set_var("mode", newmode) # will be used by makeuri
@@ -285,6 +277,21 @@ def page_handler():
html.footer()
+def get_mode_function(mode):
+ modeperms, modefunc = modes.get(mode, ([], None))
+ if modefunc == None:
+ raise MKGeneralException(_("No such WATO module '<tt>%s</tt>'") % html.attrencode(mode))
+
+ if type(modefunc) != type(lambda: None):
+ mode_class = modefunc
+ modefunc = mode_class.create_mode_function()
+
+ if modeperms != None and not config.may("wato.use"):
+ raise MKAuthException(_("You are not allowed to use WATO."))
+
+ return modeperms, modefunc
+
+
def ensure_mode_permissions(modeperms):
for pname in modeperms:
if '.' not in pname:
Module: check_mk
Branch: master
Commit: 43204b79087fb5901f21d9db38f8eb2c534e386c
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=43204b79087fb5…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Wed Dec 16 13:53:56 2015 +0100
added a sample implementation of querying performance counters through PDH
this was implemented with the expectation to retrieve some elusive exchange
counters. Unfortunately to no avail. Since this code is nicer than the current
approach used in the agent, it may still be prudent to use this in the future.
---
agents/windows/PerfCounterPdh.cc | 399 ++++++++++++++++++++++++++++++++++++++
agents/windows/PerfCounterPdh.h | 85 ++++++++
agents/windows/pdhtest.cc | 63 ++++++
3 files changed, 547 insertions(+)
Diff: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=43204b7908…