From ab7a5763a67512d895e8f93cd381fdede7a96952 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Tue, 20 Jan 2015 16:21:56 +0100 Subject: [PATCH 01/64] monitoring: Sort by host_display_name instead of name1 by default refs #7843 --- modules/monitoring/library/Monitoring/DataView/HostStatus.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/monitoring/library/Monitoring/DataView/HostStatus.php b/modules/monitoring/library/Monitoring/DataView/HostStatus.php index e9b5b60dd..86bff52bf 100644 --- a/modules/monitoring/library/Monitoring/DataView/HostStatus.php +++ b/modules/monitoring/library/Monitoring/DataView/HostStatus.php @@ -24,6 +24,7 @@ class HostStatus extends DataView return array( 'host', 'host_name', + 'host_display_name', 'host_alias', 'host_address', 'host_state', @@ -90,7 +91,7 @@ class HostStatus extends DataView public function getSortRules() { return array( - 'host_name' => array( + 'host_display_name' => array( 'order' => self::SORT_ASC ), 'host_address' => array( From 9fd90c90cc84742c6f0e7871c0e24dace35a3c4f Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Tue, 20 Jan 2015 16:22:36 +0100 Subject: [PATCH 02/64] monitoring: Sort by host_display_name when sorting by 'Hostname' in the hosts overview refs #7843 --- modules/monitoring/application/controllers/ListController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index 0b4066e7b..d680faaf8 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -133,7 +133,7 @@ class Monitoring_ListController extends Controller $this->setupSortControl(array( 'host_last_check' => $this->translate('Last Check'), 'host_severity' => $this->translate('Severity'), - 'host_name' => $this->translate('Hostname'), + 'host_display_name' => $this->translate('Hostname'), 'host_address' => $this->translate('Address'), 'host_state' => $this->translate('Current State') )); From f1ada110f8bdeac6756d2c3dac7a283db7d5366d Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Tue, 20 Jan 2015 16:23:12 +0100 Subject: [PATCH 03/64] monitoring: Select the host_display_name in the hosts overview refs #7843 --- modules/monitoring/application/controllers/ListController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index d680faaf8..46bb6245e 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -104,6 +104,7 @@ class Monitoring_ListController extends Controller $query = $this->backend->select()->from('hostStatus', array_merge(array( 'host_icon_image', 'host_name', + 'host_display_name', 'host_state' => $stateColumn, 'host_address', 'host_acknowledged', From fe3bbb712d32f4d30c575f6ec7228e707cbf400c Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Tue, 20 Jan 2015 16:25:35 +0100 Subject: [PATCH 04/64] monitoring: Use host_display_name for displaying the host name in the hosts overview refs #7843 --- modules/monitoring/application/views/scripts/list/hosts.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/monitoring/application/views/scripts/list/hosts.phtml b/modules/monitoring/application/views/scripts/list/hosts.phtml index 920a77e01..91f59f422 100644 --- a/modules/monitoring/application/views/scripts/list/hosts.phtml +++ b/modules/monitoring/application/views/scripts/list/hosts.phtml @@ -98,7 +98,7 @@ if ($hosts->count() === 0) { icon($this->resolveMacros($host->host_icon_image, $host)) ?> - host_name ?> + host_display_name ?> host_unhandled_services) && $host->host_unhandled_services > 0): ?> service_icon_image)): ?> icon($this->resolveMacros($service->service_icon_image, $service)) ?> -service_display_name ?>showHost): ?> on host_name; ?> +service_display_name ?>showHost): ?> on host_display_name; ?> host_state != 0): ?> (host_state, true)); ?>) From e55cf73f3481f22eecfa1f8bf17872a8ce0c5c9d Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 09:55:17 +0100 Subject: [PATCH 12/64] monitoring: Select the host and service display_name columns in the eventhistory overview refs #7843 --- modules/monitoring/application/controllers/ListController.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index 23400849c..aefe93b15 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -580,7 +580,9 @@ class Monitoring_ListController extends Controller $query = $this->backend->select()->from('eventHistory', array( 'host_name', + 'host_display_name', 'service_description', + 'service_display_name', 'object_type', 'timestamp', 'state', From 9018b36d7acad75f75428ae32b8c386da56066d0 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 10:03:14 +0100 Subject: [PATCH 13/64] monitoring: Escape hostname, service name and event message in the eventhistory overview --- .../application/views/scripts/list/eventhistory.phtml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/monitoring/application/views/scripts/list/eventhistory.phtml b/modules/monitoring/application/views/scripts/list/eventhistory.phtml index a9516aab1..6d6130a3d 100644 --- a/modules/monitoring/application/views/scripts/list/eventhistory.phtml +++ b/modules/monitoring/application/views/scripts/list/eventhistory.phtml @@ -110,21 +110,21 @@ use Icinga\Module\Monitoring\Object\Service; 'host' => $event->host, 'service' => $event->service )); ?>"> - service; ?> + escape($event->service) ?> - translate('on') . ' ' . $event->host; ?> + translate('on') . ' ' . $this->escape($event->host) ?> - host; ?> + escape($event->host) ?>
- icon($icon, $title); ?> + icon($icon, $title); ?> escape($msg) ?>
From bfd133289169bf4230ee839e6a0183dc9b0f3e8d Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 10:04:14 +0100 Subject: [PATCH 14/64] monitoring: Escape host and service display_name in the services overview --- .../monitoring/application/views/scripts/list/services.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/monitoring/application/views/scripts/list/services.phtml b/modules/monitoring/application/views/scripts/list/services.phtml index 5241c009b..962d22bda 100644 --- a/modules/monitoring/application/views/scripts/list/services.phtml +++ b/modules/monitoring/application/views/scripts/list/services.phtml @@ -107,7 +107,7 @@ foreach ($services as $service): service_icon_image && ! preg_match('/[\'"]/', $service->service_icon_image)): ?> icon($this->resolveMacros($service->service_icon_image, $service)) ?> -service_display_name ?>showHost): ?> on host_display_name; ?> +escape($service->service_display_name) ?>showHost): ?> on escape($service->host_display_name) ?> host_state != 0): ?> (host_state, true)); ?>) From d49c950aacde3834f01b5111bca2d709c1435705 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 10:04:59 +0100 Subject: [PATCH 15/64] monitoring: Escape host_display_name in the hosts overview --- modules/monitoring/application/views/scripts/list/hosts.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/monitoring/application/views/scripts/list/hosts.phtml b/modules/monitoring/application/views/scripts/list/hosts.phtml index 91f59f422..4afc14731 100644 --- a/modules/monitoring/application/views/scripts/list/hosts.phtml +++ b/modules/monitoring/application/views/scripts/list/hosts.phtml @@ -98,7 +98,7 @@ if ($hosts->count() === 0) { icon($this->resolveMacros($host->host_icon_image, $host)) ?> - host_display_name ?> + escape($host->host_display_name) ?> host_unhandled_services) && $host->host_unhandled_services > 0): ?> Date: Wed, 21 Jan 2015 10:12:14 +0100 Subject: [PATCH 17/64] monitoring: Fix code style in the StatehistoryQuery --- .../Backend/Ido/Query/StatehistoryQuery.php | 36 +++++++++---------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatehistoryQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatehistoryQuery.php index b8d320c9c..dfa81b1ef 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatehistoryQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatehistoryQuery.php @@ -1,6 +1,4 @@ 0, - 'hard_state' => 1, + 'hard_state' => 1 ); protected $columnMap = array( 'statehistory' => array( - 'raw_timestamp' => 'sh.state_time', - 'timestamp' => 'UNIX_TIMESTAMP(sh.state_time)', - 'state_time' => 'sh.state_time', - 'object_id' => 'sho.object_id', - 'type' => "(CASE WHEN sh.state_type = 1 THEN 'hard_state' ELSE 'soft_state' END)", - 'state' => 'sh.state', - 'state_type' => 'sh.state_type', - 'output' => 'sh.output', - 'attempt' => 'sh.current_check_attempt', - 'max_attempts' => 'sh.max_check_attempts', - 'host' => 'sho.name1 COLLATE latin1_general_ci', - 'host_name' => 'sho.name1 COLLATE latin1_general_ci', - 'service' => 'sho.name2 COLLATE latin1_general_ci', - 'service_description' => 'sho.name2 COLLATE latin1_general_ci', - 'service_host_name' => 'sho.name1 COLLATE latin1_general_ci', - 'object_type' => "CASE WHEN sho.objecttype_id = 1 THEN 'host' ELSE 'service' END" + 'raw_timestamp' => 'sh.state_time', + 'timestamp' => 'UNIX_TIMESTAMP(sh.state_time)', + 'state_time' => 'sh.state_time', + 'object_id' => 'sho.object_id', + 'type' => "(CASE WHEN sh.state_type = 1 THEN 'hard_state' ELSE 'soft_state' END)", + 'state' => 'sh.state', + 'state_type' => 'sh.state_type', + 'output' => 'sh.output', + 'attempt' => 'sh.current_check_attempt', + 'max_attempts' => 'sh.max_check_attempts', + 'host' => 'sho.name1 COLLATE latin1_general_ci', + 'host_name' => 'sho.name1 COLLATE latin1_general_ci', + 'service' => 'sho.name2 COLLATE latin1_general_ci', + 'service_description' => 'sho.name2 COLLATE latin1_general_ci', + 'service_host_name' => 'sho.name1 COLLATE latin1_general_ci', + 'object_type' => "CASE WHEN sho.objecttype_id = 1 THEN 'host' ELSE 'service' END" ) ); From 1bba0b3d0f1c0ceb2a69f608b605cdb7aa1a1e70 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 10:15:58 +0100 Subject: [PATCH 18/64] monitoring: Fix coding style in the EventHistoryQuery --- .../Backend/Ido/Query/EventHistoryQuery.php | 29 +++++++++---------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/EventHistoryQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/EventHistoryQuery.php index 2d5a0a2d8..b95cb89de 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/EventHistoryQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/EventHistoryQuery.php @@ -1,11 +1,9 @@ subQueries as $sub) { - $sub->applyFilter(clone $filter); - } - return $this; + foreach ($this->subQueries as $sub) { + $sub->applyFilter(clone $filter); + } + return $this; } - public function where($condition, $value = null) - { - $this->requireColumn($condition); - foreach ($this->subQueries as $sub) { - $sub->where($condition, $value); - } - return $this; - } + public function where($condition, $value = null) + { + $this->requireColumn($condition); + foreach ($this->subQueries as $sub) { + $sub->where($condition, $value); + } + return $this; + } protected function joinHostgroups() { @@ -116,5 +114,4 @@ class EventHistoryQuery extends IdoQuery ); return $this; } - } From aa976c41981471db10aebab436520b8b239b3a65 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 10:24:24 +0100 Subject: [PATCH 19/64] monitoring: Support host and service display_name in the EventHistoryQuery This adds two left joins to the query when selecting host_display_name and service_display_name. If performance suffers badly, we have to evaluate whether to support the display_name column for displaying the host and service name in the eventhistory overview. refs #7843 --- .../Backend/Ido/Query/EventHistoryQuery.php | 64 +++++++++++++------ 1 file changed, 45 insertions(+), 19 deletions(-) diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/EventHistoryQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/EventHistoryQuery.php index b95cb89de..306180ae6 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/EventHistoryQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/EventHistoryQuery.php @@ -11,28 +11,34 @@ class EventHistoryQuery extends IdoQuery protected $columnMap = array( 'eventhistory' => array( - 'cnt_notification' => "SUM(CASE eh.type WHEN 'notify' THEN 1 ELSE 0 END)", - 'cnt_hard_state' => "SUM(CASE eh.type WHEN 'hard_state' THEN 1 ELSE 0 END)", - 'cnt_soft_state' => "SUM(CASE eh.type WHEN 'hard_state' THEN 1 ELSE 0 END)", - 'cnt_downtime_start' => "SUM(CASE eh.type WHEN 'dt_start' THEN 1 ELSE 0 END)", - 'cnt_downtime_end' => "SUM(CASE eh.type WHEN 'dt_end' THEN 1 ELSE 0 END)", - 'host' => 'eho.name1 COLLATE latin1_general_ci', - 'service' => 'eho.name2 COLLATE latin1_general_ci', - 'host_name' => 'eho.name1 COLLATE latin1_general_ci', - 'service_description' => 'eho.name2 COLLATE latin1_general_ci', - 'object_type' => 'eh.object_type', - 'timestamp' => 'eh.timestamp', - 'state' => 'eh.state', - 'attempt' => 'eh.attempt', - 'max_attempts' => 'eh.max_attempts', - 'output' => 'eh.output', // we do not want long_output - 'type' => 'eh.type', - 'service_host_name' => 'eho.name1 COLLATE latin1_general_ci', - 'service_description' => 'eho.name2 COLLATE latin1_general_ci' + 'cnt_notification' => "SUM(CASE eh.type WHEN 'notify' THEN 1 ELSE 0 END)", + 'cnt_hard_state' => "SUM(CASE eh.type WHEN 'hard_state' THEN 1 ELSE 0 END)", + 'cnt_soft_state' => "SUM(CASE eh.type WHEN 'hard_state' THEN 1 ELSE 0 END)", + 'cnt_downtime_start' => "SUM(CASE eh.type WHEN 'dt_start' THEN 1 ELSE 0 END)", + 'cnt_downtime_end' => "SUM(CASE eh.type WHEN 'dt_end' THEN 1 ELSE 0 END)", + 'host' => 'eho.name1 COLLATE latin1_general_ci', + 'service' => 'eho.name2 COLLATE latin1_general_ci', + 'host_name' => 'eho.name1 COLLATE latin1_general_ci', + 'service_description' => 'eho.name2 COLLATE latin1_general_ci', + 'object_type' => 'eh.object_type', + 'timestamp' => 'eh.timestamp', + 'state' => 'eh.state', + 'attempt' => 'eh.attempt', + 'max_attempts' => 'eh.max_attempts', + 'output' => 'eh.output', // we do not want long_output + 'type' => 'eh.type', + 'service_host_name' => 'eho.name1 COLLATE latin1_general_ci', + 'service_description' => 'eho.name2 COLLATE latin1_general_ci' ), 'hostgroups' => array( - 'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci', + 'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci', ), + 'hosts' => array( + 'host_display_name' => 'h.display_name' + ), + 'services' => array( + 'service_display_name' => 's.display_name' + ) ); protected $useSubqueryCount = true; @@ -114,4 +120,24 @@ class EventHistoryQuery extends IdoQuery ); return $this; } + + protected function joinHosts() + { + $this->select->joinLeft( + array('h' => $this->prefix . 'hosts'), + 'h.host_object_id = eho.object_id', + array() + ); + return $this; + } + + protected function joinServices() + { + $this->select->joinLeft( + array('s' => $this->prefix . 'services'), + 's.service_object_id = eho.object_id', + array() + ); + return $this; + } } From 25c2e99122af66334f3bca794c18c967a1610cb3 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 10:26:12 +0100 Subject: [PATCH 20/64] monitoring: Fix duplicate array key 'service_description' in the EventHistoryQuery --- .../library/Monitoring/Backend/Ido/Query/EventHistoryQuery.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/EventHistoryQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/EventHistoryQuery.php index 306180ae6..e6efb1e45 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/EventHistoryQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/EventHistoryQuery.php @@ -27,8 +27,7 @@ class EventHistoryQuery extends IdoQuery 'max_attempts' => 'eh.max_attempts', 'output' => 'eh.output', // we do not want long_output 'type' => 'eh.type', - 'service_host_name' => 'eho.name1 COLLATE latin1_general_ci', - 'service_description' => 'eho.name2 COLLATE latin1_general_ci' + 'service_host_name' => 'eho.name1 COLLATE latin1_general_ci' ), 'hostgroups' => array( 'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci', From 3e702ac255a5864b35fa7a94c9e9e669a6887797 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 10:28:21 +0100 Subject: [PATCH 21/64] monitoring: Support host and service display_name in the EventHistory data view refs #7843 --- .../library/Monitoring/DataView/EventHistory.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/monitoring/library/Monitoring/DataView/EventHistory.php b/modules/monitoring/library/Monitoring/DataView/EventHistory.php index 09779b27d..f13815aae 100644 --- a/modules/monitoring/library/Monitoring/DataView/EventHistory.php +++ b/modules/monitoring/library/Monitoring/DataView/EventHistory.php @@ -1,6 +1,4 @@ array( - 'columns' => array('timestamp'), - 'order' => 'DESC' + 'columns' => array('timestamp'), + 'order' => 'DESC' ) ); } From 7ff1948c1a508bba0125cc1e3f64d99a2d528fa1 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 10:29:22 +0100 Subject: [PATCH 22/64] monitoring: Use host and service display_name for displaying host and service names in the eventhistory overview refs #7843 --- .../application/views/scripts/list/eventhistory.phtml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/monitoring/application/views/scripts/list/eventhistory.phtml b/modules/monitoring/application/views/scripts/list/eventhistory.phtml index 6d6130a3d..d96a4914b 100644 --- a/modules/monitoring/application/views/scripts/list/eventhistory.phtml +++ b/modules/monitoring/application/views/scripts/list/eventhistory.phtml @@ -110,16 +110,16 @@ use Icinga\Module\Monitoring\Object\Service; 'host' => $event->host, 'service' => $event->service )); ?>"> - escape($event->service) ?> + escape($event->service_display_name) ?> - translate('on') . ' ' . $this->escape($event->host) ?> + translate('on') . ' ' . $this->escape($event->host_display_name) ?> - escape($event->host) ?> + escape($event->host_display_name) ?>
From cd03c2164a508bf75200ed9a1486177e8d7880ed Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 10:33:05 +0100 Subject: [PATCH 23/64] monitoring: Fix sorting by 'End Time' in the downtimes overview --- .../application/controllers/ListController.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index aefe93b15..325c0d612 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -292,15 +292,15 @@ class Monitoring_ListController extends Controller $this->filterQuery($query); $this->setupSortControl(array( - 'downtime_is_in_effect' => $this->translate('Is In Effect'), - 'downtime_host' => $this->translate('Host / Service'), - 'downtime_entry_time' => $this->translate('Entry Time'), - 'downtime_author' => $this->translate('Author'), - 'downtime_start' => $this->translate('Start Time'), - 'downtime_start' => $this->translate('End Time'), - 'downtime_scheduled_start' => $this->translate('Scheduled Start'), - 'downtime_scheduled_end' => $this->translate('Scheduled End'), - 'downtime_duration' => $this->translate('Duration'), + 'downtime_is_in_effect' => $this->translate('Is In Effect'), + 'downtime_host' => $this->translate('Host / Service'), + 'downtime_entry_time' => $this->translate('Entry Time'), + 'downtime_author' => $this->translate('Author'), + 'downtime_start' => $this->translate('Start Time'), + 'downtime_end' => $this->translate('End Time'), + 'downtime_scheduled_start' => $this->translate('Scheduled Start'), + 'downtime_scheduled_end' => $this->translate('Scheduled End'), + 'downtime_duration' => $this->translate('Duration') )); $this->view->downtimes = $query->paginate(); From e881a0de33270d25d5e65600755f1744c908f571 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 10:35:10 +0100 Subject: [PATCH 24/64] monitoring: Remove useless PHPDoc in the DowntimeQuery --- .../Monitoring/Backend/Ido/Query/DowntimeQuery.php | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/DowntimeQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/DowntimeQuery.php index a53fd18e9..f9d0d93a2 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/DowntimeQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/DowntimeQuery.php @@ -1,18 +1,9 @@ array( 'downtime_author' => 'sd.author_name', @@ -39,9 +30,6 @@ class DowntimeQuery extends IdoQuery ), ); - /** - * Join with scheduleddowntime - */ protected function joinBaseTables() { $this->select->from( From 2fdeabd39831968c5e84d65230ff9f5b65c05605 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 10:47:20 +0100 Subject: [PATCH 25/64] monitoring: Escape host and service name, author and comment in the downtimes overview --- .../application/views/scripts/list/downtimes.phtml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/monitoring/application/views/scripts/list/downtimes.phtml b/modules/monitoring/application/views/scripts/list/downtimes.phtml index 8a8e5576c..616f253c7 100644 --- a/modules/monitoring/application/views/scripts/list/downtimes.phtml +++ b/modules/monitoring/application/views/scripts/list/downtimes.phtml @@ -57,20 +57,20 @@ use Icinga\Module\Monitoring\Object\Service; 'host' => $downtime->host, 'service' => $downtime->service )); ?>"> - service; ?> + escape($downtime->service) ?> - translate('on'); ?> host; ?> + translate('on'); ?> escape($downtime->host) ?> icon('host'); ?> - host; ?> + escape($downtime->host) ?>
- icon('comment'); ?> [author; ?>] comment; ?> + icon('comment') ?> [escape($downtime->author) ?>] escape($downtime->comment) ?>
is_flexible): ?> From d528ddc64118221796f8dab0f38eff008b25c39f Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 12:51:47 +0100 Subject: [PATCH 26/64] monitoring: Fix that host_display_name is NULL when the object is a service in the evenhistory overview refs #7843 --- .../Monitoring/Backend/Ido/Query/EventHistoryQuery.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/EventHistoryQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/EventHistoryQuery.php index e6efb1e45..2896f9536 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/EventHistoryQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/EventHistoryQuery.php @@ -33,7 +33,7 @@ class EventHistoryQuery extends IdoQuery 'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci', ), 'hosts' => array( - 'host_display_name' => 'h.display_name' + 'host_display_name' => 'CASE WHEN sh.display_name IS NOT NULL THEN sh.display_name ELSE h.display_name END' ), 'services' => array( 'service_display_name' => 's.display_name' @@ -137,6 +137,11 @@ class EventHistoryQuery extends IdoQuery 's.service_object_id = eho.object_id', array() ); + $this->select->joinLeft( + array('sh' => $this->prefix . 'hosts'), + 'sh.host_object_id = s.host_object_id', + array() + ); return $this; } } From 85aa447516520759d26fa10aa4ae343cff74e416 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 12:52:29 +0100 Subject: [PATCH 27/64] monitoring: Support host and service display_name in the DowntimeQuery refs #7843 --- .../Backend/Ido/Query/DowntimeQuery.php | 73 +++++++++++++------ 1 file changed, 52 insertions(+), 21 deletions(-) diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/DowntimeQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/DowntimeQuery.php index f9d0d93a2..efc10f6a5 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/DowntimeQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/DowntimeQuery.php @@ -6,28 +6,34 @@ class DowntimeQuery extends IdoQuery { protected $columnMap = array( 'downtime' => array( - 'downtime_author' => 'sd.author_name', - 'author' => 'sd.author_name', - 'downtime_comment' => 'sd.comment_data', - 'downtime_entry_time' => 'UNIX_TIMESTAMP(sd.entry_time)', - 'downtime_is_fixed' => 'sd.is_fixed', - 'downtime_is_flexible' => 'CASE WHEN sd.is_fixed = 0 THEN 1 ELSE 0 END', - 'downtime_triggered_by_id' => 'sd.triggered_by_id', - 'downtime_scheduled_start' => 'UNIX_TIMESTAMP(sd.scheduled_start_time)', - 'downtime_scheduled_end' => 'UNIX_TIMESTAMP(sd.scheduled_end_time)', - 'downtime_start' => "UNIX_TIMESTAMP(CASE WHEN UNIX_TIMESTAMP(sd.trigger_time) > 0 then sd.trigger_time ELSE sd.scheduled_start_time END)", - 'downtime_end' => 'CASE WHEN sd.is_fixed > 0 THEN UNIX_TIMESTAMP(sd.scheduled_end_time) ELSE UNIX_TIMESTAMP(sd.trigger_time) + sd.duration END', - 'downtime_duration' => 'sd.duration', - 'downtime_is_in_effect' => 'sd.is_in_effect', - 'downtime_internal_id' => 'sd.internal_downtime_id', - 'downtime_host' => 'CASE WHEN ho.name1 IS NULL THEN so.name1 ELSE ho.name1 END COLLATE latin1_general_ci', // #7278, #7279 - 'host' => 'CASE WHEN ho.name1 IS NULL THEN so.name1 ELSE ho.name1 END COLLATE latin1_general_ci', - 'downtime_service' => 'so.name2 COLLATE latin1_general_ci', - 'service' => 'so.name2 COLLATE latin1_general_ci', // #7278, #7279 - 'downtime_objecttype' => "CASE WHEN ho.object_id IS NOT NULL THEN 'host' ELSE CASE WHEN so.object_id IS NOT NULL THEN 'service' ELSE NULL END END", - 'downtime_host_state' => 'CASE WHEN hs.has_been_checked = 0 OR hs.has_been_checked IS NULL THEN 99 ELSE hs.current_state END', - 'downtime_service_state' => 'CASE WHEN ss.has_been_checked = 0 OR ss.has_been_checked IS NULL THEN 99 ELSE ss.current_state END' + 'downtime_author' => 'sd.author_name', + 'author' => 'sd.author_name', + 'downtime_comment' => 'sd.comment_data', + 'downtime_entry_time' => 'UNIX_TIMESTAMP(sd.entry_time)', + 'downtime_is_fixed' => 'sd.is_fixed', + 'downtime_is_flexible' => 'CASE WHEN sd.is_fixed = 0 THEN 1 ELSE 0 END', + 'downtime_triggered_by_id' => 'sd.triggered_by_id', + 'downtime_scheduled_start' => 'UNIX_TIMESTAMP(sd.scheduled_start_time)', + 'downtime_scheduled_end' => 'UNIX_TIMESTAMP(sd.scheduled_end_time)', + 'downtime_start' => "UNIX_TIMESTAMP(CASE WHEN UNIX_TIMESTAMP(sd.trigger_time) > 0 then sd.trigger_time ELSE sd.scheduled_start_time END)", + 'downtime_end' => 'CASE WHEN sd.is_fixed > 0 THEN UNIX_TIMESTAMP(sd.scheduled_end_time) ELSE UNIX_TIMESTAMP(sd.trigger_time) + sd.duration END', + 'downtime_duration' => 'sd.duration', + 'downtime_is_in_effect' => 'sd.is_in_effect', + 'downtime_internal_id' => 'sd.internal_downtime_id', + 'downtime_host' => 'CASE WHEN ho.name1 IS NULL THEN so.name1 ELSE ho.name1 END COLLATE latin1_general_ci', // #7278, #7279 + 'host' => 'CASE WHEN ho.name1 IS NULL THEN so.name1 ELSE ho.name1 END COLLATE latin1_general_ci', + 'downtime_service' => 'so.name2 COLLATE latin1_general_ci', + 'service' => 'so.name2 COLLATE latin1_general_ci', // #7278, #7279 + 'downtime_objecttype' => "CASE WHEN ho.object_id IS NOT NULL THEN 'host' ELSE CASE WHEN so.object_id IS NOT NULL THEN 'service' ELSE NULL END END", + 'downtime_host_state' => 'CASE WHEN hs.has_been_checked = 0 OR hs.has_been_checked IS NULL THEN 99 ELSE hs.current_state END', + 'downtime_service_state' => 'CASE WHEN ss.has_been_checked = 0 OR ss.has_been_checked IS NULL THEN 99 ELSE ss.current_state END' ), + 'hosts' => array( + 'host_display_name' => 'CASE WHEN sh.display_name IS NOT NULL THEN sh.display_name ELSE h.display_name END' + ), + 'services' => array( + 'service_display_name' => 's.display_name' + ) ); protected function joinBaseTables() @@ -58,4 +64,29 @@ class DowntimeQuery extends IdoQuery ); $this->joinedVirtualTables = array('downtime' => true); } + + protected function joinHosts() + { + $this->select->joinLeft( + array('h' => $this->prefix . 'hosts'), + 'h.host_object_id = ho.object_id', + array() + ); + return $this; + } + + protected function joinServices() + { + $this->select->joinLeft( + array('s' => $this->prefix . 'services'), + 's.service_object_id = so.object_id', + array() + ); + $this->select->joinLeft( + array('sh' => $this->prefix . 'hosts'), + 'sh.host_object_id = s.host_object_id', + array() + ); + return $this; + } } From 5f0b809619dceef06c76859adbfc087f5e53d5b3 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 12:52:58 +0100 Subject: [PATCH 28/64] monitoring: Support host and service display_name columns in the Downtime data view refs #7843 --- modules/monitoring/library/Monitoring/DataView/Downtime.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/monitoring/library/Monitoring/DataView/Downtime.php b/modules/monitoring/library/Monitoring/DataView/Downtime.php index e075d658c..508620a6b 100644 --- a/modules/monitoring/library/Monitoring/DataView/Downtime.php +++ b/modules/monitoring/library/Monitoring/DataView/Downtime.php @@ -32,7 +32,9 @@ class Downtime extends DataView 'downtime_host', 'downtime_service', 'downtime_host_state', - 'downtime_service_state' + 'downtime_service_state', + 'host_display_name', + 'service_display_name' ); } @@ -51,7 +53,7 @@ class Downtime extends DataView 'downtime_service' ), 'order' => self::SORT_ASC - ), + ) ); } } From ab6eed03e5ceb7045b70966f357aa9a13c779aea Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 12:53:26 +0100 Subject: [PATCH 29/64] monitoring: Select the host and service display_name in the downtimes overview refs #7843 --- modules/monitoring/application/controllers/ListController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index 325c0d612..dce93098c 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -285,7 +285,9 @@ class Monitoring_ListController extends Controller 'host' => 'downtime_host', 'service' => 'downtime_service', 'host_state' => 'downtime_host_state', - 'service_state' => 'downtime_service_state' + 'service_state' => 'downtime_service_state', + 'host_display_name', + 'service_display_name' ))->order('downtime_is_in_effect', 'DESC') ->order('downtime_scheduled_start', 'DESC'); From 86cc56afe6512394ed482fe99cd0559807d86fb5 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 12:53:47 +0100 Subject: [PATCH 30/64] monitoring: Display host and service names using the display_name column in the downtimes overview refs #7843 --- .../application/views/scripts/list/downtimes.phtml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/monitoring/application/views/scripts/list/downtimes.phtml b/modules/monitoring/application/views/scripts/list/downtimes.phtml index 616f253c7..98adb5883 100644 --- a/modules/monitoring/application/views/scripts/list/downtimes.phtml +++ b/modules/monitoring/application/views/scripts/list/downtimes.phtml @@ -57,16 +57,16 @@ use Icinga\Module\Monitoring\Object\Service; 'host' => $downtime->host, 'service' => $downtime->service )); ?>"> - escape($downtime->service) ?> + escape($downtime->service_display_name) ?> - translate('on'); ?> escape($downtime->host) ?> + translate('on'); ?> escape($downtime->host_display_name) ?> icon('host'); ?> - escape($downtime->host) ?> + escape($downtime->host_display_name) ?>
From d340b0d49d0867d0e6214e5b7f1086a0168cb443 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 12:55:41 +0100 Subject: [PATCH 31/64] monitoring: Let the data view handle the default ordering in the downtime overview refs #7843 --- modules/monitoring/application/controllers/ListController.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index dce93098c..79a618616 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -288,8 +288,7 @@ class Monitoring_ListController extends Controller 'service_state' => 'downtime_service_state', 'host_display_name', 'service_display_name' - ))->order('downtime_is_in_effect', 'DESC') - ->order('downtime_scheduled_start', 'DESC'); + )); $this->filterQuery($query); From 5862fc98a54a594f0d96f7084bb98789be323bfa Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 12:58:46 +0100 Subject: [PATCH 32/64] monitoring: Sort by 'downtime_scheduled_start' too when sorting by 'Is In Effect' --- modules/monitoring/library/Monitoring/DataView/Downtime.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/monitoring/library/Monitoring/DataView/Downtime.php b/modules/monitoring/library/Monitoring/DataView/Downtime.php index 508620a6b..695cb256c 100644 --- a/modules/monitoring/library/Monitoring/DataView/Downtime.php +++ b/modules/monitoring/library/Monitoring/DataView/Downtime.php @@ -42,6 +42,10 @@ class Downtime extends DataView { return array( 'downtime_is_in_effect' => array( + 'columns' => array( + 'downtime_is_in_effect', + 'downtime_scheduled_start' + ), 'order' => self::SORT_DESC ), 'downtime_start' => array( From 91b7c31cda283ac12bd092784c1e45ac02d17b14 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 13:06:03 +0100 Subject: [PATCH 33/64] monitoring: Support sorting downtimes by host and service display_name refs #7843 --- .../library/Monitoring/DataView/Downtime.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/monitoring/library/Monitoring/DataView/Downtime.php b/modules/monitoring/library/Monitoring/DataView/Downtime.php index 695cb256c..681608b17 100644 --- a/modules/monitoring/library/Monitoring/DataView/Downtime.php +++ b/modules/monitoring/library/Monitoring/DataView/Downtime.php @@ -51,10 +51,17 @@ class Downtime extends DataView 'downtime_start' => array( 'order' => self::SORT_DESC ), - 'downtime_host' => array( + 'host_display_name' => array( 'columns' => array( - 'downtime_host', - 'downtime_service' + 'host_display_name', + 'service_display_name' + ), + 'order' => self::SORT_ASC + ), + 'service_display_name' => array( + 'columns' => array( + 'service_display_name', + 'host_display_name' ), 'order' => self::SORT_ASC ) From 7621de8ec02f080444aeb0d9b796ec3812675e0f Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 13:06:32 +0100 Subject: [PATCH 34/64] monitoring: Add sort by 'Host' and 'Service' to the downtimes overview refs #7843 --- modules/monitoring/application/controllers/ListController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index 79a618616..df7081519 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -294,7 +294,8 @@ class Monitoring_ListController extends Controller $this->setupSortControl(array( 'downtime_is_in_effect' => $this->translate('Is In Effect'), - 'downtime_host' => $this->translate('Host / Service'), + 'host_display_name' => $this->translate('Host'), + 'service_display_name' => $this->translate('Service'), 'downtime_entry_time' => $this->translate('Entry Time'), 'downtime_author' => $this->translate('Author'), 'downtime_start' => $this->translate('Start Time'), From 0bcca651b223257948cc289e77d2344417ea53b0 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 13:12:26 +0100 Subject: [PATCH 35/64] monitoring: Remove useless PHPDoc in the NotificationQuery --- .../Monitoring/Backend/Ido/Query/NotificationQuery.php | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/NotificationQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/NotificationQuery.php index 00b6957b8..70962a1c0 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/NotificationQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/NotificationQuery.php @@ -1,19 +1,9 @@ array( 'notification_output' => 'n.output', From b05316340cbe9c7bb061f43a3498b017bae56437 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 15:46:41 +0100 Subject: [PATCH 36/64] monitoring: Add Link view helper Most of the monitoring overviews link to detail information, e.g. the full information of the involved monitored object. Instead of reintroducing link generation and translation in those views, this helper contains most frequently used jump links. --- .../application/views/helpers/Link.php | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 modules/monitoring/application/views/helpers/Link.php diff --git a/modules/monitoring/application/views/helpers/Link.php b/modules/monitoring/application/views/helpers/Link.php new file mode 100644 index 000000000..0d8c35861 --- /dev/null +++ b/modules/monitoring/application/views/helpers/Link.php @@ -0,0 +1,59 @@ +view->qlink( + $linkText, + $this->view->href('monitoring/host/show', array('host' => $host)) + ); + } + + /** + * Create a service link + * + * @param string $service Service name + * @param string $serviceLinkText Text for the service link, e.g. the service's display name + * @param string $host Hostname + * @param string $hostLinkText Text for the host link, e.g. the host's display name + * + * @return string + */ + public function service($service, $serviceLinkText, $host, $hostLinkText) + { + return sprintf( + $this->view->translate('%s on %s', 'Service running on host'), + $this->view->qlink( + $serviceLinkText, + $this->view->href('monitoring/service/show', array('host' => $host, 'service' => $service)) + ), + $this->host($host, $hostLinkText) + ); + } +} From d8b1e632319c307ea943c002004b1fc5331f999b Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 15:47:10 +0100 Subject: [PATCH 37/64] monitoring: Support host and service display_name in the NotificationQuery refs #7843 --- .../Backend/Ido/Query/NotificationQuery.php | 49 +++++++++++++++---- 1 file changed, 40 insertions(+), 9 deletions(-) diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/NotificationQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/NotificationQuery.php index 70962a1c0..3181eebbf 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/NotificationQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/NotificationQuery.php @@ -6,26 +6,32 @@ class NotificationQuery extends IdoQuery { protected $columnMap = array( 'notification' => array( - 'notification_output' => 'n.output', - 'notification_start_time' => 'UNIX_TIMESTAMP(n.start_time)', - 'notification_state' => 'n.state', - 'notification_object_id' => 'n.object_id' + 'notification_output' => 'n.output', + 'notification_start_time' => 'UNIX_TIMESTAMP(n.start_time)', + 'notification_state' => 'n.state', + 'notification_object_id' => 'n.object_id' ), 'objects' => array( - 'host' => 'o.name1', - 'service' => 'o.name2' + 'host' => 'o.name1', + 'service' => 'o.name2' ), 'contact' => array( - 'notification_contact' => 'c_o.name1', - 'contact_object_id' => 'c_o.object_id' + 'notification_contact' => 'c_o.name1', + 'contact_object_id' => 'c_o.object_id' ), 'command' => array( - 'notification_command' => 'cmd_o.name1' + 'notification_command' => 'cmd_o.name1' ), 'acknowledgement' => array( 'acknowledgement_entry_time' => 'UNIX_TIMESTAMP(a.entry_time)', 'acknowledgement_author_name' => 'a.author_name', 'acknowledgement_comment_data' => 'a.comment_data' + ), + 'hosts' => array( + 'host_display_name' => 'CASE WHEN sh.display_name IS NOT NULL THEN sh.display_name ELSE h.display_name END' + ), + 'services' => array( + 'service_display_name' => 's.display_name' ) ); @@ -100,4 +106,29 @@ class NotificationQuery extends IdoQuery array() ); } + + protected function joinHosts() + { + $this->select->joinLeft( + array('h' => $this->prefix . 'hosts'), + 'h.host_object_id = o.object_id', + array() + ); + return $this; + } + + protected function joinServices() + { + $this->select->joinLeft( + array('s' => $this->prefix . 'services'), + 's.service_object_id = o.object_id', + array() + ); + $this->select->joinLeft( + array('sh' => $this->prefix . 'hosts'), + 'sh.host_object_id = s.host_object_id', + array() + ); + return $this; + } } From ad879b1ee61de4ed78ad982293be2ee361bdc5ad Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 15:47:36 +0100 Subject: [PATCH 38/64] monitoring: Select the host and service display_name columns in the Notification data view refs #7843 --- .../monitoring/library/Monitoring/DataView/Notification.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/monitoring/library/Monitoring/DataView/Notification.php b/modules/monitoring/library/Monitoring/DataView/Notification.php index 6156a5f15..7f6fd238f 100644 --- a/modules/monitoring/library/Monitoring/DataView/Notification.php +++ b/modules/monitoring/library/Monitoring/DataView/Notification.php @@ -20,7 +20,9 @@ class Notification extends DataView 'notification_start_time', 'notification_contact', 'notification_output', - 'notification_command' + 'notification_command', + 'host_display_name', + 'service_display_name' ); } From 846f39108094788bc0c05b3557230ab411957946 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 15:48:04 +0100 Subject: [PATCH 39/64] monitoring: Select the host and service display_name columns in the notifications overview refs #7843 --- modules/monitoring/application/controllers/ListController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index df7081519..8e8cfa766 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -325,7 +325,9 @@ class Monitoring_ListController extends Controller 'notification_output', 'notification_contact', 'notification_start_time', - 'notification_state' + 'notification_state', + 'host_display_name', + 'service_display_name' )); $this->filterQuery($query); $this->view->notifications = $query->paginate(); From ece6bfe6bbcaeb43d5c324daf91a1ded87c4b254 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 15:48:45 +0100 Subject: [PATCH 40/64] monitoring: Use display_name for displaying the host and service name in the notifications overview refs #7843 --- .../views/scripts/list/notifications.phtml | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/modules/monitoring/application/views/scripts/list/notifications.phtml b/modules/monitoring/application/views/scripts/list/notifications.phtml index 939d46eba..5e337dd24 100644 --- a/modules/monitoring/application/views/scripts/list/notifications.phtml +++ b/modules/monitoring/application/views/scripts/list/notifications.phtml @@ -25,20 +25,13 @@ use Icinga\Module\Monitoring\Object\Service; service)) { - $isService = true; - $href = $this->href('monitoring/show/service', array( - 'host' => $notification->host, - 'service' => $notification->service - )); - $stateName = Service::getStateText($notification->notification_state); + $isService = true; + $stateName = Service::getStateText($notification->notification_state); } else { $isService = false; - $href = $this->href('monitoring/show/host', array( - 'host' => $notification->host - )); $stateName = Host::getStateText($notification->notification_state); } - ?> + ?> dateTimeRenderer($notification->notification_start_time)->render( @@ -49,12 +42,14 @@ use Icinga\Module\Monitoring\Object\Service; - translate('%s on %s'), - $this->qlink($notification->service, $href), $notification->host + link()->service( + $notification->service, + $notification->service_display_name, + $notification->host, + $notification->host_display_name ) ?> - qlink($notification->host, $href) ?> + link()->host($notification->host, $notification->host_display_name) ?>
escape(substr(strip_tags($notification->notification_output), 0, 10000)); ?> From 0ceec816c6aec832f5abbea0d5de175b4fde5029 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 15:49:36 +0100 Subject: [PATCH 41/64] monitoring: Use notifications default ordering when showing a contact --- modules/monitoring/application/controllers/ShowController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/monitoring/application/controllers/ShowController.php b/modules/monitoring/application/controllers/ShowController.php index ba865deaa..d09a0ce83 100644 --- a/modules/monitoring/application/controllers/ShowController.php +++ b/modules/monitoring/application/controllers/ShowController.php @@ -166,7 +166,7 @@ class Monitoring_ShowController extends Controller 'notification_contact', 'notification_start_time', 'notification_state' - ))->order('notification_start_time'); + )); $notifications->where('contact_object_id', $contact->contact_object_id); From b6f87df90ea2f9e0ea602dc66c61cc88a4f4e827 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 15:50:32 +0100 Subject: [PATCH 42/64] monitoring: Select the host and service display_name column when viewing notifications for a contact refs #7843 --- modules/monitoring/application/controllers/ShowController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/monitoring/application/controllers/ShowController.php b/modules/monitoring/application/controllers/ShowController.php index d09a0ce83..0b7a2f897 100644 --- a/modules/monitoring/application/controllers/ShowController.php +++ b/modules/monitoring/application/controllers/ShowController.php @@ -165,7 +165,9 @@ class Monitoring_ShowController extends Controller 'notification_output', 'notification_contact', 'notification_start_time', - 'notification_state' + 'notification_state', + 'host_display_name', + 'service_display_name' )); $notifications->where('contact_object_id', $contact->contact_object_id); From cbbd811adb9dc83dc1844182b77c8484f690fcf0 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 15:51:14 +0100 Subject: [PATCH 43/64] monitoring: Do not strip_tags in the notifications overview --- .../application/views/scripts/list/notifications.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/monitoring/application/views/scripts/list/notifications.phtml b/modules/monitoring/application/views/scripts/list/notifications.phtml index 5e337dd24..7f1de0fde 100644 --- a/modules/monitoring/application/views/scripts/list/notifications.phtml +++ b/modules/monitoring/application/views/scripts/list/notifications.phtml @@ -52,7 +52,7 @@ use Icinga\Module\Monitoring\Object\Service; link()->host($notification->host, $notification->host_display_name) ?>
- escape(substr(strip_tags($notification->notification_output), 0, 10000)); ?> + escape(substr($notification->notification_output, 0, 10000)); ?>
contact): ?> From 423e4c55a87237d68dc7f369c93a5797a0400c4c Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 15:52:24 +0100 Subject: [PATCH 44/64] monitoring: Use the ellipsis view helper in the notifications overview --- .../application/views/scripts/list/notifications.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/monitoring/application/views/scripts/list/notifications.phtml b/modules/monitoring/application/views/scripts/list/notifications.phtml index 7f1de0fde..299144821 100644 --- a/modules/monitoring/application/views/scripts/list/notifications.phtml +++ b/modules/monitoring/application/views/scripts/list/notifications.phtml @@ -52,7 +52,7 @@ use Icinga\Module\Monitoring\Object\Service; link()->host($notification->host, $notification->host_display_name) ?>
- escape(substr($notification->notification_output, 0, 10000)); ?> + escape($this->ellipsis($notification->notification_output, 10000)) ?>
contact): ?> From 439052ad973a6738b0e097cc7cd4c1d74ed8a5d2 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 15:56:58 +0100 Subject: [PATCH 45/64] monitoring: Use the link helper in the downtimes overview --- .../views/scripts/list/downtimes.phtml | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/modules/monitoring/application/views/scripts/list/downtimes.phtml b/modules/monitoring/application/views/scripts/list/downtimes.phtml index 98adb5883..485782e3c 100644 --- a/modules/monitoring/application/views/scripts/list/downtimes.phtml +++ b/modules/monitoring/application/views/scripts/list/downtimes.phtml @@ -31,8 +31,10 @@ use Icinga\Module\Monitoring\Object\Service; service)) { + $isService = true; $stateName = Service::getStateText($downtime->service_state); } else { + $isService = false; $stateName = Host::getStateText($downtime->host_state); } ?> @@ -52,22 +54,14 @@ use Icinga\Module\Monitoring\Object\Service; ?> - service)): ?> - icon('service'); ?> - escape($downtime->service_display_name) ?> - - - translate('on'); ?> escape($downtime->host_display_name) ?> - + + icon('service') ?> + link()->service( + $downtime->service, $downtime->service_display_name, $downtime->host, $downtime->host_display_name + ) ?> - icon('host'); ?> - escape($downtime->host_display_name) ?> - + icon('host') ?> + link()->host($downtime->host, $downtime->host_display_name) ?>
icon('comment') ?> [escape($downtime->author) ?>] escape($downtime->comment) ?> From 9b7e67919fb954cf2517bf7f727a71eb6f5353f0 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 15:59:20 +0100 Subject: [PATCH 46/64] monitoring: Use host and service icons in the notifications overview --- .../application/views/scripts/list/notifications.phtml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/monitoring/application/views/scripts/list/notifications.phtml b/modules/monitoring/application/views/scripts/list/notifications.phtml index 299144821..44f33851f 100644 --- a/modules/monitoring/application/views/scripts/list/notifications.phtml +++ b/modules/monitoring/application/views/scripts/list/notifications.phtml @@ -42,6 +42,7 @@ use Icinga\Module\Monitoring\Object\Service; + icon('service') ?> link()->service( $notification->service, $notification->service_display_name, @@ -49,6 +50,7 @@ use Icinga\Module\Monitoring\Object\Service; $notification->host_display_name ) ?> + icon('host') ?> link()->host($notification->host, $notification->host_display_name) ?>
From a91a2eba6895b16e50cdcdbeaf8fd3c9962b41eb Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 16:09:13 +0100 Subject: [PATCH 47/64] monitoring: Support host and service display_name columns in the CommentQuery refs #7843 --- .../Backend/Ido/Query/CommentQuery.php | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/CommentQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/CommentQuery.php index 5145a96ad..a522d702e 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/CommentQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/CommentQuery.php @@ -23,6 +23,12 @@ class CommentQuery extends IdoQuery 'comment_service' => 'so.name2 COLLATE latin1_general_ci', 'service' => 'so.name2 COLLATE latin1_general_ci', // #7278, #7279 'comment_objecttype' => "CASE WHEN ho.object_id IS NOT NULL THEN 'host' ELSE CASE WHEN so.object_id IS NOT NULL THEN 'service' ELSE NULL END END", + ), + 'hosts' => array( + 'host_display_name' => 'CASE WHEN sh.display_name IS NOT NULL THEN sh.display_name ELSE h.display_name END' + ), + 'services' => array( + 'service_display_name' => 's.display_name' ) ); @@ -44,4 +50,29 @@ class CommentQuery extends IdoQuery ); $this->joinedVirtualTables = array('comments' => true); } + + protected function joinHosts() + { + $this->select->joinLeft( + array('h' => $this->prefix . 'hosts'), + 'h.host_object_id = ho.object_id', + array() + ); + return $this; + } + + protected function joinServices() + { + $this->select->joinLeft( + array('s' => $this->prefix . 'services'), + 's.service_object_id = so.object_id', + array() + ); + $this->select->joinLeft( + array('sh' => $this->prefix . 'hosts'), + 'sh.host_object_id = s.host_object_id', + array() + ); + return $this; + } } From 94be58e121f71c9cba9409c8b5d1e9d93bcb6117 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 16:09:36 +0100 Subject: [PATCH 48/64] monitoring: Support host and service display_name columns in the Comment data view refs #7843 --- modules/monitoring/library/Monitoring/DataView/Comment.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/monitoring/library/Monitoring/DataView/Comment.php b/modules/monitoring/library/Monitoring/DataView/Comment.php index 4d62fd27c..08928b5dd 100644 --- a/modules/monitoring/library/Monitoring/DataView/Comment.php +++ b/modules/monitoring/library/Monitoring/DataView/Comment.php @@ -29,6 +29,8 @@ class Comment extends DataView 'comment_service', 'host', 'service', + 'host_display_name', + 'service_display_name' ); } From e933b9174c76611919c9ed80332d45723903e4f0 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 16:10:02 +0100 Subject: [PATCH 49/64] monitoring: Select the host and service display_name columns in the comments overview refs #7843 --- modules/monitoring/application/controllers/ListController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index 8e8cfa766..df12ff1f8 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -465,7 +465,9 @@ class Monitoring_ListController extends Controller 'persistent' => 'comment_is_persistent', 'expiration' => 'comment_expiration', 'host' => 'comment_host', - 'service' => 'comment_service' + 'service' => 'comment_service', + 'host_display_name', + 'service_display_name' )); $this->filterQuery($query); $this->view->comments = $query->paginate(); From cf391b056c99b4c111059965e7da5225cdf0d66c Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 16:12:37 +0100 Subject: [PATCH 50/64] monitoring: Use display_name for displaying the host and service names in the comments overview refs #7843 --- .../views/scripts/list/comments.phtml | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/modules/monitoring/application/views/scripts/list/comments.phtml b/modules/monitoring/application/views/scripts/list/comments.phtml index 677010f1b..29fc76d49 100644 --- a/modules/monitoring/application/views/scripts/list/comments.phtml +++ b/modules/monitoring/application/views/scripts/list/comments.phtml @@ -50,21 +50,13 @@ objecttype === 'service'): ?> - icon('conf'); ?> - service; ?> - - - translate('on') . ' ' . $comment->host; ?> - + icon('service') ?> + link()->service( + $comment->service, $comment->service_display_name, $comment->host, $comment->host_display_name + ) ?> - icon('host'); ?> - host; ?> - + icon('host') ?> + link()->host($comment->host, $comment->host_display_name) ?>
icon('comment'); ?> author) From 3055531e2db7f01ded2578f025c13977c5b7c2df Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 16:15:09 +0100 Subject: [PATCH 51/64] monitoring: Support sorting by host and service display name in the Comment data view refs #7843 --- .../library/Monitoring/DataView/Comment.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/monitoring/library/Monitoring/DataView/Comment.php b/modules/monitoring/library/Monitoring/DataView/Comment.php index 08928b5dd..4cd11e1a1 100644 --- a/modules/monitoring/library/Monitoring/DataView/Comment.php +++ b/modules/monitoring/library/Monitoring/DataView/Comment.php @@ -45,13 +45,20 @@ class Comment extends DataView 'comment_timestamp' => array( 'order' => self::SORT_DESC ), - 'comment_host' => array( + 'host_display_name' => array( 'columns' => array( - 'comment_host', - 'comment_service' + 'host_display_name', + 'service_display_name' ), 'order' => self::SORT_ASC ), + 'service_display_name' => array( + 'columns' => array( + 'service_display_name', + 'host_display_name' + ), + 'order' => self::SORT_ASC + ) ); } } From 6be0224d9d524786af9489ac0bd324bcb163da0b Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 16:15:38 +0100 Subject: [PATCH 52/64] monitoring: Add sort by 'Host' and 'Service' in the comments overview refs #7843 --- .../application/controllers/ListController.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index df12ff1f8..f5afc9a24 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -474,10 +474,11 @@ class Monitoring_ListController extends Controller $this->setupSortControl( array( - 'comment_timestamp' => $this->translate('Comment Timestamp'), - 'comment_host' => $this->translate('Host / Service'), - 'comment_type' => $this->translate('Comment Type'), - 'comment_expiration' => $this->translate('Expiration'), + 'comment_timestamp' => $this->translate('Comment Timestamp'), + 'host_display_name' => $this->translate('Host'), + 'service_display_name' => $this->translate('Service'), + 'comment_type' => $this->translate('Comment Type'), + 'comment_expiration' => $this->translate('Expiration') ) ); $this->view->delCommentForm = new DeleteCommentCommandForm(); From d064b0ac791266716b1f04298c544a954266c3a0 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 21 Jan 2015 17:29:31 +0100 Subject: [PATCH 53/64] monitoring: Rename $showService to $isService in the header view script Most views use $isService to set whether we are about to show a service. --- .../application/views/scripts/show/components/header.phtml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/monitoring/application/views/scripts/show/components/header.phtml b/modules/monitoring/application/views/scripts/show/components/header.phtml index ccf7d2d5e..25ed83cfd 100644 --- a/modules/monitoring/application/views/scripts/show/components/header.phtml +++ b/modules/monitoring/application/views/scripts/show/components/header.phtml @@ -3,7 +3,7 @@ use Icinga\Module\Monitoring\Object\Host; use Icinga\Module\Monitoring\Object\Service; -$showService = $object->getType() === $object::TYPE_SERVICE; +$isService = $object->getType() === $object::TYPE_SERVICE; ?> compact): ?> @@ -11,7 +11,7 @@ $showService = $object->getType() === $object::TYPE_SERVICE; - @@ -21,7 +21,7 @@ $showService = $object->getType() === $object::TYPE_SERVICE; - + From e61edaaffbfe88b38e5eb949e2a5ac189ee1ed0f Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 22 Jan 2015 10:30:55 +0100 Subject: [PATCH 56/64] monitoring: Show service_description in the detail area too if it's different from the display_name refs #7843 --- .../application/views/scripts/show/components/header.phtml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/monitoring/application/views/scripts/show/components/header.phtml b/modules/monitoring/application/views/scripts/show/components/header.phtml index b6ed49ed5..f0c118539 100644 --- a/modules/monitoring/application/views/scripts/show/components/header.phtml +++ b/modules/monitoring/application/views/scripts/show/components/header.phtml @@ -32,6 +32,9 @@ $isService = $object->getType() === $object::TYPE_SERVICE; From 4539462bc7039d1cbc0dbfe9b8c8781d69a72bf7 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 22 Jan 2015 10:34:35 +0100 Subject: [PATCH 57/64] monitoring: Select host_display_name in the host and service object refs #7843 --- modules/monitoring/library/Monitoring/Object/Host.php | 1 + modules/monitoring/library/Monitoring/Object/Service.php | 1 + 2 files changed, 2 insertions(+) diff --git a/modules/monitoring/library/Monitoring/Object/Host.php b/modules/monitoring/library/Monitoring/Object/Host.php index 79a760d82..eeac94cb9 100644 --- a/modules/monitoring/library/Monitoring/Object/Host.php +++ b/modules/monitoring/library/Monitoring/Object/Host.php @@ -91,6 +91,7 @@ class Host extends MonitoredObject { $columns = array( 'host_name', + 'host_display_name', 'host_alias', 'host_address', 'host_state', diff --git a/modules/monitoring/library/Monitoring/Object/Service.php b/modules/monitoring/library/Monitoring/Object/Service.php index 64bfe530b..3b7bff4fa 100644 --- a/modules/monitoring/library/Monitoring/Object/Service.php +++ b/modules/monitoring/library/Monitoring/Object/Service.php @@ -108,6 +108,7 @@ class Service extends MonitoredObject { return $this->backend->select()->from('serviceStatus', array( 'host_name', + 'host_display_name', 'host_state', 'host_state_type', 'host_last_state_change', From 3d306c0a060bebd06622c236978fc78a4f5b9eec Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 22 Jan 2015 10:35:06 +0100 Subject: [PATCH 58/64] monitoring: Use display_name for displaying the host name in the detail area refs #7843 --- .../application/views/scripts/show/components/header.phtml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/monitoring/application/views/scripts/show/components/header.phtml b/modules/monitoring/application/views/scripts/show/components/header.phtml index f0c118539..ad0a773ff 100644 --- a/modules/monitoring/application/views/scripts/show/components/header.phtml +++ b/modules/monitoring/application/views/scripts/show/components/header.phtml @@ -18,9 +18,10 @@ $isService = $object->getType() === $object::TYPE_SERVICE; prefixedTimeSince($object->host_last_state_change, true) ?> From 9e5d7f43ff2167ea46a5f8d579e127e57c323301 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 22 Jan 2015 10:36:02 +0100 Subject: [PATCH 59/64] monitoring: Show host_name in the detail area too if it's different from the display_name refs #7843 --- .../application/views/scripts/show/components/header.phtml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/monitoring/application/views/scripts/show/components/header.phtml b/modules/monitoring/application/views/scripts/show/components/header.phtml index ad0a773ff..cfd093473 100644 --- a/modules/monitoring/application/views/scripts/show/components/header.phtml +++ b/modules/monitoring/application/views/scripts/show/components/header.phtml @@ -19,6 +19,9 @@ $isService = $object->getType() === $object::TYPE_SERVICE;
> + > host_state, true)); ?>
prefixedTimeSince($object->host_last_state_change, true) ?>
service_state, true)); ?>
From 98acc9166a5b80b7dd290a5d43e0582c6b698702 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 22 Jan 2015 10:24:44 +0100 Subject: [PATCH 54/64] monitoring: Fix coding style in components/header.phtml --- .../scripts/show/components/header.phtml | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/modules/monitoring/application/views/scripts/show/components/header.phtml b/modules/monitoring/application/views/scripts/show/components/header.phtml index 25ed83cfd..b57f1a482 100644 --- a/modules/monitoring/application/views/scripts/show/components/header.phtml +++ b/modules/monitoring/application/views/scripts/show/components/header.phtml @@ -6,34 +6,34 @@ use Icinga\Module\Monitoring\Object\Service; $isService = $object->getType() === $object::TYPE_SERVICE; ?> -compact): ?> + +compact): ?> + - - - + + + - - - + + + - -
> - host_state, true)); ?>
- prefixedTimeSince($object->host_last_state_change, true) ?> -
escape($object->host_name) ?>host_address && $object->host_address !== $object->host_name): ?> -
escape($object->host_address) ?> - -
> + host_state, true)); ?>
+ prefixedTimeSince($object->host_last_state_change, true) ?> +
+ escape($object->host_name) ?> + host_address && $object->host_address !== $object->host_name): ?> +
escape($object->host_address) ?> + +
- service_state, true)); ?>
- prefixedTimeSince($object->service_last_state_change, true) ?> -
translate('Service') ?>: escape($object->service_description) ?> - - render('show/components/statusIcons.phtml') ?> - -
+ service_state, true)); ?>
+ prefixedTimeSince($object->service_last_state_change, true) ?> +
+ translate('Service') ?>: escape($object->service_description) ?> + render('show/components/statusIcons.phtml') ?> +
 
