From 45fc7688137c410e0f2b62789834062490bbb401 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Wed, 24 Sep 2014 19:33:05 +0200 Subject: [PATCH 01/10] StatusSummaryQuery: workaround for silly ZF fix This brings the tiny summaries back. Host- and servicegroups and TO are still broken. refs #7303 --- .../Backend/Ido/Query/StatusSummaryQuery.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatusSummaryQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatusSummaryQuery.php index 7d91f0f71d..75d3c17809 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatusSummaryQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatusSummaryQuery.php @@ -43,25 +43,25 @@ class StatusSummaryQuery extends IdoQuery 'servicestatussummary' => array( 'services_total' => 'SUM(CASE WHEN object_type = \'service\' THEN 1 ELSE 0 END)', 'services_problem' => 'SUM(CASE WHEN object_type = \'service\' AND state > 0 THEN 1 ELSE 0 END)', - 'services_problem_handled' => 'SUM(CASE WHEN object_type = \'service\' AND state > 0 AND (acknowledged + in_downtime + host_problem) > 0 THEN 1 ELSE 0 END)', - 'services_problem_unhandled' => 'SUM(CASE WHEN object_type = \'service\' AND state > 0 AND (acknowledged + in_downtime + host_problem) = 0 THEN 1 ELSE 0 END)', + 'services_problem_handled' => 'SUM(CASE WHEN object_type = \'service\' AND state > 0 AND acknowledged + in_downtime + host_problem > 0 THEN 1 ELSE 0 END)', + 'services_problem_unhandled' => 'SUM(CASE WHEN object_type = \'service\' AND state > 0 AND acknowledged + in_downtime + host_problem = 0 THEN 1 ELSE 0 END)', 'services_ok' => 'SUM(CASE WHEN object_type = \'service\' AND state = 0 THEN 1 ELSE 0 END)', 'services_ok_not_checked' => 'SUM(CASE WHEN object_type = \'service\' AND state = 0 AND is_active_checked = 0 AND is_passive_checked = 0 THEN 1 ELSE 0 END)', 'services_pending' => 'SUM(CASE WHEN object_type = \'service\' AND state = 99 THEN 1 ELSE 0 END)', 'services_pending_not_checked' => 'SUM(CASE WHEN object_type = \'service\' AND state = 99 AND is_active_checked = 0 AND is_passive_checked = 0 THEN 1 ELSE 0 END)', 'services_warning' => 'SUM(CASE WHEN object_type = \'service\' AND state = 1 THEN 1 ELSE 0 END)', - 'services_warning_handled' => 'SUM(CASE WHEN object_type = \'service\' AND state = 1 AND (acknowledged + in_downtime + host_problem) > 0 THEN 1 ELSE 0 END)', - 'services_warning_unhandled' => 'SUM(CASE WHEN object_type = \'service\' AND state = 1 AND (acknowledged + in_downtime + host_problem) = 0 THEN 1 ELSE 0 END)', + 'services_warning_handled' => 'SUM(CASE WHEN object_type = \'service\' AND state = 1 AND acknowledged + in_downtime + host_problem > 0 THEN 1 ELSE 0 END)', + 'services_warning_unhandled' => 'SUM(CASE WHEN object_type = \'service\' AND state = 1 AND acknowledged + in_downtime + host_problem = 0 THEN 1 ELSE 0 END)', 'services_warning_passive' => 'SUM(CASE WHEN object_type = \'service\' AND state = 1 AND is_passive_checked = 1 THEN 1 ELSE 0 END)', 'services_warning_not_checked' => 'SUM(CASE WHEN object_type = \'service\' AND state = 1 AND is_active_checked = 0 AND is_passive_checked = 0 THEN 1 ELSE 0 END)', 'services_critical' => 'SUM(CASE WHEN object_type = \'service\' AND state = 2 THEN 1 ELSE 0 END)', - 'services_critical_handled' => 'SUM(CASE WHEN object_type = \'service\' AND state = 2 AND (acknowledged + in_downtime + host_problem) > 0 THEN 1 ELSE 0 END)', - 'services_critical_unhandled' => 'SUM(CASE WHEN object_type = \'service\' AND state = 2 AND (acknowledged + in_downtime + host_problem) = 0 THEN 1 ELSE 0 END)', + 'services_critical_handled' => 'SUM(CASE WHEN object_type = \'service\' AND state = 2 AND acknowledged + in_downtime + host_problem > 0 THEN 1 ELSE 0 END)', + 'services_critical_unhandled' => 'SUM(CASE WHEN object_type = \'service\' AND state = 2 AND acknowledged + in_downtime + host_problem = 0 THEN 1 ELSE 0 END)', 'services_critical_passive' => 'SUM(CASE WHEN object_type = \'service\' AND state = 2 AND is_passive_checked = 1 THEN 1 ELSE 0 END)', 'services_critical_not_checked' => 'SUM(CASE WHEN object_type = \'service\' AND state = 2 AND is_active_checked = 0 AND is_passive_checked = 0 THEN 1 ELSE 0 END)', 'services_unknown' => 'SUM(CASE WHEN object_type = \'service\' AND state = 3 THEN 1 ELSE 0 END)', - 'services_unknown_handled' => 'SUM(CASE WHEN object_type = \'service\' AND state = 3 AND (acknowledged + in_downtime + host_problem) > 0 THEN 1 ELSE 0 END)', - 'services_unknown_unhandled' => 'SUM(CASE WHEN object_type = \'service\' AND state = 3 AND (acknowledged + in_downtime + host_problem) = 0 THEN 1 ELSE 0 END)', + 'services_unknown_handled' => 'SUM(CASE WHEN object_type = \'service\' AND state = 3 AND acknowledged + in_downtime + host_problem > 0 THEN 1 ELSE 0 END)', + 'services_unknown_unhandled' => 'SUM(CASE WHEN object_type = \'service\' AND state = 3 AND acknowledged + in_downtime + host_problem = 0 THEN 1 ELSE 0 END)', 'services_unknown_passive' => 'SUM(CASE WHEN object_type = \'service\' AND state = 3 AND is_passive_checked = 1 THEN 1 ELSE 0 END)', 'services_unknown_not_checked' => 'SUM(CASE WHEN object_type = \'service\' AND state = 3 AND is_active_checked = 0 AND is_passive_checked = 0 THEN 1 ELSE 0 END)', 'services_active' => 'SUM(CASE WHEN object_type = \'service\' AND is_active_checked = 1 THEN 1 ELSE 0 END)', From 98fa84bd177b1c7649d5543d5b98415cf9b4f290 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Wed, 24 Sep 2014 19:46:26 +0200 Subject: [PATCH 02/10] StatusSummaryQuery: one more quickfix Tactical overview works again right now refs #7303 --- .../Backend/Ido/Query/StatusSummaryQuery.php | 72 ++++++++++--------- 1 file changed, 40 insertions(+), 32 deletions(-) diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatusSummaryQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatusSummaryQuery.php index 75d3c17809..a311feedc5 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatusSummaryQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatusSummaryQuery.php @@ -72,39 +72,47 @@ class StatusSummaryQuery extends IdoQuery 'services_without_flap_detection' => 'SUM(CASE WHEN object_type = \'service\' AND is_allowed_to_flap = 0 THEN 1 ELSE 0 END)', 'services_flapping' => 'SUM(CASE WHEN object_type = \'service\' AND is_flapping = 1 THEN 1 ELSE 0 END)', +/* +NOTE: in case you might wonder, please see #7303. As a quickfix I did: - 'services_ok_on_ok_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND (host_state = 0 OR host_state = 99) AND state = 0 THEN 1 ELSE 0 END)', - 'services_ok_not_checked_on_ok_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND (host_state = 0 OR host_state = 99) AND state = 0 AND is_active_checked = 0 AND is_passive_checked = 0 THEN 1 ELSE 0 END)', - 'services_pending_on_ok_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND (host_state = 0 OR host_state = 99) AND state = 99 THEN 1 ELSE 0 END)', - 'services_pending_not_checked_on_ok_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND (host_state = 0 OR host_state = 99) AND state = 99 AND is_active_checked = 0 AND is_passive_checked = 0 THEN 1 ELSE 0 END)', - 'services_warning_handled_on_ok_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND (host_state = 0 OR host_state = 99) AND state = 1 AND acknowledged + in_downtime > 0 THEN 1 ELSE 0 END)', - 'services_warning_unhandled_on_ok_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND (host_state = 0 OR host_state = 99) AND state = 1 AND acknowledged + in_downtime = 0 THEN 1 ELSE 0 END)', - 'services_warning_passive_on_ok_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND (host_state = 0 OR host_state = 99) AND state = 1 AND is_passive_checked = 1 THEN 1 ELSE 0 END)', - 'services_warning_not_checked_on_ok_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND (host_state = 0 OR host_state = 99) AND state = 1 AND is_active_checked = 0 AND is_passive_checked = 0 THEN 1 ELSE 0 END)', - 'services_critical_handled_on_ok_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND (host_state = 0 OR host_state = 99) AND state = 2 AND acknowledged + in_downtime > 0 THEN 1 ELSE 0 END)', - 'services_critical_unhandled_on_ok_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND (host_state = 0 OR host_state = 99) AND state = 2 AND acknowledged + in_downtime = 0 THEN 1 ELSE 0 END)', - 'services_critical_passive_on_ok_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND (host_state = 0 OR host_state = 99) AND state = 2 AND is_passive_checked = 1 THEN 1 ELSE 0 END)', - 'services_critical_not_checked_on_ok_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND (host_state = 0 OR host_state = 99) AND state = 2 AND is_active_checked = 0 AND is_passive_checked = 0 THEN 1 ELSE 0 END)', - 'services_unknown_handled_on_ok_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND (host_state = 0 OR host_state = 99) AND state = 3 AND acknowledged + in_downtime > 0 THEN 1 ELSE 0 END)', - 'services_unknown_unhandled_on_ok_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND (host_state = 0 OR host_state = 99) AND state = 3 AND acknowledged + in_downtime = 0 THEN 1 ELSE 0 END)', - 'services_unknown_passive_on_ok_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND (host_state = 0 OR host_state = 99) AND state = 3 AND is_passive_checked = 1 THEN 1 ELSE 0 END)', - 'services_unknown_not_checked_on_ok_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND (host_state = 0 OR host_state = 99) AND state = 3 AND is_active_checked = 0 AND is_passive_checked = 0 THEN 1 ELSE 0 END)', - 'services_ok_on_problem_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND (host_state = 1 OR host_state = 2) AND state = 0 THEN 1 ELSE 0 END)', - 'services_ok_not_checked_on_problem_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND (host_state = 1 OR host_state = 2) AND state = 0 AND is_active_checked = 0 AND is_passive_checked = 0 THEN 1 ELSE 0 END)', - 'services_pending_on_problem_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND (host_state = 1 OR host_state = 2) AND state = 99 THEN 1 ELSE 0 END)', - 'services_pending_not_checked_on_problem_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND (host_state = 1 OR host_state = 2) AND state = 99 AND is_active_checked = 0 AND is_passive_checked = 0 THEN 1 ELSE 0 END)', - 'services_warning_handled_on_problem_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND (host_state = 1 OR host_state = 2) AND state = 1 AND acknowledged + in_downtime > 0 THEN 1 ELSE 0 END)', - 'services_warning_unhandled_on_problem_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND (host_state = 1 OR host_state = 2) AND state = 1 AND acknowledged + in_downtime = 0 THEN 1 ELSE 0 END)', - 'services_warning_passive_on_problem_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND (host_state = 1 OR host_state = 2) AND state = 1 AND is_passive_checked = 1 THEN 1 ELSE 0 END)', - 'services_warning_not_checked_on_problem_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND (host_state = 1 OR host_state = 2) AND state = 1 AND is_active_checked = 0 AND is_passive_checked = 0 THEN 1 ELSE 0 END)', - 'services_critical_handled_on_problem_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND (host_state = 1 OR host_state = 2) AND state = 2 AND acknowledged + in_downtime > 0 THEN 1 ELSE 0 END)', - 'services_critical_unhandled_on_problem_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND (host_state = 1 OR host_state = 2) AND state = 2 AND acknowledged + in_downtime = 0 THEN 1 ELSE 0 END)', - 'services_critical_passive_on_problem_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND (host_state = 1 OR host_state = 2) AND state = 2 AND is_passive_checked = 1 THEN 1 ELSE 0 END)', - 'services_critical_not_checked_on_problem_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND (host_state = 1 OR host_state = 2) AND state = 2 AND is_active_checked = 0 AND is_passive_checked = 0 THEN 1 ELSE 0 END)', - 'services_unknown_handled_on_problem_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND (host_state = 1 OR host_state = 2) AND state = 3 AND acknowledged + in_downtime > 0 THEN 1 ELSE 0 END)', - 'services_unknown_unhandled_on_problem_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND (host_state = 1 OR host_state = 2) AND state = 3 AND acknowledged + in_downtime = 0 THEN 1 ELSE 0 END)', - 'services_unknown_passive_on_problem_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND (host_state = 1 OR host_state = 2) AND state = 3 AND is_passive_checked = 1 THEN 1 ELSE 0 END)', - 'services_unknown_not_checked_on_problem_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND (host_state = 1 OR host_state = 2) AND state = 3 AND is_active_checked = 0 AND is_passive_checked = 0 THEN 1 ELSE 0 END)' +:%s/(host_state = 0 OR host_state = 99)/host_state != 1 AND host_state != 2/g +:%s/(host_state = 1 OR host_state = 2)/host_state != 0 AND host_state != 99/g + +We have to find a better solution here. + +*/ + 'services_ok_on_ok_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND host_state != 1 AND host_state != 2 AND state = 0 THEN 1 ELSE 0 END)', + 'services_ok_not_checked_on_ok_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND host_state != 1 AND host_state != 2 AND state = 0 AND is_active_checked = 0 AND is_passive_checked = 0 THEN 1 ELSE 0 END)', + 'services_pending_on_ok_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND host_state != 1 AND host_state != 2 AND state = 99 THEN 1 ELSE 0 END)', + 'services_pending_not_checked_on_ok_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND host_state != 1 AND host_state != 2 AND state = 99 AND is_active_checked = 0 AND is_passive_checked = 0 THEN 1 ELSE 0 END)', + 'services_warning_handled_on_ok_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND host_state != 1 AND host_state != 2 AND state = 1 AND acknowledged + in_downtime > 0 THEN 1 ELSE 0 END)', + 'services_warning_unhandled_on_ok_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND host_state != 1 AND host_state != 2 AND state = 1 AND acknowledged + in_downtime = 0 THEN 1 ELSE 0 END)', + 'services_warning_passive_on_ok_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND host_state != 1 AND host_state != 2 AND state = 1 AND is_passive_checked = 1 THEN 1 ELSE 0 END)', + 'services_warning_not_checked_on_ok_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND host_state != 1 AND host_state != 2 AND state = 1 AND is_active_checked = 0 AND is_passive_checked = 0 THEN 1 ELSE 0 END)', + 'services_critical_handled_on_ok_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND host_state != 1 AND host_state != 2 AND state = 2 AND acknowledged + in_downtime > 0 THEN 1 ELSE 0 END)', + 'services_critical_unhandled_on_ok_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND host_state != 1 AND host_state != 2 AND state = 2 AND acknowledged + in_downtime = 0 THEN 1 ELSE 0 END)', + 'services_critical_passive_on_ok_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND host_state != 1 AND host_state != 2 AND state = 2 AND is_passive_checked = 1 THEN 1 ELSE 0 END)', + 'services_critical_not_checked_on_ok_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND host_state != 1 AND host_state != 2 AND state = 2 AND is_active_checked = 0 AND is_passive_checked = 0 THEN 1 ELSE 0 END)', + 'services_unknown_handled_on_ok_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND host_state != 1 AND host_state != 2 AND state = 3 AND acknowledged + in_downtime > 0 THEN 1 ELSE 0 END)', + 'services_unknown_unhandled_on_ok_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND host_state != 1 AND host_state != 2 AND state = 3 AND acknowledged + in_downtime = 0 THEN 1 ELSE 0 END)', + 'services_unknown_passive_on_ok_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND host_state != 1 AND host_state != 2 AND state = 3 AND is_passive_checked = 1 THEN 1 ELSE 0 END)', + 'services_unknown_not_checked_on_ok_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND host_state != 1 AND host_state != 2 AND state = 3 AND is_active_checked = 0 AND is_passive_checked = 0 THEN 1 ELSE 0 END)', + 'services_ok_on_problem_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND host_state != 0 AND host_state != 99 AND state = 0 THEN 1 ELSE 0 END)', + 'services_ok_not_checked_on_problem_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND host_state != 0 AND host_state != 99 AND state = 0 AND is_active_checked = 0 AND is_passive_checked = 0 THEN 1 ELSE 0 END)', + 'services_pending_on_problem_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND host_state != 0 AND host_state != 99 AND state = 99 THEN 1 ELSE 0 END)', + 'services_pending_not_checked_on_problem_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND host_state != 0 AND host_state != 99 AND state = 99 AND is_active_checked = 0 AND is_passive_checked = 0 THEN 1 ELSE 0 END)', + 'services_warning_handled_on_problem_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND host_state != 0 AND host_state != 99 AND state = 1 AND acknowledged + in_downtime > 0 THEN 1 ELSE 0 END)', + 'services_warning_unhandled_on_problem_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND host_state != 0 AND host_state != 99 AND state = 1 AND acknowledged + in_downtime = 0 THEN 1 ELSE 0 END)', + 'services_warning_passive_on_problem_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND host_state != 0 AND host_state != 99 AND state = 1 AND is_passive_checked = 1 THEN 1 ELSE 0 END)', + 'services_warning_not_checked_on_problem_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND host_state != 0 AND host_state != 99 AND state = 1 AND is_active_checked = 0 AND is_passive_checked = 0 THEN 1 ELSE 0 END)', + 'services_critical_handled_on_problem_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND host_state != 0 AND host_state != 99 AND state = 2 AND acknowledged + in_downtime > 0 THEN 1 ELSE 0 END)', + 'services_critical_unhandled_on_problem_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND host_state != 0 AND host_state != 99 AND state = 2 AND acknowledged + in_downtime = 0 THEN 1 ELSE 0 END)', + 'services_critical_passive_on_problem_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND host_state != 0 AND host_state != 99 AND state = 2 AND is_passive_checked = 1 THEN 1 ELSE 0 END)', + 'services_critical_not_checked_on_problem_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND host_state != 0 AND host_state != 99 AND state = 2 AND is_active_checked = 0 AND is_passive_checked = 0 THEN 1 ELSE 0 END)', + 'services_unknown_handled_on_problem_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND host_state != 0 AND host_state != 99 AND state = 3 AND acknowledged + in_downtime > 0 THEN 1 ELSE 0 END)', + 'services_unknown_unhandled_on_problem_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND host_state != 0 AND host_state != 99 AND state = 3 AND acknowledged + in_downtime = 0 THEN 1 ELSE 0 END)', + 'services_unknown_passive_on_problem_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND host_state != 0 AND host_state != 99 AND state = 3 AND is_passive_checked = 1 THEN 1 ELSE 0 END)', + 'services_unknown_not_checked_on_problem_hosts' => 'SUM(CASE WHEN object_type = \'service\' AND host_state != 0 AND host_state != 99 AND state = 3 AND is_active_checked = 0 AND is_passive_checked = 0 THEN 1 ELSE 0 END)' ) ); From d7f8a7823fbeefbf2faedf205325f5e74f77629f Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Wed, 24 Sep 2014 19:50:43 +0200 Subject: [PATCH 03/10] GroupsummaryQuery: adjust queries to fix ZF woes Some less brackets also here. Dropping COALESCE as the subquery will never return NULL fixes #7303 --- .../Backend/Ido/Query/GroupsummaryQuery.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/GroupsummaryQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/GroupsummaryQuery.php index 3b7fdaa060..c1e12a1ee5 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/GroupsummaryQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/GroupsummaryQuery.php @@ -27,14 +27,14 @@ class GroupSummaryQuery extends IdoQuery 'services_ok' => 'SUM(CASE WHEN object_type = \'service\' AND state = 0 THEN 1 ELSE 0 END)', 'services_pending' => 'SUM(CASE WHEN object_type = \'service\' AND state = 99 THEN 1 ELSE 0 END)', 'services_warning' => 'SUM(CASE WHEN object_type = \'service\' AND state = 1 THEN 1 ELSE 0 END)', - 'services_warning_handled' => 'SUM(CASE WHEN object_type = \'service\' AND state = 1 AND (acknowledged + in_downtime + COALESCE(host_state, 0)) > 0 THEN 1 ELSE 0 END)', + 'services_warning_handled' => 'SUM(CASE WHEN object_type = \'service\' AND state = 1 AND acknowledged + in_downtime + host_state > 0 THEN 1 ELSE 0 END)', 'services_critical' => 'SUM(CASE WHEN object_type = \'service\' AND state = 2 THEN 1 ELSE 0 END)', - 'services_critical_handled' => 'SUM(CASE WHEN object_type = \'service\' AND state = 2 AND (acknowledged + in_downtime + COALESCE(host_state, 0)) > 0 THEN 1 ELSE 0 END)', + 'services_critical_handled' => 'SUM(CASE WHEN object_type = \'service\' AND state = 2 AND acknowledged + in_downtime + host_state > 0 THEN 1 ELSE 0 END)', 'services_unknown' => 'SUM(CASE WHEN object_type = \'service\' AND state = 3 THEN 1 ELSE 0 END)', - 'services_unknown_handled' => 'SUM(CASE WHEN object_type = \'service\' AND state = 3 AND (acknowledged + in_downtime + COALESCE(host_state, 0)) > 0 THEN 1 ELSE 0 END)', - 'services_warning_unhandled' => 'SUM(CASE WHEN object_type = \'service\' AND state = 1 AND (acknowledged + in_downtime + COALESCE(host_state, 0)) = 0 THEN 1 ELSE 0 END)', - 'services_critical_unhandled' => 'SUM(CASE WHEN object_type = \'service\' AND state = 2 AND (acknowledged + in_downtime + COALESCE(host_state, 0)) = 0 THEN 1 ELSE 0 END)', - 'services_unknown_unhandled' => 'SUM(CASE WHEN object_type = \'service\' AND state = 3 AND (acknowledged + in_downtime + COALESCE(host_state, 0)) = 0 THEN 1 ELSE 0 END)', + 'services_unknown_handled' => 'SUM(CASE WHEN object_type = \'service\' AND state = 3 AND acknowledged + in_downtime + host_state > 0 THEN 1 ELSE 0 END)', + 'services_warning_unhandled' => 'SUM(CASE WHEN object_type = \'service\' AND state = 1 AND acknowledged + in_downtime + host_state = 0 THEN 1 ELSE 0 END)', + 'services_critical_unhandled' => 'SUM(CASE WHEN object_type = \'service\' AND state = 2 AND acknowledged + in_downtime + host_state = 0 THEN 1 ELSE 0 END)', + 'services_unknown_unhandled' => 'SUM(CASE WHEN object_type = \'service\' AND state = 3 AND acknowledged + in_downtime + host_state = 0 THEN 1 ELSE 0 END)', 'servicegroup' => 'servicegroup' ) ); From c8a24f72b840b946a691029f7697afc1175bca77 Mon Sep 17 00:00:00 2001 From: Alexander Fuhr Date: Fri, 26 Sep 2014 14:15:50 +0200 Subject: [PATCH 04/10] Introduce getValue() in Preferences and fix the loading of values --- library/Icinga/Application/Web.php | 5 ++-- library/Icinga/User/Preferences.php | 27 ++++++++++++++++--- .../Web/Controller/ActionController.php | 2 +- .../library/Icinga/User/PreferencesTest.php | 14 ++++++++++ 4 files changed, 41 insertions(+), 7 deletions(-) diff --git a/library/Icinga/Application/Web.php b/library/Icinga/Application/Web.php index 6a15d392a0..89cad22abd 100644 --- a/library/Icinga/Application/Web.php +++ b/library/Icinga/Application/Web.php @@ -278,7 +278,8 @@ protected function setupTimezone() if ($this->user !== null && $this->user->getPreferences() !== null) { $detect = new TimezoneDetect(); - $userTimezone = $this->user->getPreferences()->get('app.timezone', $detect->getTimezoneName()); + $userTimezone = $this->user->getPreferences() + ->getValue('icingaweb', 'timezone', $detect->getTimezoneName()); } try { @@ -302,7 +303,7 @@ protected function setupInternationalization() { parent::setupInternationalization(); if ($this->user !== null && $this->user->getPreferences() !== null - && (($locale = $this->user->getPreferences()->get('app.language')) !== null) + && (($locale = $this->user->getPreferences()->getValue('icingaweb', 'language')) !== null) ) { try { Translator::setupLocale($locale); diff --git a/library/Icinga/User/Preferences.php b/library/Icinga/User/Preferences.php index b1dae867ac..364112a9e5 100644 --- a/library/Icinga/User/Preferences.php +++ b/library/Icinga/User/Preferences.php @@ -79,19 +79,38 @@ public function __set($name, $value) } /** - * Retrieve a preference and return $default if the preference is not set + * Retrieve a preference section * * @param string $name - * @param mixed $default * - * @return mixed + * @return array|null */ - public function get($name, $default = null) + public function get($name) { if (array_key_exists($name, $this->preferences)) { return $this->preferences[$name]; } + return null; + } + + /** + * Retrieve a value from a specific section + * + * @param string $section + * @param string $name + * @param null $default + * + * @return array|null + */ + public function getValue($section, $name, $default = null) + { + if (array_key_exists($section, $this->preferences) + && array_key_exists($name, $this->preferences[$section]) + ) { + return $this->preferences[$section][$name]; + } + return $default; } diff --git a/library/Icinga/Web/Controller/ActionController.php b/library/Icinga/Web/Controller/ActionController.php index d3fc54535b..315209232e 100644 --- a/library/Icinga/Web/Controller/ActionController.php +++ b/library/Icinga/Web/Controller/ActionController.php @@ -365,7 +365,7 @@ public function postDispatch() if ($user = $req->getUser()) { // Cast preference app.show_benchmark to bool because preferences loaded from a preferences storage are // always strings - if ((bool) $user->getPreferences()->get('app.show_benchmark', false) === true) { + if ((bool) $user->getPreferences()->getValue('icingaweb', 'show_benchmark', false) === true) { if (!$this->_helper->viewRenderer->getNoRender()) { $layout->benchmark = $this->renderBenchmark(); } diff --git a/test/php/library/Icinga/User/PreferencesTest.php b/test/php/library/Icinga/User/PreferencesTest.php index da5c318fac..540ea1b147 100644 --- a/test/php/library/Icinga/User/PreferencesTest.php +++ b/test/php/library/Icinga/User/PreferencesTest.php @@ -44,4 +44,18 @@ public function testWhetherPreferencesAreCountable() $this->assertEquals(2, count($prefs)); } + + public function testWhetherGetValueReturnsExpectedValue() + { + $prefs = new Preferences(array( + 'test' => array ( + 'key1' => '1', + 'key2' => '2', + ) + )); + + $result = $prefs->getValue('test', 'key2'); + + $this->assertEquals('2', $result, 'Preferences::getValue() do not return an expected value'); + } } From cf997e998fedfb82b72cc2e61ec81ce47e458e88 Mon Sep 17 00:00:00 2001 From: Alexander Fuhr Date: Fri, 26 Sep 2014 14:59:06 +0200 Subject: [PATCH 05/10] Fix eventhistory sort oder fixes #7267 --- modules/monitoring/application/controllers/ListController.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index 5096d41809..f087faa88c 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -526,6 +526,10 @@ public function hostgroupsAction() public function eventhistoryAction() { + if ($url = $this->hasBetterUrl()) { + return $this->redirectNow($url); + } + $this->addTitleTab('eventhistory'); $query = $this->backend->select()->from('eventHistory', array( 'host_name', From c73b291cf4348eb54e12d25bae994ce3bd99f5f6 Mon Sep 17 00:00:00 2001 From: Alexander Fuhr Date: Fri, 26 Sep 2014 15:57:00 +0200 Subject: [PATCH 06/10] Add a better time format for downtime --- .../application/views/scripts/list/downtimes.phtml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/monitoring/application/views/scripts/list/downtimes.phtml b/modules/monitoring/application/views/scripts/list/downtimes.phtml index 247bf61c91..b0755a974f 100644 --- a/modules/monitoring/application/views/scripts/list/downtimes.phtml +++ b/modules/monitoring/application/views/scripts/list/downtimes.phtml @@ -29,7 +29,16 @@ is_in_effect ? $this->translate('Expires') : $this->translate('Starts'); ?>
- prefixedTimeUntil($downtime->is_in_effect ? $downtime->end : $downtime->start); ?> + dateTimeRenderer( + ($downtime->is_in_effect ? $downtime->end : $downtime->start), + true + )->render( + $this->translate('on %s', 'datetime'), + $this->translate('at %s', 'time'), + $this->translate('in %s', 'timespan') + ); + ?> service)): ?> From b2f12e1caa520e24c24734f7303b6d6e817a1df1 Mon Sep 17 00:00:00 2001 From: Alexander Fuhr Date: Fri, 26 Sep 2014 16:19:44 +0200 Subject: [PATCH 07/10] Revert "lib: Remove form element `Note'" This reverts commit c21d7d1fdda460050cac822e5627fd584b3f7a01. --- library/Icinga/Web/Form/Element/Note.php | 31 ++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 library/Icinga/Web/Form/Element/Note.php diff --git a/library/Icinga/Web/Form/Element/Note.php b/library/Icinga/Web/Form/Element/Note.php new file mode 100644 index 0000000000..5788c200d2 --- /dev/null +++ b/library/Icinga/Web/Form/Element/Note.php @@ -0,0 +1,31 @@ + Date: Fri, 26 Sep 2014 16:32:07 +0200 Subject: [PATCH 08/10] Replace Zend Note Element through Icingas Note Element fixes #7318 fixes #7309 fixes #7307 --- .../DisableNotificationsExpireCommandForm.php | 14 ++++++++------ .../Object/AcknowledgeProblemCommandForm.php | 4 ++-- .../forms/Command/Object/AddCommentCommandForm.php | 4 ++-- .../forms/Command/Object/CheckNowCommandForm.php | 4 ++-- .../Object/ScheduleServiceCheckCommandForm.php | 4 ++-- .../Object/ScheduleServiceDowntimeCommandForm.php | 4 ++-- .../forms/Config/Instance/RemoteInstanceForm.php | 2 +- 7 files changed, 19 insertions(+), 17 deletions(-) diff --git a/modules/monitoring/application/forms/Command/Instance/DisableNotificationsExpireCommandForm.php b/modules/monitoring/application/forms/Command/Instance/DisableNotificationsExpireCommandForm.php index 67d2c7fc61..272fb6660f 100644 --- a/modules/monitoring/application/forms/Command/Instance/DisableNotificationsExpireCommandForm.php +++ b/modules/monitoring/application/forms/Command/Instance/DisableNotificationsExpireCommandForm.php @@ -9,6 +9,7 @@ use Icinga\Module\Monitoring\Command\Instance\DisableNotificationsExpireCommand; use Icinga\Module\Monitoring\Form\Command\CommandForm; use Icinga\Web\Form\Element\DateTimePicker; +use Icinga\Web\Form\Element\Note; use Icinga\Web\Notification; use Icinga\Web\Request; @@ -33,12 +34,13 @@ public function init() public function createElements(array $formData = array()) { $this->addElement( - 'note', - 'command-info', - array( - 'value' => mt( - 'monitoring', - 'This command is used to disable host and service notifications for a specific time.' + new Note( + 'command-info', + array( + 'value' => mt( + 'monitoring', + 'This command is used to disable host and service notifications for a specific time.' + ) ) ) ); diff --git a/modules/monitoring/application/forms/Command/Object/AcknowledgeProblemCommandForm.php b/modules/monitoring/application/forms/Command/Object/AcknowledgeProblemCommandForm.php index f54c8bdb2f..c5b78e25c3 100644 --- a/modules/monitoring/application/forms/Command/Object/AcknowledgeProblemCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/AcknowledgeProblemCommandForm.php @@ -8,6 +8,7 @@ use DateInterval; use Icinga\Module\Monitoring\Command\Object\AcknowledgeProblemCommand; use Icinga\Web\Form\Element\DateTimePicker; +use Icinga\Web\Form\Element\Note; use Icinga\Web\Notification; use Icinga\Web\Request; @@ -34,8 +35,7 @@ public function getSubmitLabel() public function createElements(array $formData = array()) { $this->addElements(array( - array( - 'note', + new Note( 'command-info', array( 'value' => mt( diff --git a/modules/monitoring/application/forms/Command/Object/AddCommentCommandForm.php b/modules/monitoring/application/forms/Command/Object/AddCommentCommandForm.php index a89353d526..1f6f9573ec 100644 --- a/modules/monitoring/application/forms/Command/Object/AddCommentCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/AddCommentCommandForm.php @@ -5,6 +5,7 @@ namespace Icinga\Module\Monitoring\Form\Command\Object; use Icinga\Module\Monitoring\Command\Object\AddCommentCommand; +use Icinga\Web\Form\Element\Note; use Icinga\Web\Notification; use Icinga\Web\Request; @@ -31,8 +32,7 @@ public function getSubmitLabel() public function createElements(array $formData = array()) { $this->addElements(array( - array( - 'note', + new Note( 'command-info', array( 'value' => mt( diff --git a/modules/monitoring/application/forms/Command/Object/CheckNowCommandForm.php b/modules/monitoring/application/forms/Command/Object/CheckNowCommandForm.php index a77040ee59..14e7be0113 100644 --- a/modules/monitoring/application/forms/Command/Object/CheckNowCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/CheckNowCommandForm.php @@ -6,6 +6,7 @@ use Icinga\Module\Monitoring\Command\Object\ScheduleHostCheckCommand; use Icinga\Module\Monitoring\Command\Object\ScheduleServiceCheckCommand; +use Icinga\Web\Form\Element\Note; use Icinga\Web\Notification; use Icinga\Web\Request; @@ -30,8 +31,7 @@ public function init() public function addSubmitButton() { $this->addElements(array( - array( - 'note', // Bogus + new Note( 'icon', // Bogus array( 'decorators' => array(array( diff --git a/modules/monitoring/application/forms/Command/Object/ScheduleServiceCheckCommandForm.php b/modules/monitoring/application/forms/Command/Object/ScheduleServiceCheckCommandForm.php index 0a54e2af41..304ccb4355 100644 --- a/modules/monitoring/application/forms/Command/Object/ScheduleServiceCheckCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/ScheduleServiceCheckCommandForm.php @@ -8,6 +8,7 @@ use DateInterval; use Icinga\Module\Monitoring\Command\Object\ScheduleServiceCheckCommand; use Icinga\Web\Form\Element\DateTimePicker; +use Icinga\Web\Form\Element\Note; use Icinga\Web\Notification; use Icinga\Web\Request; @@ -36,8 +37,7 @@ public function createElements(array $formData = array()) $checkTime = new DateTime(); $checkTime->add(new DateInterval('PT1H')); $this->addElements(array( - array( - 'note', + new Note( 'command-info', array( 'value' => mt( diff --git a/modules/monitoring/application/forms/Command/Object/ScheduleServiceDowntimeCommandForm.php b/modules/monitoring/application/forms/Command/Object/ScheduleServiceDowntimeCommandForm.php index 86e06f071d..58b391d14a 100644 --- a/modules/monitoring/application/forms/Command/Object/ScheduleServiceDowntimeCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/ScheduleServiceDowntimeCommandForm.php @@ -8,6 +8,7 @@ use DateInterval; use Icinga\Module\Monitoring\Command\Object\ScheduleServiceDowntimeCommand; use Icinga\Web\Form\Element\DateTimePicker; +use Icinga\Web\Form\Element\Note; use Icinga\Web\Form\Element\Number; use Icinga\Web\Notification; use Icinga\Web\Request; @@ -48,8 +49,7 @@ public function createElements(array $formData = array()) $end = clone $start; $end->add(new DateInterval('PT1H')); $this->addElements(array( - array( - 'note', + new Note( 'command-info', array( 'value' => mt( diff --git a/modules/monitoring/application/forms/Config/Instance/RemoteInstanceForm.php b/modules/monitoring/application/forms/Config/Instance/RemoteInstanceForm.php index 0e78a0aec9..c5cfd9f3f6 100644 --- a/modules/monitoring/application/forms/Config/Instance/RemoteInstanceForm.php +++ b/modules/monitoring/application/forms/Config/Instance/RemoteInstanceForm.php @@ -51,7 +51,7 @@ public function createElements(array $formData) 'Enter the username to use for connecting to the remote machine or leave blank for default' ) ) - ); + );clear $this->addElement( 'text', 'path', From 31609ecb34949424845a739518d217bb0589a0e7 Mon Sep 17 00:00:00 2001 From: Alexander Fuhr Date: Fri, 26 Sep 2014 17:14:13 +0200 Subject: [PATCH 09/10] Remove typo in RemoteInstaceForm refs #7307 --- .../application/forms/Config/Instance/RemoteInstanceForm.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/monitoring/application/forms/Config/Instance/RemoteInstanceForm.php b/modules/monitoring/application/forms/Config/Instance/RemoteInstanceForm.php index c5cfd9f3f6..0e78a0aec9 100644 --- a/modules/monitoring/application/forms/Config/Instance/RemoteInstanceForm.php +++ b/modules/monitoring/application/forms/Config/Instance/RemoteInstanceForm.php @@ -51,7 +51,7 @@ public function createElements(array $formData) 'Enter the username to use for connecting to the remote machine or leave blank for default' ) ) - );clear + ); $this->addElement( 'text', 'path', From f7b7e0283ac52f345924bd680fbd808056e7746a Mon Sep 17 00:00:00 2001 From: Alexander Fuhr Date: Mon, 29 Sep 2014 15:20:19 +0200 Subject: [PATCH 10/10] Translation: another bunch of translatable strings --- application/controllers/ConfigController.php | 4 +- .../views/scripts/config/modules.phtml | 6 +- .../controllers/ChartController.php | 4 +- .../controllers/CommandController.php | 7 +- .../controllers/ListController.php | 80 +++++++++---------- .../controllers/MultiController.php | 24 +++--- .../forms/Config/SecurityConfigForm.php | 6 +- .../views/scripts/layout/topbar.phtml | 28 +++---- .../views/scripts/list/hostgroups.phtml | 56 ++++++------- .../views/scripts/list/hosts.phtml | 22 ++--- .../views/scripts/list/servicegroups.phtml | 46 +++++------ .../views/scripts/list/services.phtml | 16 ++-- .../scripts/show/components/statusIcons.phtml | 12 +-- .../servicestatesummarybyhoststate.phtml | 16 ++-- 14 files changed, 167 insertions(+), 160 deletions(-) diff --git a/application/controllers/ConfigController.php b/application/controllers/ConfigController.php index 559d8f3f92..c12860e72a 100644 --- a/application/controllers/ConfigController.php +++ b/application/controllers/ConfigController.php @@ -96,7 +96,7 @@ public function moduleenableAction() try { $manager->enableModule($module); $manager->loadModule($module); - Notification::success('Module "' . $module . '" enabled'); + Notification::success(sprintf($this->translate('Module "%s" enabled'), $module)); $this->rerenderLayout()->reloadCss()->redirectNow('config/modules'); } catch (Exception $e) { $this->view->exceptionMesssage = $e->getMessage(); @@ -115,7 +115,7 @@ public function moduledisableAction() $manager = Icinga::app()->getModuleManager(); try { $manager->disableModule($module); - Notification::success('Module "' . $module . '" disabled'); + Notification::success(sprintf($this->translate('Module "%s" disabled'), $module)); $this->rerenderLayout()->reloadCss()->redirectNow('config/modules'); } catch (Exception $e) { $this->view->exceptionMessage = $e->getMessage(); diff --git a/application/views/scripts/config/modules.phtml b/application/views/scripts/config/modules.phtml index 086d0a61aa..e0204b24ff 100644 --- a/application/views/scripts/config/modules.phtml +++ b/application/views/scripts/config/modules.phtml @@ -1,6 +1,6 @@
tabs ?> -

