Module: check_mk
Branch: master
Commit: c628721bc1c00e6bcf78d3fa500b5270918ae020
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c628721bc1c00e…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Sat Aug 20 21:45:09 2011 +0200
FIX: correctly sort log views in case of multi site setups
---
ChangeLog | 2 ++
web/plugins/views/builtin.py | 20 ++++++++++----------
web/plugins/views/datasources.py | 3 +--
web/plugins/views/painters.py | 6 ++++++
web/plugins/views/sorters.py | 4 ++++
5 files changed, 23 insertions(+), 12 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index feae8e4..ab0b783 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -30,6 +30,8 @@
Multisite:
* FIX: reschedule now works for host names containing spaces
+ * FIX: correctly sort log views in case of multi site setups
+ * New sorters for time and line number of logfile entries
* Bookmarks snapin: save relative URLs whenever possible
* Man-Pages of Check_MK checks shown in Multisite honor OMD's local hierarchy
* nicer output of substates, translate (!) and (!!) into HTML code
diff --git a/web/plugins/views/builtin.py b/web/plugins/views/builtin.py
index 65a17f5..fe8981d 100644
--- a/web/plugins/views/builtin.py
+++ b/web/plugins/views/builtin.py
@@ -1579,7 +1579,7 @@ multisite_builtin_views.update({
'serviceregex',
'logtime',
'log_plugin_output'],
- 'sorters': [],
+ 'sorters': [('log_time', True), ('log_lineno',
True)],
'title': _('Host- and Service events'),
'topic': _('Other')},
@@ -1614,7 +1614,7 @@ multisite_builtin_views.update({
'play_sounds': False,
'public': True,
'show_filters': ['logtime'],
- 'sorters': [],
+ 'sorters': [('log_time', True), ('log_lineno',
True)],
'title': _('Events of host')},
'svcevents': {'browser_reload': 0,
'column_headers': 'pergroup',
@@ -1645,7 +1645,7 @@ multisite_builtin_views.update({
'play_sounds': False,
'public': True,
'show_filters': ['logtime'],
- 'sorters': [],
+ 'sorters': [('log_time', True), ('log_lineno',
True)],
'title': _('Events of service')},
'hostsvcevents': {'browser_reload': 0,
'column_headers': 'pergroup',
@@ -1678,7 +1678,7 @@ multisite_builtin_views.update({
'play_sounds': False,
'public': True,
'show_filters': ['logtime'],
- 'sorters': [],
+ 'sorters': [('log_time', True), ('log_lineno',
True)],
'title': _('Events of host & services')},
'logfile': {'browser_reload': 0,
'column_headers': 'off',
@@ -1730,7 +1730,7 @@ multisite_builtin_views.update({
'serviceregex',
'opthostgroup',
'logtime'],
- 'sorters': [],
+ 'sorters': [('log_time', True), ('log_lineno',
True)],
'title': _('Search Global Logfile'),
'topic': _('Other')},
@@ -2443,7 +2443,7 @@ multisite_builtin_views.update({
'show_filters': ['serviceregex',
'log_plugin_output',
'logtime'],
- 'sorters': [],
+ 'sorters': [('log_time', True),
('log_lineno', True)],
'title': _('Notifications of host'),
'topic': _('Other')},
'hostsvcnotifications': {'browser_reload': 0,
@@ -2490,7 +2490,7 @@ multisite_builtin_views.update({
'show_filters': ['serviceregex',
'log_plugin_output',
'logtime'],
- 'sorters': [],
+ 'sorters': [('log_time', True),
('log_lineno', True)],
'title': _('Notifications of host &
services'),
'topic': _('Other')},
'notifications': {'browser_reload': 0,
@@ -2539,7 +2539,7 @@ multisite_builtin_views.update({
'serviceregex',
'log_plugin_output',
'logtime'],
- 'sorters': [],
+ 'sorters': [('log_time', True), ('log_lineno',
True)],
'title': _('Host- and Service notifications'),
'topic': _('Other')},
'svcnotifications': {'browser_reload': 0,
@@ -2579,7 +2579,7 @@ multisite_builtin_views.update({
'play_sounds': False,
'public': True,
'show_filters': ['log_plugin_output',
'logtime'],
- 'sorters': [],
+ 'sorters': [('log_time', True),
('log_lineno', True)],
'title': _('Service Notifications'),
'topic': _('Other')},
'contactnotifications': {'browser_reload': 0,
@@ -2627,7 +2627,7 @@ multisite_builtin_views.update({
'serviceregex',
'log_plugin_output',
'logtime'],
- 'sorters': [],
+ 'sorters': [('log_time', True),
('log_lineno', True)],
'title': _('Notifications of contact'),
'topic': _('Other')},
})
diff --git a/web/plugins/views/datasources.py b/web/plugins/views/datasources.py
index 2e9b360..313f7b6 100644
--- a/web/plugins/views/datasources.py
+++ b/web/plugins/views/datasources.py
@@ -20,8 +20,7 @@
# 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,
+# 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.
diff --git a/web/plugins/views/painters.py b/web/plugins/views/painters.py
index c556be6..26cbe6b 100644
--- a/web/plugins/views/painters.py
+++ b/web/plugins/views/painters.py
@@ -1668,6 +1668,12 @@ multisite_painters["log_time"] = {
"options" : [ "ts_format", "ts_date" ],
"paint" : lambda row: paint_age(row["log_time"], True, 3600 *
24)
}
+multisite_painters["log_lineno"] = {
+ "title" : _("Log: line number in log file"),
+ "short" : _("Line"),
+ "columns" : ["log_lineno"],
+ "paint" : lambda row: ("number",
str(row["log_lineno"]))
+}
multisite_painters["log_date"] = {
"title" : _("Log: day of entry"),
diff --git a/web/plugins/views/sorters.py b/web/plugins/views/sorters.py
index 1edffd6..ed2fc0e 100644
--- a/web/plugins/views/sorters.py
+++ b/web/plugins/views/sorters.py
@@ -117,6 +117,10 @@ declare_simple_sorter("stateage", _("Service state
age"), "service_last_
declare_simple_sorter("servicegroup", _("Servicegroup"),
"servicegroup_alias", cmp_simple_string)
declare_simple_sorter("hostgroup", _("Hostgroup"),
"hostgroup_alias", cmp_simple_string)
+# Log
+declare_simple_sorter("log_time", _("Time of log entry"),
"log_time", cmp_simple_number)
+declare_simple_sorter("log_lineno", _("Number of line in logfile"),
"log_lineno", cmp_simple_number)
+
# Comments
declare_simple_sorter("comment_author", _("Comment author"),
"comment_author", cmp_simple_string)
declare_simple_sorter("comment_type", _("Comment type"),
"comment_type", cmp_simple_number)