Module: check_mk
Branch: master
Commit: 612528039e8a3a32b51c9bd7532f95cf03262e90
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=612528039e8a3a…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Aug 24 15:32:06 2011 +0200
Fix sorter host_problems
---
web/plugins/views/sorters.py | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/web/plugins/views/sorters.py b/web/plugins/views/sorters.py
index 6be49f7..b2a3836 100644
--- a/web/plugins/views/sorters.py
+++ b/web/plugins/views/sorters.py
@@ -177,7 +177,6 @@ declare_1to1_sorter("host_flapping",
cmp_simple_number)
declare_1to1_sorter("host_is_active", cmp_simple_number)
declare_1to1_sorter("host_in_downtime", cmp_simple_number)
declare_1to1_sorter("host_acknowledged", cmp_simple_number)
-declare_1to1_sorter("num_problems", cmp_simple_number)
declare_1to1_sorter("num_services", cmp_simple_number)
declare_1to1_sorter("num_services_ok", cmp_simple_number)
declare_1to1_sorter("num_services_warn", cmp_simple_number)
@@ -190,6 +189,16 @@ declare_1to1_sorter("host_group_memberlist",
cmp_string_list)
declare_1to1_sorter("host_contacts", cmp_string_list)
declare_1to1_sorter("host_contact_groups", cmp_string_list)
+def cmp_host_problems(r1, r2):
+ return cmp(r1["host_num_services"] - r1["host_num_services_ok"] -
r1["host_num_services_pending"],
+ r2["host_num_services"] - r2["host_num_services_ok"] -
r2["host_num_services_pending"])
+
+multisite_sorters["num_problems"] = {
+ "title" : _("Number of problems"),
+ "columns" : [ "host_num_services",
"host_num_services_ok", "host_num_services_pending" ],
+ "cmp" : cmp_host_problems,
+}
+
# Hostgroup
declare_1to1_sorter("hg_num_services", cmp_simple_number)
declare_1to1_sorter("hg_num_services_ok", cmp_simple_number)