diff --git a/modules/monitoring/application/controllers/HostsController.php b/modules/monitoring/application/controllers/HostsController.php index 19b501a88..2c9ebc20e 100644 --- a/modules/monitoring/application/controllers/HostsController.php +++ b/modules/monitoring/application/controllers/HostsController.php @@ -10,6 +10,7 @@ use Icinga\Module\Monitoring\Forms\Command\Object\ProcessCheckResultCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\RemoveAcknowledgementCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\ScheduleHostCheckCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\ScheduleHostDowntimeCommandForm; +use Icinga\Module\Monitoring\Forms\Command\Object\AddCommentCommandForm; use Icinga\Module\Monitoring\Object\Host; use Icinga\Module\Monitoring\Object\HostList; use Icinga\Web\Url; @@ -36,7 +37,12 @@ class Monitoring_HostsController extends Controller 'host_problem', 'host_handled', 'host_acknowledged', - 'host_in_downtime' + 'host_in_downtime', + 'host_last_ack', + 'host_is_flapping', + 'host_last_comment', + 'host_output', + 'host_notifications_enabled' )); $form @@ -87,9 +93,13 @@ class Monitoring_HostsController extends Controller 'host_problem', 'host_handled', 'host_acknowledged', - 'host_in_downtime'/*, + 'host_in_downtime', + 'host_last_ack', + 'host_is_flapping', + 'host_last_comment', + 'host_output', + 'host_notifications_enabled',/*, 'host_passive_checks_enabled', - 'host_notifications_enabled', 'host_event_handler_enabled', 'host_flap_detection_enabled', 'host_active_checks_enabled', @@ -133,6 +143,8 @@ class Monitoring_HostsController extends Controller $this->view->rescheduleAllLink = Url::fromRequest()->setPath('monitoring/hosts/reschedule-check'); $this->view->downtimeAllLink = Url::fromRequest()->setPath('monitoring/hosts/schedule-downtime'); $this->view->processCheckResultAllLink = Url::fromRequest()->setPath('monitoring/hosts/process-check-result'); + $this->view->addCommentLink = Url::fromRequest()->setPath('monitoring/hosts/add-comment'); + $this->view->deleteCommentLink = Url::fromRequest()->setPath('monitoring/hosts/delete-comment'); $this->view->hostStates = $hostStates; $this->view->objects = $this->hostList; $this->view->unhandledObjects = $unhandledObjects; @@ -149,6 +161,18 @@ class Monitoring_HostsController extends Controller ->setPath('monitoring/list/comments'); } + /** + * Add a host comments + */ + public function addCommentAction() + { + $this->assertPermission('monitoring/command/comment/add'); + + $form = new AddCommentCommandForm(); + $form->setTitle($this->translate('Add Host Comments')); + $this->handleCommandForm($form); + } + /** * Acknowledge host problems */ diff --git a/modules/monitoring/application/views/scripts/hosts/show.phtml b/modules/monitoring/application/views/scripts/hosts/show.phtml index 8655a31b1..b6cb454bf 100644 --- a/modules/monitoring/application/views/scripts/hosts/show.phtml +++ b/modules/monitoring/application/views/scripts/hosts/show.phtml @@ -1,116 +1,224 @@ + +
+ + compact): ?> + + + +

+ qlink( + sprintf($this->translate('%d Hosts Selected'), count($objects)), + $listAllLink + ); ?> +

+ render('partials/host/objects-header.phtml'); ?>
+
+

+ icon('reschedule') ?> + translate('Commands') ?> +

+ + translate('No hosts matching the filter'); ?> -

translatePlural('%u Host', '%u Hosts', $hostCount), $hostCount); ?>

-
qlink( - sprintf($this->translate('List all %u hosts'), $hostCount), - $listAllLink - ); ?>
+ +

-
qlink( - sprintf($this->translate('Reschedule the next check for all %u hosts'), $hostCount), - $rescheduleAllLink, - null, - array('icon' => 'reschedule') - ); ?>
-
qlink( - sprintf($this->translate('Schedule a downtime for all %u hosts'), $hostCount), - $downtimeAllLink, - null, - array('icon' => 'plug') - ); ?>
-
qlink( - sprintf($this->translate('Submit a passive check result for all %u hosts'), $hostCount), - $processCheckResultAllLink, - null, - array('icon' => 'reply') - ); ?>
- 0): ?> +
-

translatePlural( - '%u Unhandled Host Problem', - '%u Unhandled Host Problems', - $unhandledCount - ), - $unhandledCount - ); ?>

