Module: check_mk
Branch: master
Commit: 5ad2455c16231862e5162df41e72a37950b5598d
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5ad2455c162318…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Jul 14 10:08:26 2015 +0200
Updated mkeventd to work with current pynetsnmp version
---
mkeventd/web/plugins/wato/mkeventd.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mkeventd/web/plugins/wato/mkeventd.py b/mkeventd/web/plugins/wato/mkeventd.py
index f0d8beb..17d7036 100644
--- a/mkeventd/web/plugins/wato/mkeventd.py
+++ b/mkeventd/web/plugins/wato/mkeventd.py
@@ -1958,7 +1958,7 @@ def validate_and_compile_mib(mibname, content):
# Provides the just uploaded MIB module
compiler.addSources(
- CallbackReader(lambda t,m,c: m==mibname and c or '', content)
+ CallbackReader(lambda m,c: m==mibname and c or '', content)
)
# Directories containing ASN1 MIB files which may be used for
Module: check_mk
Branch: master
Commit: 48338549bbe1956984abb72fe178612bb2c08d08
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=48338549bbe195…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Mon Jul 13 16:45:58 2015 +0200
#2402 FIX netapp_api_disk: fixed broken WATO and check configuration
Incorrect parameters were used within the WATO and the check configuration.
This check got an incomplete rework two months ago where naming for the parameters got changed.
This fix is able to migrate any existing old configuration, so there are no further changes required.
---
.werks/2402 | 11 ++++++++++
ChangeLog | 1 +
checks/netapp_api_disk | 19 +++++++++++-----
web/plugins/wato/check_parameters.py | 40 ++++++++++++++++++++++------------
4 files changed, 51 insertions(+), 20 deletions(-)
diff --git a/.werks/2402 b/.werks/2402
new file mode 100644
index 0000000..569b191
--- /dev/null
+++ b/.werks/2402
@@ -0,0 +1,11 @@
+Title: netapp_api_disk: fixed broken WATO and check configuration
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i3
+Date: 1436798438
+Class: fix
+
+Incorrect parameters were used within the WATO and the check configuration.
+This check got an incomplete rework two months ago where naming for the parameters got changed.
+This fix is able to migrate any existing old configuration, so there are no further changes required.
diff --git a/ChangeLog b/ChangeLog
index 28d0a2c..a5f96c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -47,6 +47,7 @@
* 2374 FIX: md: Fix exception for certain outputs of certain special MD configurations...
* 2458 FIX: FreeBSD-Agent: Fixed uptime calculation
* 1271 FIX: omd_apache: Fixed handling of urls with whitespace
+ * 2402 FIX: netapp_api_disk: fixed broken WATO and check configuration...
Multisite:
* 2385 SEC: Fixed possible reflected XSS on all GUI pages where users can produce unhandled exceptions...
diff --git a/checks/netapp_api_disk b/checks/netapp_api_disk
index 262f554..2a498bd 100644
--- a/checks/netapp_api_disk
+++ b/checks/netapp_api_disk
@@ -54,8 +54,13 @@ def check_netapp_api_disk_summary(_no_item, params, info):
"shelf-uids-of-disks": {"block-name": "shelf-uid-instance",
"key": "shelf-uid"}})
+ # Convert legacy levels
+ if "broken_spare_ratio" in params:
+ params = { "failed_spare_ratio": params["broken_spare_ratio"] }
+
disks = disks_info.get("disk-list-info")
shelfs = disks_info.get("shelf-uids-of-disks")
+
# The device can contain disks who belongs to another filer. We only check the ones
# belonging to this filer.
# TODO Do we need that?
@@ -65,9 +70,10 @@ def check_netapp_api_disk_summary(_no_item, params, info):
def find_disk_shelf_uid(disk_uid):
if not disk_to_shelf_map:
for shelf, values in shelfs.items():
- disks = values["disks"].split(" ")
- for disk in disks:
- disk_to_shelf_map[disk] = shelf
+ if "disks" in values:
+ disks = values["disks"].split(" ")
+ for disk in disks:
+ disk_to_shelf_map[disk] = shelf
return disk_to_shelf_map.get(disk_uid)
disks_converted = []
@@ -81,8 +87,9 @@ def check_netapp_api_disk_summary(_no_item, params, info):
disk_info += " (Shelf: %s, Bay %s)" % (shelf_uid, disk.get("bay"))
disk['identifier'] = disk_info
disk['type'] = False
- raid_type = disk.get("raid-type")
- if disk.get("raid-state", "") == "broken":
+ raid_type = disk.get("raid-type")
+ raid_state = disk.get("raid-state")
+ if raid_state == "broken":
disk['state'] = 'failed'
elif disk.get("prefailed", "false") not in [ "false", "None" ]:
disk['state'] = 'prefailed'
@@ -90,7 +97,7 @@ def check_netapp_api_disk_summary(_no_item, params, info):
disk['type'] = 'parity'
elif raid_type == "data":
disk['type'] = 'data'
- elif raid_type == "spare":
+ elif raid_state == "spare":
disk['state'] = "spare"
else:
disk['state'] = 'ok'
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 8841581..10eed13 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -6236,20 +6236,32 @@ register_check_parameters(
subgroup_storage,
"netapp_disks",
_("Filer Disk Levels (netapp, ibm svc)"),
- Dictionary(
- elements = [
- ( "broken_spare_ratio",
- Tuple(
- title = _("Broken to spare ratio"),
- help = _("You can set a limit to the broken to spare disk ratio. "
- "The ratio is calculated with <i>broken / (broken + spare)</i>."),
- elements = [
- Percentage(title = _("Warning at or above"), default_value = 1.0),
- Percentage(title = _("Critical at or above"), default_value = 50.0),
- ]
- )),
- ],
- optional_keys = False
+ Transform(
+ Dictionary(
+ elements = [
+ ( "failed_spare_ratio",
+ Tuple(
+ title = _("Failed to spare ratio"),
+ help = _("You can set a limit to the failed to spare disk ratio. "
+ "The ratio is calculated with <i>spare / (failed + spare)</i>."),
+ elements = [
+ Percentage(title = _("Warning at or above"), default_value = 1.0),
+ Percentage(title = _("Critical at or above"), default_value = 50.0),
+ ]
+ )),
+ ( "offline_spare_ratio",
+ Tuple(
+ title = _("Offline to spare ratio"),
+ help = _("You can set a limit to the offline to spare disk ratio. "
+ "The ratio is calculated with <i>spare / (offline + spare)</i>."),
+ elements = [
+ Percentage(title = _("Warning at or above"), default_value = 1.0),
+ Percentage(title = _("Critical at or above"), default_value = 50.0),
+ ]
+ )),
+ ],
+ ),
+ forth = lambda a: "broken_spare_ratio" in a and {"failed_spare_ratio": a["broken_spare_ratio"]} or a
),
None,
match_type = "dict",
Module: check_mk
Branch: master
Commit: e9b329e788b1ff135b94e9ee15ee6b571f1cbe97
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e9b329e788b1ff…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Jul 13 14:31:21 2015 +0200
#2459 FIX Preventing caching of all HTTP requests to dynamic pages (*.py)
Especially when opening Check_MK GUI using some kind of proxy or traffic
optimizer it might have happened that those devices were serving cached
(outdated) pages to the user. This was done because the Check_MK GUI
did not set the HTTP headers correctly (when using form based authentication).
This has been fixed now by always setting "Cache-Control: no-cache" for
all dynamic created pages.
---
.werks/2459 | 15 +++++++++++++++
ChangeLog | 1 +
web/htdocs/html_mod_python.py | 10 ++++++----
web/htdocs/index.py | 4 ++++
web/htdocs/main.py | 4 ----
5 files changed, 26 insertions(+), 8 deletions(-)
diff --git a/.werks/2459 b/.werks/2459
new file mode 100644
index 0000000..b9a7e37
--- /dev/null
+++ b/.werks/2459
@@ -0,0 +1,15 @@
+Title: Preventing caching of all HTTP requests to dynamic pages (*.py)
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i3
+Date: 1436790538
+
+Especially when opening Check_MK GUI using some kind of proxy or traffic
+optimizer it might have happened that those devices were serving cached
+ (outdated) pages to the user. This was done because the Check_MK GUI
+did not set the HTTP headers correctly (when using form based authentication).
+This has been fixed now by always setting "Cache-Control: no-cache" for
+all dynamic created pages.
diff --git a/ChangeLog b/ChangeLog
index 7ff1e43..9745555 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -66,6 +66,7 @@
* 2393 FIX: Fixed exception "user_confdir" not set in case of exceptions during login
* 1263 FIX: Fixed handling of urls in views...
* 2396 FIX: LDAP: Fixed handling of LDAP trees having special chars in the path (e.g. in OU names)...
+ * 2459 FIX: Preventing caching of all HTTP requests to dynamic pages (*.py)...
WATO:
* 2365 Removed old deprecated notification global options for plain emails...
diff --git a/web/htdocs/html_mod_python.py b/web/htdocs/html_mod_python.py
index 6a0c6f5..94df0f8 100644
--- a/web/htdocs/html_mod_python.py
+++ b/web/htdocs/html_mod_python.py
@@ -80,11 +80,9 @@ class html_mod_python(htmllib.html):
c.expires = expires
if not self.req.headers_out.has_key("Set-Cookie"):
- self.req.headers_out.add("Cache-Control", 'no-cache="set-cookie"')
- self.req.err_headers_out.add("Cache-Control", 'no-cache="set-cookie"')
+ self.set_http_header("Cache-Control", 'no-cache="set-cookie"')
- self.req.headers_out.add("Set-Cookie", str(c))
- self.req.err_headers_out.add("Set-Cookie", str(c))
+ self.set_http_header("Set-Cookie", str(c))
def del_cookie(self, varname):
self.set_cookie(varname, '', time.time() - 60)
@@ -159,6 +157,10 @@ class html_mod_python(htmllib.html):
# Needs to set both, headers_out and err_headers_out to be sure to send
# the header on all responses
+ #
+ # FIXME: err_headers_out are sent out when a HTTP error occures (which states are treated as "errors"?)
+ # AND when no error occures. headers_out is sent out in case of HTTP 200 (only?). This leads to duplicated
+ # HTTP headers in regular cases. Should be avoided - clean it up!
def set_http_header(self, key, val):
self.req.headers_out.add(key, val)
self.req.err_headers_out.add(key, val)
diff --git a/web/htdocs/index.py b/web/htdocs/index.py
index e411dd0..50b22f2 100644
--- a/web/htdocs/index.py
+++ b/web/htdocs/index.py
@@ -98,6 +98,10 @@ def handler(req, fields = None, profiling = True):
__builtin__.html = html
response_code = apache.OK
+ # Disable caching for all our pages as they are mostly dynamically generated,
+ # user related and are requred to be up-to-date on every refresh
+ html.set_http_header("Cache-Control", "no-cache")
+
try:
# Ajax-Functions want no HTML output in case of an error but
# just a plain server result code of 500
diff --git a/web/htdocs/main.py b/web/htdocs/main.py
index a89ad03..2ce6dd8 100644
--- a/web/htdocs/main.py
+++ b/web/htdocs/main.py
@@ -39,10 +39,6 @@ def page_index():
if start_url.startswith('javascript:'):
start_url = default_start_url
- # Do not cache the index page -> caching problems when page is accessed
- # while not logged in
- #html.req.headers_out.add("Cache-Control", "max-age=7200, public");
- html.req.headers_out.add("Cache-Control", "no-cache");
if "%s" in config.page_heading:
heading = config.page_heading % (config.site(defaults.omd_site).get('alias', _("Multisite")))
else:
Module: check_mk
Branch: master
Commit: 4feacf7010045301bc612de55f440ccf9817bbc0
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4feacf70100453…
Author: Goetz Golla <gg(a)mathias-kettner.de>
Date: Mon Jul 13 12:56:27 2015 +0200
update of online help text
---
mkeventd/web/plugins/wato/mkeventd.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/mkeventd/web/plugins/wato/mkeventd.py b/mkeventd/web/plugins/wato/mkeventd.py
index f53300e..f0d8beb 100644
--- a/mkeventd/web/plugins/wato/mkeventd.py
+++ b/mkeventd/web/plugins/wato/mkeventd.py
@@ -679,8 +679,10 @@ vs_mkeventd_rule = Dictionary(
"groups in the text to match, then you can use the placeholders "
"<tt>\\1</tt>, <tt>\\2</tt>, etc. for inserting the first, second "
"etc matching group.") +
- _("The placeholder <tt>\\0</tt> will be replaced by the original host name. "
- "This allows you to add new information in front or at the end."),
+ _("The placeholder <tt>\\0</tt> will be replaced by the original Text "
+ "to Match. Note that as an alternative, you may also use the rule "
+ "Hostname translation for Incoming Messages in the Global Settings "
+ "of the EC to accomplish your task."),
allow_empty = False,
attrencode = True,
)