Installed Modules

+

translate('Installed Modules') ?>

paginationControl($modules) ?>
@@ -11,9 +11,9 @@ enabled): ?> - icon('success.png', 'Module is enabled') ?> + icon('success.png', $this->translate('Module is enabled')) ?> - icon('remove.png', 'Module is disabled') ?> + icon('remove.png', $this->translate('Module is disabled')) ?> - + hosts_up ?> - + hosts_down_unhandled ?> / - + hosts_down_handled ?> - + hosts_unreachable_unhandled ?> / - + hosts_unreachable_handled ?> - + hosts_pending ?> @@ -29,36 +29,36 @@ @@ -70,8 +70,8 @@ if (count($hostgroups) === 0) { 'host_unhandled' => 1, 'hostgroup' => $h->hostgroup ) - ); ?>" title="Hosts UNREACHABLE Unhandled"> - hosts_unreachable_unhandled; ?> UNREACHABLE + ); ?>" title="translate('Hosts UNREACHABLE Unhandled') ?>"> + hosts_unreachable_unhandled; ?> translate('UNREACHABLE', 'icinga.state') ?> hosts_unreachable_handled): ?> @@ -82,8 +82,8 @@ if (count($hostgroups) === 0) { 'host_handled' => 1, 'hostgroup' => $h->hostgroup ) - ); ?>" title="Hosts UNREACHABLE Handled"> - hosts_unreachable_handled . ' ' . ($h->hosts_unreachable_unhandled ? $this->translate('Acknowledged') : 'UNREACHABLE'); ?> + ); ?>" title="translate('Hosts UNREACHABLE Handled') ?>"> + hosts_unreachable_handled . ' ' . ($h->hosts_unreachable_unhandled ? $this->translate('Acknowledged') : $this->translate('UNREACHABLE', 'icinga.state')) ?> @@ -98,8 +98,8 @@ if (count($hostgroups) === 0) { 'host_state' => 0, 'hostgroup' => $h->hostgroup ) - ); ?>" title="Hosts UP"> - hosts_up; ?> UP + ); ?>" title="translate('Hosts UP') ?>"> + hosts_up; ?> translate('UP', 'icinga.state') ?> @@ -113,8 +113,8 @@ if (count($hostgroups) === 0) { 'host_state' => 99, 'hostgroup' => $h->hostgroup ) - ); ?>" title="Hosts PENDING"> - hosts_pending; ?> PENDING + ); ?>" title="translate('Hosts PENDING') ?>"> + hosts_pending; ?> translate('PENDING', 'icinga.state') ?> @@ -135,8 +135,8 @@ if (count($hostgroups) === 0) { 'hostgroup' => $h->hostgroup, 'sort' => 'service_severity' ) - ); ?>" title="Services CRITICAL Unhandled"> - services_critical_unhandled; ?> CRITICAL + ); ?>" title="translate('Services CRITICAL Unhandled') ?>"> + services_critical_unhandled; ?> translate('CRITICAL', 'icinga.state') ?> services_critical_handled): ?> @@ -148,8 +148,8 @@ if (count($hostgroups) === 0) { 'hostgroup' => $h->hostgroup, 'sort' => 'service_severity' ) - ); ?>" title="Services CRITICAL Handled"> - services_critical_handled . ' ' . ($h->services_critical_unhandled ? $this->translate('Acknowledged') : 'CRITICAL'); ?> + ); ?>" title="translate('Services CRITICAL Handled') ?>"> + services_critical_handled . ' ' . ($h->services_critical_unhandled ? $this->translate('Acknowledged') : $this->translate('CRITICAL', 'icinga.state')); ?> @@ -169,8 +169,8 @@ if (count($hostgroups) === 0) { 'hostgroup' => $h->hostgroup, 'sort' => 'service_severity' ) - ); ?>" title="Services WARNING Unhandled"> - services_warning_unhandled; ?> WARNING + ); ?>" title="translate('Services WARNING Unhandled') ?>"> + services_warning_unhandled; ?> translate('WARNING', 'icinga.state') ?> services_warning_handled): ?> @@ -182,8 +182,8 @@ if (count($hostgroups) === 0) { 'hostgroup' => $h->hostgroup, 'sort' => 'service_severity' ) - ); ?>" title="Services WARNING Handled"> - services_warning_handled . ' ' . ($h->services_warning_unhandled ? $this->translate('Acknowledged') : 'WARNING'); ?> + ); ?>" title="translate('Services WARNING Handled') ?>"> + services_warning_handled . ' ' . ($h->services_warning_unhandled ? $this->translate('Acknowledged') : $this->translate('WARNING', 'icinga.state')); ?> @@ -203,8 +203,8 @@ if (count($hostgroups) === 0) { 'hostgroup' => $h->hostgroup, 'sort' => 'service_severity' ) - ); ?>" title="Services UNKNOWN Unhandled"> - services_unknown_unhandled; ?> UNKNOWN + ); ?>" title="translate('Services UNKNOWN Unhandled') ?>"> + services_unknown_unhandled; ?> translate('UNKNOWN', 'icinga.state') ?> services_unknown_handled): ?> @@ -216,8 +216,8 @@ if (count($hostgroups) === 0) { 'hostgroup' => $h->hostgroup, 'sort' => 'service_severity' ) - ); ?>" title="Services UNKNOWN Handled"> - services_unknown_handled . ' ' . ($h->services_unknown_unhandled ? $this->translate('Acknowledged') : 'UNKNOWN'); ?> + ); ?>" title="translate('Services UNKNOWN Handled') ?>"> + services_unknown_handled . ' ' . ($h->services_unknown_unhandled ? $this->translate('Acknowledged') : $this->translate('UNKNOWN', 'icinga.state')); ?> @@ -233,8 +233,8 @@ if (count($hostgroups) === 0) { 'hostgroup' => $h->hostgroup, 'sort' => 'service_severity' ) - ); ?>" title="Services OK"> - services_ok; ?> OK + ); ?>" title="translate('Services OK') ?>"> + services_ok; ?> translate('OK', 'icinga.state') ?> @@ -249,8 +249,8 @@ if (count($hostgroups) === 0) { 'hostgroup' => $h->hostgroup, 'sort' => 'service_severity' ) - ); ?>" title="Services PENDING"> - services_pending; ?> PENDING + ); ?>" title="translate('Services PENDING') ?>"> + services_pending; ?> translate('PENDING', 'icinga.state') ?> diff --git a/modules/monitoring/application/views/scripts/list/hosts.phtml b/modules/monitoring/application/views/scripts/list/hosts.phtml index 5cad9142e4..5be77f89f5 100644 --- a/modules/monitoring/application/views/scripts/list/hosts.phtml +++ b/modules/monitoring/application/views/scripts/list/hosts.phtml @@ -47,35 +47,35 @@ if ($hosts->count() === 0) { $icons = array(); if (! $host->host_handled && $host->host_state > 0){ - $icons[] = $this->icon('unhandled.png', 'Unhandled'); + $icons[] = $this->icon('unhandled.png', $this->translate('Unhandled')); } if ($host->host_acknowledged) { - $icons[] = $this->icon('acknowledgement.png', 'Acknowledged'); + $icons[] = $this->icon('acknowledgement.png', $this->translate('Acknowledged')); } if ($host->host_is_flapping) { - $icons[] = $this->icon('flapping.png', 'Flapping'); + $icons[] = $this->icon('flapping.png', $this->translate('Flapping')); } if (! $host->host_notifications_enabled) { - $icons[] = $this->icon('notification_disabled.png', 'Notifications Disabled'); + $icons[] = $this->icon('notification_disabled.png', $this->translate('Notifications Disabled')); } if ($host->host_in_downtime) { - $icons[] = $this->icon('in_downtime.png', 'In Downtime'); + $icons[] = $this->icon('in_downtime.png', $this->translate('In Downtime')); } if (! $host->host_active_checks_enabled) { if (! $host->host_passive_checks_enabled) { - $icons[] = $this->icon('active_passive_checks_disabled.png', 'Active And Passive Checks Disabled'); + $icons[] = $this->icon('active_passive_checks_disabled.png', $this->translate('Active And Passive Checks Disabled')); } else { - $icons[] = $this->icon('active_checks_disabled.png', 'Active Checks Disabled'); + $icons[] = $this->icon('active_checks_disabled.png', $this->translate('Active Checks Disabled')); } } if (isset($host->host_last_comment) && $host->host_last_comment !== null) { - $icons[] = $this->icon('comment.png', 'Comment: ' . $host->host_last_comment); + $icons[] = $this->icon('comment.png', $this->translate('Comment: ') . $host->host_last_comment); } ?> @@ -101,8 +101,10 @@ if ($hosts->count() === 0) { host_unhandled_services) && $host->host_unhandled_services > 0): ?> (qlink( - sprintf($this->translate('%d unhandled services'), $host->host_unhandled_services), + ?> translate('Service Problems on Host') ?>"> (qlink( + sprintf( + $this->translatePlural('%d unhandled service', '%d unhandled services', $host->host_unhandled_services), + $host->host_unhandled_services), 'monitoring/show/services', array( 'host' => $host->host_name, diff --git a/modules/monitoring/application/views/scripts/list/servicegroups.phtml b/modules/monitoring/application/views/scripts/list/servicegroups.phtml index 059ea9dcbe..5af6899e72 100644 --- a/modules/monitoring/application/views/scripts/list/servicegroups.phtml +++ b/modules/monitoring/application/views/scripts/list/servicegroups.phtml @@ -43,8 +43,8 @@ if (count($servicegroups) === 0) { 'host_unhandled' => 1, 'servicegroup' => $servicegroup->servicegroup ) - ); ?>" title="Hosts DOWN Unhandled"> - hosts_down_unhandled; ?> DOWN + ); ?>" title="translate('Hosts DOWN Unhandled') ?>"> + hosts_down_unhandled; ?> translate('DOWN', 'icinga.state') ?> hosts_down_handled): ?> @@ -55,7 +55,7 @@ if (count($servicegroups) === 0) { 'host_handled' => 1, 'servicegroup' => $servicegroup->servicegroup ) - ); ?>" title="Hosts DOWN Handled"> + ); ?>" title="translate('Hosts DOWN Handled') ?>"> hosts_down_handled . ' ' . ($servicegroup->hosts_down_unhandled ? $this->translate('Acknowledged') : 'DOWN'); ?> @@ -73,8 +73,8 @@ if (count($servicegroups) === 0) { 'host_unhandled' => 1, 'servicegroup' => $servicegroup->servicegroup ) - ); ?>" title="Hosts UNREACHABLE Unhandled"> - hosts_unreachable_unhandled; ?> UNREACHABLE + ); ?>" title="translate('Hosts UNREACHABLE Unhandled') ?>"> + hosts_unreachable_unhandled; ?> translate('UNREACHABLE', 'icinga.state') ?> hosts_unreachable_handled): ?> @@ -85,7 +85,7 @@ if (count($servicegroups) === 0) { 'host_handled' => 1, 'servicegroup' => $servicegroup->servicegroup ) - ); ?>" title="Hosts UNREACHABLE Handled"> + ); ?>" title="translate('Hosts UNREACHABLE Handled') ?>"> hosts_unreachable_handled . ' ' . ($servicegroup->hosts_unreachable_unhandled ? $this->translate('Acknowledged') : 'UNREACHABLE'); ?> @@ -101,8 +101,8 @@ if (count($servicegroups) === 0) { 'host_state' => 0, 'servicegroup' => $servicegroup->servicegroup ) - ); ?>" title="Hosts UP"> - hosts_up; ?> UP + ); ?>" title="translate('Hosts UP') ?>"> + hosts_up; ?> translate('UP', 'icinga.state') ?> @@ -116,8 +116,8 @@ if (count($servicegroups) === 0) { 'host_state' => 99, 'servicegroup' => $servicegroup->servicegroup ) - ); ?>" title="Hosts PENDING"> - hosts_pending; ?> PENDING + ); ?>" title="translate('Hosts PENDING') ?>"> + hosts_pending; ?> translate('PENDING', 'icinga.state') ?> @@ -138,8 +138,8 @@ if (count($servicegroups) === 0) { 'servicegroup' => $servicegroup->servicegroup, 'sort' => 'service_severity' ) - ); ?>" title="Services CRITICAL Unhandled"> - services_critical_unhandled; ?> CRITICAL + ); ?>" title="translate('Services CRITICAL Unhandled') ?>"> + services_critical_unhandled; ?> translate('CRITICAL', 'icinga.state') ?> services_critical_handled): ?> @@ -151,7 +151,7 @@ if (count($servicegroups) === 0) { 'servicegroup' => $servicegroup->servicegroup, 'sort' => 'service_severity' ) - ); ?>" title="Services CRITICAL Handled"> + ); ?>" title="translate('Services CRITICAL Handled') ?>"> services_critical_handled . ' ' . ($servicegroup->services_critical_unhandled ? $this->translate('Acknowledged') : 'CRITICAL'); ?> @@ -172,8 +172,8 @@ if (count($servicegroups) === 0) { 'servicegroup' => $servicegroup->servicegroup, 'sort' => 'service_severity' ) - ); ?>" title="Services WARNING Unhandled"> - services_warning_unhandled; ?> WARNING + ); ?>" title="translate('Services WARNING Unhandled') ?>"> + services_warning_unhandled; ?> translate('WARNING', 'icinga.state') ?> services_warning_handled): ?> @@ -185,7 +185,7 @@ if (count($servicegroups) === 0) { 'servicegroup' => $servicegroup->servicegroup, 'sort' => 'service_severity' ) - ); ?>" title="Services WARNING Handled"> + ); ?>" title="translate('Services WARNING Handled') ?>"> services_warning_handled . ' ' . ($servicegroup->services_warning_unhandled ? $this->translate('Acknowledged') : 'WARNING'); ?> @@ -206,8 +206,8 @@ if (count($servicegroups) === 0) { 'servicegroup' => $servicegroup->servicegroup, 'sort' => 'service_severity' ) - ); ?>" title="Services UNKNOWN Unhandled"> - services_unknown_unhandled; ?> UNKNOWN + ); ?>" title="translate('Services UNKNOWN Unhandled') ?>"> + services_unknown_unhandled; ?> translate('UNKNOWN', 'icinga.state') ?> services_unknown_handled): ?> @@ -219,7 +219,7 @@ if (count($servicegroups) === 0) { 'servicegroup' => $servicegroup->servicegroup, 'sort' => 'service_severity' ) - ); ?>" title="Services UNKNOWN Handled"> + ); ?>" title="translate('Services UNKNOWN Handled') ?>"> services_unknown_handled . ' ' . ($servicegroup->services_unknown_unhandled ? $this->translate('Acknowledged') : 'UNKNOWN'); ?> @@ -236,8 +236,8 @@ if (count($servicegroups) === 0) { 'servicegroup' => $servicegroup->servicegroup, 'sort' => 'service_severity' ) - ); ?>" title="Services OK"> - services_ok; ?> OK + ); ?>" title="translate('Services OK') ?>"> + services_ok; ?> translate('OK', 'icinga.state') ?> @@ -252,8 +252,8 @@ if (count($servicegroups) === 0) { 'servicegroup' => $servicegroup->servicegroup, 'sort' => 'service_severity' ) - ); ?>" title="Services PENDING"> - services_pending; ?> PENDING + ); ?>" title="translate('Services PENDING') ?>"> + services_pending; ?> translate('PENDING', 'icinga.state') ?> diff --git a/modules/monitoring/application/views/scripts/list/services.phtml b/modules/monitoring/application/views/scripts/list/services.phtml index 46ca2c08f7..66cf14c548 100644 --- a/modules/monitoring/application/views/scripts/list/services.phtml +++ b/modules/monitoring/application/views/scripts/list/services.phtml @@ -69,36 +69,36 @@ foreach ($services as $service): perfdata($service->service_perfdata, true, true) ?> service_handled && $service->service_state > 0): ?> - icon('unhandled.png', 'Unhandled') ?> + icon('unhandled.png', $this->translate('Unhandled')) ?> service_acknowledged && !$service->service_in_downtime): ?> - icon('acknowledgement.png', 'Acknowledged' . ( + icon('acknowledgement.png', $this->translate('Acknowledged') . ( $service->service_last_ack ? ': ' . $service->service_last_ack : '' )) ?> service_is_flapping): ?> - icon('flapping.png', 'Flapping') ?> + icon('flapping.png', $this->translate('Flapping')) ?> service_notifications_enabled): ?> - icon('notification_disabled.png', 'Notifications Disabled') ?> + icon('notification_disabled.png', $this->translate('Notifications Disabled')) ?> service_in_downtime): ?> - icon('in_downtime.png', 'In Downtime') ?> + icon('in_downtime.png', $this->translate('In Downtime')) ?> service_last_comment) && $service->service_last_comment !== null): ?> - icon('comment.png', 'Comment: ' . $service->service_last_comment) ?> + icon('comment.png', $this->translate('Comment: ') . $service->service_last_comment) ?> service_active_checks_enabled): ?> service_passive_checks_enabled): ?> - icon('active_passive_checks_disabled.png', 'Active And Passive Checks Disabled') ?> + icon('active_passive_checks_disabled.png', $this->translate('Active And Passive Checks Disabled')) ?> - icon('active_checks_disabled.png', 'Active Checks Disabled') ?> + icon('active_checks_disabled.png', $this->translate('Active Checks Disabled')) ?> diff --git a/modules/monitoring/application/views/scripts/show/components/statusIcons.phtml b/modules/monitoring/application/views/scripts/show/components/statusIcons.phtml index 4e0f3845f4..bfa7b78730 100644 --- a/modules/monitoring/application/views/scripts/show/components/statusIcons.phtml +++ b/modules/monitoring/application/views/scripts/show/components/statusIcons.phtml @@ -23,26 +23,26 @@ $obj->passive_checks_enabled = $i = array(); if (! $obj->handled && $obj->state > 0) { - $i[] = $this->icon('unhandled.png', 'Unhandled'); + $i[] = $this->icon('unhandled.png', $this->translate('Unhandled')); } if ($obj->acknowledged && ! $obj->in_downtime) { - $i[] = $this->icon('acknowledgement.png', 'Acknowledged'); + $i[] = $this->icon('acknowledgement.png', $this->translate('Acknowledged')); } if (!$obj->notifications_enabled) { - $i[] = $this->icon('notification_disabled.png', 'Notifications Disabled'); + $i[] = $this->icon('notification_disabled.png', $this->translate('Notifications Disabled')); } if ($obj->in_downtime) { - $i[] = $this->icon('in_downtime.png', 'In Downtime'); + $i[] = $this->icon('in_downtime.png', $this->translate('In Downtime')); } if (! $obj->active_checks_enabled) { if ($obj->passive_checks_enabled) { - $i[] = $this->icon('active_checks_disabled.png', 'Active Checks Disabled'); + $i[] = $this->icon('active_checks_disabled.png', $this->translate('Active Checks Disabled')); } else { - $i[] = $this->icon('active_passive_checks_disabled.png', 'Active And Passive Checks Disabled'); + $i[] = $this->icon('active_passive_checks_disabled.png', $this->translate('Active And Passive Checks Disabled')); } } diff --git a/modules/monitoring/application/views/scripts/tactical/components/parts/servicestatesummarybyhoststate.phtml b/modules/monitoring/application/views/scripts/tactical/components/parts/servicestatesummarybyhoststate.phtml index 484bbb65e6..cccfa094e0 100644 --- a/modules/monitoring/application/views/scripts/tactical/components/parts/servicestatesummarybyhoststate.phtml +++ b/modules/monitoring/application/views/scripts/tactical/components/parts/servicestatesummarybyhoststate.phtml @@ -5,7 +5,7 @@ 'monitoring/list/services', array('host_problem' => $host_problem, 'service_state' => 2, 'service_acknowledged' => 0, 'service_in_downtime' => 0) ); ?>"> - CRITICAL + translate('CRITICAL', 'icinga.state') ?> @@ -13,7 +13,7 @@ 'monitoring/list/services', array('host_problem' => $host_problem, 'service_state' => 2, 'service_handled' => 1) ); ?>"> - translate('Acknowledged') : 'CRITICAL'); ?> + translate('Acknowledged') : $this->translate('CRITICAL', 'icinga.state')); ?> @@ -75,7 +75,7 @@ 'monitoring/list/services', array('host_problem' => $host_problem, 'service_state' => 1, 'service_acknowledged' => 0, 'service_in_downtime' => 0) ); ?>"> - WARNING + translate('WARNING', 'icinga.state') ?> @@ -83,7 +83,7 @@ 'monitoring/list/services', array('host_problem' => $host_problem, 'service_state' => 1, 'service_handled' => 1) ); ?>"> - translate('Acknowledged') : 'WARNING'); ?> + translate('Acknowledged') : $this->translate('WARNING', 'icinga.state')); ?> @@ -145,7 +145,7 @@ 'monitoring/list/services', array('host_problem' => $host_problem, 'service_state' => 3, 'service_acknowledged' => 0, 'service_in_downtime' => 0) ); ?>"> - UNKNOWN + translate('UNKNOWN', 'icinga.state') ?> @@ -153,7 +153,7 @@ 'monitoring/list/services', array('host_problem' => $host_problem, 'service_state' => 3, 'service_handled' => 1) ); ?>"> - translate('Acknowledged') : 'UNKNOWN'); ?> + translate('Acknowledged') : $this->translate('UNKNOWN', 'icinga.state')); ?> @@ -214,7 +214,7 @@ 'monitoring/list/services', array('host_problem' => $host_problem, 'service_state' => 0) ); ?>"> - OK + translate('OK', 'icinga.state') ?> - PENDING + translate('PENDING', 'icinga.state') ?>