-
qlink( - sprintf( - $this->translatePlural( - 'Schedule a downtime for %u unhandled host problem', - 'Schedule a downtime for %u unhandled host problems', - $unhandledCount - ), - $unhandledCount - ), - $downtimeUnhandledLink, + qlink( + $this->translate('Reschedule the next check'), + $rescheduleAllLink, + null, + array('icon' => 'reschedule') + ); ?> +
+ +
+ qlink( + $this->translate('Schedule a downtime'), + $downtimeAllLink, null, array('icon' => 'plug') - ); ?>
-
qlink( - sprintf( - $this->translatePlural( - 'Acknowledge %u unhandled host problem', - 'Acknowledge %u unhandled host problems', + ); ?> +
+ +
+ qlink( + $this->translate('Submit a passive check result'), + $processCheckResultAllLink, + null, + array('icon' => 'reply') + ); ?> +
+ +
+ qlink( + $this->translate('Add a comment'), + $addCommentLink, + null, + array('icon' => 'comment') + ); ?> +
+

+ + 0): ?> +
+

+ icon('attention-alt') ?> + translatePlural( + 'Unhandled Problem', + 'Unhandled Problems', + $unhandledCount + ) ?> +

+ + +

+ ' . $unhandledCount . '' + ) ?> + +

qlink( + sprintf( + $this->translatePlural( + 'Schedule a downtime for %u host', + 'Schedule a downtime for %u hosts', + $unhandledCount + ), + $unhandledCount + ), + $downtimeUnhandledLink, + null, + array('icon' => 'plug') + ); ?>
+ + +
qlink( + sprintf( + $this->translatePlural( + 'Acknowledge %u unhandled host', + 'Acknowledge %u unhandled hosts', + $unhandledCount + ), $unhandledCount ), - $unhandledCount - ), - $acknowledgeUnhandledLink, - null, - array('icon' => 'ok') - ); ?>
+ $acknowledgeUnhandledLink, + null, + array('icon' => 'ok') + ); ?>
+ +

+
+ 0): ?>
-

icon('ok', $this->translate('Acknowledgements')) ?> translate('Acknowledgements') ?>

+ +

translatePlural( '%u Acknowledged Host Problem', '%u Acknowledged Host Problems', $acknowledgedCount ), $acknowledgedCount - ); ?> + ); ?>

+
+ 0): ?> -

qlink( - sprintf( + +

translate('Downtimes') ?>

+

translatePlural( - 'List %u host currently in downtime', - 'List %u hosts currently in downtime', + '%u Host currently in downtime.', + '%u Hosts currently in downtime.', $inDowntimeCount ), $inDowntimeCount - ), - $inDowntimeLink, - null, - array('icon' => 'plug') - ); ?> + ) ?> qlink( + $this->translate('Alle anzeigen'), + $inDowntimeLink, + null + ); ?> + +

+ getComments())) > 0): ?> -

qlink( - sprintf( +

translate('Comments') ?>

+

+ translatePlural( - 'List %u host comment', - 'List %u host comments', + 'There is %u host comment.', + 'There are %u host comments.', $commentCount ), $commentCount - ), - $commentsLink, - null, - array('icon' => 'comment') - ); ?> + ) ?> + + qlink( + $this->translate('List all'), + $commentsLink, + null + ); ?> + +

+ + + + fetchComments(); ?> + comments as $comment): ?> + + + + + + +
+ populate( + array('comment_id' => $comment->id, 'redirect' => html_entity_decode($this->url)) + ); + $delCommentForm->setAction( + $this->url( + 'monitoring/service/delete-comment', + array('host' => $service->getName()) + ) + ); + echo $delCommentForm; + ?> + (type) ?>): + + comment) ?> +
+ + +
\ No newline at end of file diff --git a/modules/monitoring/application/views/scripts/partials/host/objects-header.phtml b/modules/monitoring/application/views/scripts/partials/host/objects-header.phtml index cd79bce5b..6c910d46a 100644 --- a/modules/monitoring/application/views/scripts/partials/host/objects-header.phtml +++ b/modules/monitoring/application/views/scripts/partials/host/objects-header.phtml @@ -1,16 +1,91 @@ -compact): ?> - - + + + + + 0): ?> -
-

- translatePlural('Host (%u)', 'Hosts (%u)', $hostCount), $hostCount); ?> -

-
-
- $count): ?> - translate(strtoupper($text)), $count); ?>
- -
+ +

+ + + + + + + + + + + + + 5) { + $desc = $host->getName(); + $hidden[] = $desc; + $hiddenRich[] = sprintf("
%s", $host->getStateText($host->host_state) ,$desc); + continue; + } + ?> + + + + + + + + + + + + + + + + +
icon('host'); ?> translate('Host'); ?>translate('Output'); ?>
host_state, true); ?>
+ host_handled && $host->host_state > 0): ?> + icon('attention-alt', $this->translate('Unhandled')) ?> + + + host_acknowledged && !$host->host_in_downtime): ?> + icon('ok', $this->translate('Acknowledged') . ( + $host->host_last_ack ? ': ' . $host->host_last_ack : '' + )) ?> + + + host_is_flapping): ?> + icon('flapping', $this->translate('Flapping')) ?> + + + host_notifications_enabled): ?> + icon('bell-off-empty', $this->translate('Notifications Disabled')) ?> + + + host_in_downtime): ?> + icon('plug', $this->translate('In Downtime')) ?> + + + host_last_comment) && $host->host_last_comment !== null): ?> + icon('comment', $this->translate('Last Comment: ') . $host->host_last_comment) ?> + + escape($host->getName()); ?>

escape($host->host_output) ?>

+
+ +
+
+

+ + + + +