From ed7dc1beb639294ab3f25b42a76b2110b5f089f4 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 22 Jan 2015 10:29:57 +0100 Subject: [PATCH 55/64] monitoring: Use display_name when displaying the service name in the detail area refs #7843 --- .../application/views/scripts/show/components/header.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/monitoring/application/views/scripts/show/components/header.phtml b/modules/monitoring/application/views/scripts/show/components/header.phtml index b57f1a482..b6ed49ed5 100644 --- a/modules/monitoring/application/views/scripts/show/components/header.phtml +++ b/modules/monitoring/application/views/scripts/show/components/header.phtml @@ -31,7 +31,7 @@ $isService = $object->getType() === $object::TYPE_SERVICE; prefixedTimeSince($object->service_last_state_change, true) ?>
- translate('Service') ?>: escape($object->service_description) ?> + translate('Service') ?>: escape($object->service_display_name) ?> render('show/components/statusIcons.phtml') ?>
translate('Service') ?>: escape($object->service_display_name) ?> + service_display_name !== $object->service_description): ?> + (escape($object->service_description) ?>) + render('show/components/statusIcons.phtml') ?>
- escape($object->host_name) ?> + escape($object->host_display_name) ?> host_address && $object->host_address !== $object->host_name): ?> -
escape($object->host_address) ?> +
+ escape($object->host_address) ?>
escape($object->host_display_name) ?> + host_display_name !== $object->host_name): ?> + (escape($object->host_name) ?>) + host_address && $object->host_address !== $object->host_name): ?>
escape($object->host_address) ?> From a1f4d124b41da7e0aba0b7d7864ebb5da2930afa Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 22 Jan 2015 10:36:44 +0100 Subject: [PATCH 60/64] monitoring: Prefer
over
in components/header.phtml --- .../application/views/scripts/show/components/header.phtml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/monitoring/application/views/scripts/show/components/header.phtml b/modules/monitoring/application/views/scripts/show/components/header.phtml index cfd093473..7f58790f4 100644 --- a/modules/monitoring/application/views/scripts/show/components/header.phtml +++ b/modules/monitoring/application/views/scripts/show/components/header.phtml @@ -14,7 +14,7 @@ $isService = $object->getType() === $object::TYPE_SERVICE; From 1aa91f0228ccb03af277baee6d702664b8a127cb Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 22 Jan 2015 10:57:15 +0100 Subject: [PATCH 62/64] monitoring: Select host and service display_name for an object's history refs #7843 --- .../monitoring/library/Monitoring/Object/MonitoredObject.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/monitoring/library/Monitoring/Object/MonitoredObject.php b/modules/monitoring/library/Monitoring/Object/MonitoredObject.php index 2d9f1f30c..8d3246aab 100644 --- a/modules/monitoring/library/Monitoring/Object/MonitoredObject.php +++ b/modules/monitoring/library/Monitoring/Object/MonitoredObject.php @@ -408,7 +408,9 @@ abstract class MonitoredObject $eventHistory = $this->backend->select()->from('eventHistory', array( 'object_type', 'host_name', + 'host_display_name', 'service_description', + 'service_display_name', 'timestamp', 'state', 'attempt', From 4589621f58e1127db7e0309c2a55bf0017ababc5 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 22 Jan 2015 10:57:44 +0100 Subject: [PATCH 63/64] monitoring: Use host and service display_name for displaying host and service names for an object's history refs #7843 --- .../views/scripts/show/history.phtml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/modules/monitoring/application/views/scripts/show/history.phtml b/modules/monitoring/application/views/scripts/show/history.phtml index 728b9bfc1..a0cc4944e 100644 --- a/modules/monitoring/application/views/scripts/show/history.phtml +++ b/modules/monitoring/application/views/scripts/show/history.phtml @@ -136,13 +136,18 @@ $output = $this->tickets ? preg_replace_callback( ?> - qlink( - $this->escape($event->service_description), - 'monitoring/show/service', - array( - 'host' => $event->host_name, - 'service' => $event->service_description) - ) : $this->escape($event->service_description); ?> translate('on') . ' ' . $this->escape($event->host_name); ?> + translate('%s on %s', 'Service running on host'), + $hostContext ? $this->qlink( + $this->escape($event->service_display_name), + 'monitoring/show/service', + array( + 'host' => $event->host_name, + 'service' => $event->service_description + ) + ) : $this->escape($event->service_display_name), + $event->host_display_name + ) ?> escape($event->host_name); ?> From 8bd56f4387c6f579bef062926bf5b94fe6e199da Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 22 Jan 2015 10:58:16 +0100 Subject: [PATCH 64/64] monitoring: Use the Link helper in the eventhistory overview --- .../views/scripts/list/eventhistory.phtml | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/modules/monitoring/application/views/scripts/list/eventhistory.phtml b/modules/monitoring/application/views/scripts/list/eventhistory.phtml index d96a4914b..2970675e2 100644 --- a/modules/monitoring/application/views/scripts/list/eventhistory.phtml +++ b/modules/monitoring/application/views/scripts/list/eventhistory.phtml @@ -106,21 +106,11 @@ use Icinga\Module\Monitoring\Object\Service;
> - host_state, true)); ?>
+ host_state, true)); ?>
prefixedTimeSince($object->host_last_state_change, true) ?>
@@ -31,7 +31,7 @@ $isService = $object->getType() === $object::TYPE_SERVICE;
- service_state, true)); ?>
+ service_state, true)); ?>
prefixedTimeSince($object->service_last_state_change, true) ?>
From d1715c8ec6645ed163515255c46d67e65787a540 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 22 Jan 2015 10:45:14 +0100 Subject: [PATCH 61/64] monitoring: Escape event message in an object's event history --- modules/monitoring/application/views/scripts/show/history.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/monitoring/application/views/scripts/show/history.phtml b/modules/monitoring/application/views/scripts/show/history.phtml index 5b922d4a0..728b9bfc1 100644 --- a/modules/monitoring/application/views/scripts/show/history.phtml +++ b/modules/monitoring/application/views/scripts/show/history.phtml @@ -148,7 +148,7 @@ $output = $this->tickets ? preg_replace_callback(
- icon($icon, $title); ?> + icon($icon, $title); ?> escape($msg) ?>
- - escape($event->service_display_name) ?> - - - translate('on') . ' ' . $this->escape($event->host_display_name) ?> - + link()->service( + $event->service, $event->service_display_name, $event->host, $event->host_display_name + ) ?> - - escape($event->host_display_name) ?> - + link()->host($event->host, $event->host_display_name) ?>