Module: check_mk
Branch: master
Commit: 185cdb4c809e8f3b32ac8e6e1d007caa902f08a6
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=185cdb4c809e8f…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Dec 4 09:18:33 2014 +0100
#1619 FIX Renamed "Hostgroups" and "Servicegroups" views to "Host Groups" and "Service Groups"
---
.werks/1619 | 9 +++++++++
ChangeLog | 11 ++++++-----
web/plugins/views/builtin.py | 28 +++++++++++++---------------
3 files changed, 28 insertions(+), 20 deletions(-)
diff --git a/.werks/1619 b/.werks/1619
new file mode 100644
index 0000000..7b75410
--- /dev/null
+++ b/.werks/1619
@@ -0,0 +1,9 @@
+Title: Renamed "Hostgroups" and "Servicegroups" views to "Host Groups" and "Service Groups"
+Level: 1
+Component: multisite
+Compatible: compat
+Version: 1.2.5i7
+Date: 1417681030
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 8c35b8a..246f486 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -32,10 +32,10 @@
* 1518 raritan_pdu_inlet, raritan_pdu_inlet_summary: Modified existing check to give one item per phase and support setting levels....
NOTE: Please refer to the migration notes!
* 1592 AIX: New Plugin to monitor errpt in logwatch style...
- * 1594 ibm_svc_host: Can now be set to be always OK...
- * 1595 esx_vsphere_objects_count: New Check to Ouput the number of VMs
* 1565 mem.win: set default levels for page file to 80%/90%
* 1608 zpool_status: Add an overall state check (thx to Craig Cook)...
+ * 1594 ibm_svc_host: Can now be set to be always OK...
+ * 1595 esx_vsphere_objects_count: New Check to Ouput the number of VMs
* 1567 postfix_mailq: speedup in Linux agent for large mail queues...
* 1611 mssql.vbs: Supporting SQL-Server 2014 now
* 1568 f5_bigip_cluster_v11: new check for F5 cluster status for firmware version 11
@@ -67,9 +67,6 @@
* 1572 FIX: Sample configs, plugins etc. for windows agent use windows linebreaks now...
* 1575 FIX: vSphere Monitoring works with RedHat 5.x now...
* 1584 FIX: winperf_if: Fixed checks of interfaces with equal names but one with index...
- * 1593 FIX: IBM SVC Checks: The Service Descriptions not longer contain IBM SVC as prefix...
- NOTE: Please refer to the migration notes!
- * 1596 FIX: etherbox: Fix for the inventory in case of not connected temperature sensors...
* 1590 FIX: printer_supply_ricoh: Fixed broken check
* 1591 FIX: netapp_volumes: The state mixed_raid_type is now treated as non-critical state
* 1602 FIX: dell_om_esmlog: Fixed typo in plugin output
@@ -77,10 +74,13 @@
* 1604 FIX: mysql_slave: Dealing with situation where connection with master is lost
* 1563 FIX: Reworked configuration of process monitoring...
NOTE: Please refer to the migration notes!
+ * 1593 FIX: IBM SVC Checks: The Service Descriptions not longer contain IBM SVC as prefix...
+ NOTE: Please refer to the migration notes!
* 1564 FIX: check_mk_agent.linux: fix situation where async plugin is not executed after crash...
* 1609 FIX: zpool_status: fix problem when the zpool has a separate log or cache device...
* 1566 FIX: 3ware_disks: consider VERIFYING state as OK now...
* 1612 FIX: job: Fixed wrong reported start time for running jobs
+ * 1596 FIX: etherbox: Fix for the inventory in case of not connected temperature sensors...
* 1571 FIX: check_mk_agent.linux: fix output of lnx_if on Ubuntu 8.04 (on older kernels), repairs tcp_conn_stats...
* 1622 FIX: megaraid_bbu: handle case isSOHGood and consider it as critical...
* 1617 FIX: lnx_if: Deal with data provided by cluster host
@@ -132,6 +132,7 @@
* 1605 FIX: Fixed perfometer of check check_mk-printer_supply_ricoh
* 1607 FIX: check_http: Fixed broken links in escaped plugin output
* 1614 FIX: Fixed wrong URL in webapi.py documentation
+ * 1619 FIX: Renamed "Hostgroups" and "Servicegroups" views to "Host Groups" and "Service Groups"
WATO:
* 1170 Added buttons to move rules to top/bottom of the list to ruleset edit dialog
diff --git a/web/plugins/views/builtin.py b/web/plugins/views/builtin.py
index e1ac028..41e3a9f 100644
--- a/web/plugins/views/builtin.py
+++ b/web/plugins/views/builtin.py
@@ -935,8 +935,8 @@ multisite_builtin_views.update({
'sorters': [('site', False),
('hostgroup', False),
('site_host', False)],
- 'title': _('Hostgroups (Grid)'),
- 'topic': _('Hostgroups')},
+ 'title': _('Host Groups (Grid)'),
+ 'topic': _('Host Groups')},
'hostgroups': {'browser_reload': 30,
'column_headers': 'pergroup',
'datasource': 'hostgroups',
@@ -965,8 +965,8 @@ multisite_builtin_views.update({
'public': True,
'show_filters': ['hostgroupnameregex', 'hostgroupvisibility'],
'sorters': [],
- 'title': _('Hostgroups (Summary)'),
- 'topic': _('Hostgroups') },
+ 'title': _('Host Groups (Summary)'),
+ 'topic': _('Host Groups') },
'hostproblems': {'browser_reload': 30,
'column_headers': 'pergroup',
@@ -1052,8 +1052,8 @@ multisite_builtin_views.update({
'sorters': [('site', False),
('hostgroup', False),
('site_host', False)],
- 'title': _('Hostgroups'),
- 'topic': _('Hostgroups')},
+ 'title': _('Host Groups'),
+ 'topic': _('Host Groups')},
'hoststatus': {'browser_reload': 30,
'column_headers': 'pergroup',
'datasource': 'hosts',
@@ -1486,7 +1486,7 @@ multisite_builtin_views.update({
('site_host', False),
('svcdescr', False)],
'title': _('Services by group'),
- 'topic': _('Servicegroups')},
+ 'topic': _('Service Groups')},
'svcbyhgroups': {'browser_reload': 30,
'column_headers': 'pergroup',
'datasource': 'servicesbyhostgroup',
@@ -1517,7 +1517,7 @@ multisite_builtin_views.update({
'svcgroups': {'browser_reload': 30,
'column_headers': 'pergroup',
'datasource': 'servicegroups',
- 'description': _('A short overview over all servicegroups, without explicity listing of the actual hosts and services'),
+ 'description': _('A short overview over all service groups, without explicity listing of the actual hosts and services'),
'group_painters': [('sitealias', 'sitehosts')],
'hard_filters': [],
'hard_filtervars': [],
@@ -1538,12 +1538,12 @@ multisite_builtin_views.update({
'public': True,
'show_filters': ['servicegroupnameregex'],
'sorters': [],
- 'title': _('Servicegroups (Summary)'),
- 'topic': _('Servicegroups')},
+ 'title': _('Service Groups (Summary)'),
+ 'topic': _('Service Groups')},
'svcgroups_grid': {'browser_reload': 30,
'column_headers': 'pergroup',
'datasource': 'servicegroups',
- 'description': _('A short overview over all servicegroups, without explicity listing of the actual hosts and services'),
+ 'description': _('A short overview over all service groups, without explicity listing of the actual hosts and services'),
'group_painters': [('sitealias', 'sitehosts')],
'hard_filters': [],
'hard_filtervars': [],
@@ -1560,8 +1560,8 @@ multisite_builtin_views.update({
'public': True,
'show_filters': [],
'sorters': [],
- 'title': _('Servicegroups (Grid)'),
- 'topic': _('Servicegroups'),
+ 'title': _('Service Groups (Grid)'),
+ 'topic': _('Service Groups'),
},
'svcproblems': {
'browser_reload': 30,
@@ -3148,8 +3148,6 @@ multisite_builtin_views.update({
('host', None, ''),
('log_state', None, ''),
('log_plugin_output', None, '')],
- 'play_sounds': False,
- 'public': True,
'show_filters': ['log_plugin_output', 'logtime', 'log_state'],
'sorters': [('log_time', True), ('log_lineno', True)],
'title': _('Service Notifications'),
Module: check_mk
Branch: master
Commit: 5e22035efcff6a9c485e947dcdfbeb0f3fa41752
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5e22035efcff6a…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Dec 4 10:09:40 2014 +0100
#1625 FIX Safely handle characters that have a special meaning in regexes when creating service-specific rules
When you click an icon or button for creating a service specific rule in
WATO then characters, that have a special meaning in regular expressions,
are now correctly escaped with backslashes. These characters are: <tt>(</tt>,
<tt>)</tt>, <tt>.</tt>, <tt>^</tt>, <tt>$</tt>, <tt>[</tt>, <tt>]</tt>,
<tt>{</tt>, <tt>}</tt>, <tt>+</tt> and <tt>*</tt>
---
.werks/1625 | 13 +++++++++++++
ChangeLog | 1 +
web/htdocs/lib.py | 8 ++++++++
web/htdocs/wato.py | 6 ++----
4 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/.werks/1625 b/.werks/1625
new file mode 100644
index 0000000..bffa903
--- /dev/null
+++ b/.werks/1625
@@ -0,0 +1,13 @@
+Title: Safely handle characters that have a special meaning in regexes when creating service-specific rules
+Level: 1
+Component: wato
+Compatible: compat
+Version: 1.2.5i7
+Date: 1417684044
+Class: fix
+
+When you click an icon or button for creating a service specific rule in
+WATO then characters, that have a special meaning in regular expressions,
+are now correctly escaped with backslashes. These characters are: <tt>(</tt>,
+<tt>)</tt>, <tt>.</tt>, <tt>^</tt>, <tt>$</tt>, <tt>[</tt>, <tt>]</tt>,
+<tt>{</tt>, <tt>}</tt>, <tt>+</tt> and <tt>*</tt>
diff --git a/ChangeLog b/ChangeLog
index 90a0758..ef01d0b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -159,6 +159,7 @@
* 1576 FIX: SNMP Community host attribute is now visible for IE<=8...
* 1588 FIX: Renamed SNMP communities rule to SNMP credentials
* 1589 FIX: Restructured SNMP credentials rule specification...
+ * 1625 FIX: Safely handle characters that have a special meaning in regexes when creating service-specific rules...
Notifications:
* 1512 Bulk notification can now be grouped according to custom macro values...
diff --git a/web/htdocs/lib.py b/web/htdocs/lib.py
index b372d7f..9da5812 100644
--- a/web/htdocs/lib.py
+++ b/web/htdocs/lib.py
@@ -399,6 +399,14 @@ def regex(r):
regex_cache[r] = rx
return rx
+def escape_regex_chars(text):
+ escaped = ""
+ for c in text:
+ if c in '().^$[]{}+*\\':
+ escaped += '\\'
+ escaped += c
+ return escaped
+
# Splits a word into sequences of numbers and non-numbers.
# Creates a tuple from these where the number are converted
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index d941df6..8c9f57d 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -3198,8 +3198,6 @@ def show_service_table(host, firsttime):
else:
html.button("_show_parameters", _("Show Check Parameters"))
-
-
html.hidden_fields()
if html.var("_scan"):
html.hidden_field("_scan", "on")
@@ -14600,10 +14598,10 @@ def get_rule_conditions(ruleset):
return tag_list, host_list, item_list
-
def date_and_user():
return time.strftime("%F", time.localtime()) + " " + config.user_id + ": "
+
def mode_edit_rule(phase, new = False):
# Due to localization this cannot be defined in the global context!
vs_rule_options = Dictionary(
@@ -14670,7 +14668,7 @@ def mode_edit_rule(phase, new = False):
host = html.var("host")
item = html.has_var("item") and mk_eval(html.var("item")) or NO_ITEM
try:
- rule = create_rule(rulespec, host, item)
+ rule = create_rule(rulespec, host, escape_regex_chars(item))
except Exception, e:
if phase != "action":
html.message(_("Cannot create rule: %s") % e)
Module: check_mk
Branch: master
Commit: 33c15fa21c98109d9828ade3e4a4c24653a0e678
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=33c15fa21c9810…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Dec 4 09:39:51 2014 +0100
#1624 FIX Remove illegal characters from service descriptions of active checks
This fix removes illegal characters like brackets from service descriptions
of configured active checks (<tt>legacy_checks</tt>, <tt>custom_checks</tt> and
<tt>active_checks</tt>). These characters are disallowed by Nagios and will
lead to configuration errors.
---
.werks/1624 | 12 ++++++++++++
ChangeLog | 11 ++++++-----
modules/check_mk.py | 12 +++++++++---
3 files changed, 27 insertions(+), 8 deletions(-)
diff --git a/.werks/1624 b/.werks/1624
new file mode 100644
index 0000000..8f43465
--- /dev/null
+++ b/.werks/1624
@@ -0,0 +1,12 @@
+Title: Remove illegal characters from service descriptions of active checks
+Level: 1
+Component: core
+Compatible: compat
+Version: 1.2.5i7
+Date: 1417682307
+Class: fix
+
+This fix removes illegal characters like brackets from service descriptions
+of configured active checks (<tt>legacy_checks</tt>, <tt>custom_checks</tt> and
+<tt>active_checks</tt>). These characters are disallowed by Nagios and will
+lead to configuration errors.
diff --git a/ChangeLog b/ChangeLog
index 8c35b8a..90a0758 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,7 @@
* 1545 FIX: Check_MK Inventory check is now resulting in correct state on duplicate host
* 1555 FIX: Improved validation on timeperiod references of non existing periods...
* 1574 FIX: Hosts named like used python modules do not break precompiled checks anymore...
+ * 1624 FIX: Remove illegal characters from service descriptions of active checks...
Checks & Agents:
* 1197 climaveneta_temp: New check for temperature sensors on Climaveneta clima devices
@@ -32,10 +33,10 @@
* 1518 raritan_pdu_inlet, raritan_pdu_inlet_summary: Modified existing check to give one item per phase and support setting levels....
NOTE: Please refer to the migration notes!
* 1592 AIX: New Plugin to monitor errpt in logwatch style...
- * 1594 ibm_svc_host: Can now be set to be always OK...
- * 1595 esx_vsphere_objects_count: New Check to Ouput the number of VMs
* 1565 mem.win: set default levels for page file to 80%/90%
* 1608 zpool_status: Add an overall state check (thx to Craig Cook)...
+ * 1594 ibm_svc_host: Can now be set to be always OK...
+ * 1595 esx_vsphere_objects_count: New Check to Ouput the number of VMs
* 1567 postfix_mailq: speedup in Linux agent for large mail queues...
* 1611 mssql.vbs: Supporting SQL-Server 2014 now
* 1568 f5_bigip_cluster_v11: new check for F5 cluster status for firmware version 11
@@ -67,9 +68,6 @@
* 1572 FIX: Sample configs, plugins etc. for windows agent use windows linebreaks now...
* 1575 FIX: vSphere Monitoring works with RedHat 5.x now...
* 1584 FIX: winperf_if: Fixed checks of interfaces with equal names but one with index...
- * 1593 FIX: IBM SVC Checks: The Service Descriptions not longer contain IBM SVC as prefix...
- NOTE: Please refer to the migration notes!
- * 1596 FIX: etherbox: Fix for the inventory in case of not connected temperature sensors...
* 1590 FIX: printer_supply_ricoh: Fixed broken check
* 1591 FIX: netapp_volumes: The state mixed_raid_type is now treated as non-critical state
* 1602 FIX: dell_om_esmlog: Fixed typo in plugin output
@@ -77,10 +75,13 @@
* 1604 FIX: mysql_slave: Dealing with situation where connection with master is lost
* 1563 FIX: Reworked configuration of process monitoring...
NOTE: Please refer to the migration notes!
+ * 1593 FIX: IBM SVC Checks: The Service Descriptions not longer contain IBM SVC as prefix...
+ NOTE: Please refer to the migration notes!
* 1564 FIX: check_mk_agent.linux: fix situation where async plugin is not executed after crash...
* 1609 FIX: zpool_status: fix problem when the zpool has a separate log or cache device...
* 1566 FIX: 3ware_disks: consider VERIFYING state as OK now...
* 1612 FIX: job: Fixed wrong reported start time for running jobs
+ * 1596 FIX: etherbox: Fix for the inventory in case of not connected temperature sensors...
* 1571 FIX: check_mk_agent.linux: fix output of lnx_if on Ubuntu 8.04 (on older kernels), repairs tcp_conn_stats...
* 1622 FIX: megaraid_bbu: handle case isSOHGood and consider it as critical...
* 1617 FIX: lnx_if: Deal with data provided by cluster host
diff --git a/modules/check_mk.py b/modules/check_mk.py
index f1afbe8..3820fb9 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -1332,6 +1332,11 @@ def exit_code_spec(hostname):
return spec
+# Remove illegal characters from a service description
+def sanitize_service_description(descr):
+ return "".join([ c for c in descr if c not in nagios_illegal_chars ])
+
+
def service_description(check_type, item):
if check_type not in check_info:
if item:
@@ -1354,7 +1359,7 @@ def service_description(check_type, item):
if type(item) == str:
# Remove characters from item name that are banned by Nagios
- item_safe = "".join([ c for c in item if c not in nagios_illegal_chars ])
+ item_safe = sanitize_service_description(item)
if "%s" not in descr_format:
descr_format += " %s"
return (descr_format % (item_safe,)).strip()
@@ -2290,6 +2295,7 @@ define service {
if len(legchecks) > 0:
outfile.write("\n\n# Legacy checks\n")
for command, description, has_perfdata in legchecks:
+ description = sanitize_service_description(description)
if do_omit_service(hostname, description):
continue
@@ -2341,8 +2347,8 @@ define service {
g_hostname = hostname
has_perfdata = act_info.get('has_perfdata', False)
- description = act_info["service_description"](params)
description = description.replace('$HOSTNAME$', g_hostname)
+ description = sanitize_service_description(act_info["service_description"](params))
if do_omit_service(hostname, description):
continue
@@ -2395,7 +2401,7 @@ define service {
# "command_name" (optional) Name of Monitoring command to define. If missing,
# we use "check-mk-custom"
# "has_perfdata" (optional) If present and True, we activate perf_data
- description = entry["service_description"]
+ description = sanitize_service_description(entry["service_description"])
has_perfdata = entry.get("has_perfdata", False)
command_name = entry.get("command_name", "check-mk-custom")
command_line = entry.get("command_line", "")