diff options
Diffstat (limited to 'modules/monitoring/application/views/scripts/show')
22 files changed, 808 insertions, 0 deletions
diff --git a/modules/monitoring/application/views/scripts/show/components/acknowledgement.phtml b/modules/monitoring/application/views/scripts/show/components/acknowledgement.phtml new file mode 100644 index 0000000..fd7f6bb --- /dev/null +++ b/modules/monitoring/application/views/scripts/show/components/acknowledgement.phtml @@ -0,0 +1,94 @@ +<?php + +/** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */ + +if (in_array((int) $object->state, array(0, 99))) { + // Ignore this markup if the object is in a non-problem state or pending + return; +} + +if ($object->acknowledged): +$acknowledgement = $object->acknowledgement; +/** @var \Icinga\Module\Monitoring\Object\Acknowledgement $acknowledgement */ +?> +<tr> + <th><?= $this->translate('Acknowledged') ?></th> + <td data-base-target="_self"> + <?php if ($acknowledgement): ?> + <dl class="comment-list"> + <dt> + <?= $this->escape($acknowledgement->getAuthor()) ?> + <span class="comment-time"> + <?= $this->translate('acknowledged') ?> + <?= $this->timeAgo($acknowledgement->getEntryTime()) ?> + <?php if ($acknowledgement->expires()): ?> + <span aria-hidden="true">ǀ</span> + <?= sprintf( + $this->translate('Expires %s'), + $this->timeUntil($acknowledgement->getExpirationTime()) + ) ?> + <?php endif ?> + </span> + <?php if ($acknowledgement->getSticky()): ?> + <?= $this->icon('pin', sprintf( + $this->translate( + 'Acknowledgement remains until the %1$s recovers even if the %1$s changes state' + ), + $object->getType(true) + )) ?> + <?php endif ?> + <?php if (isset($removeAckForm)) { + // Form is unset if the current user lacks the respective permission + $removeAckForm->setAttrib('class', $removeAckForm->getAttrib('class') . ' remove-action'); + echo $removeAckForm; + } ?> + </dt> + <dd> + <?= $this->nl2br($this->createTicketLinks($this->markdown($acknowledgement->getComment()))) ?> + </dd> + </dl> + <?php elseif (isset($removeAckForm)): ?> + <?= $removeAckForm ?> + <?php endif ?> + </td> +</tr> +<?php else: ?> +<tr> + <th><?= $this->translate('Not acknowledged') ?></th> + <td> + <?php if ($this->hasPermission('monitoring/command/acknowledge-problem')) { + if ($object->getType() === $object::TYPE_HOST) { + $ackLink = $this->href( + 'monitoring/host/acknowledge-problem', + array('host' => $object->getName()), + null, + array('class' => 'action-link') + ); + } else { + $ackLink = $this->href( + 'monitoring/service/acknowledge-problem', + array('host' => $object->getHost()->getName(), 'service' => $object->getName()), + null, + array('class' => 'action-link') + ); + } + ?> + <?= $this->qlink( + $this->translate('Acknowledge'), + $ackLink, + null, + array( + 'class' => 'action-link', + 'data-base-target' => '_self', + 'icon' => 'edit', + 'title' => $this->translate( + 'Acknowledge this problem, suppress all future notifications for it and tag it as being handled' + ) + ) + ) ?> + <?php } else { + echo '-'; + } // endif ?> + </td> +</tr> +<?php endif ?> diff --git a/modules/monitoring/application/views/scripts/show/components/actions.phtml b/modules/monitoring/application/views/scripts/show/components/actions.phtml new file mode 100644 index 0000000..938ab2a --- /dev/null +++ b/modules/monitoring/application/views/scripts/show/components/actions.phtml @@ -0,0 +1,43 @@ +<?php + +use Icinga\Web\Navigation\Navigation; + +$navigation = new Navigation(); +$navigation->load($object->getType() . '-action'); +foreach ($navigation as $item) { + $item->setObject($object); +} + +foreach ($object->getActionUrls() as $i => $link) { + $navigation->addItem( + + // add warning to links that open in new tabs to improve accessibility, as recommended by WCAG20 G201 + $this->icon( + 'forward', + $this->translate('Link opens in new window'), + array('aria-label' => $this->translate('Link opens in new window')) + ) . ' Action ' . ($i + 1), + array( + 'url' => $link, + 'target' => '_blank', + 'renderer' => array( + 'NavigationItemRenderer', + 'escape_label' => false + ) + ) + ); +} + +if (isset($this->actions)) { + $navigation->merge($this->actions); +} + +if ($navigation->isEmpty() || ! $navigation->hasRenderableItems()) { + return; +} + +?> +<tr> + <th><?= $this->translate('Actions'); ?></th> + <?= $navigation->getRenderer()->setElementTag('td')->setCssClass('actions go-ahead'); ?> +</tr> diff --git a/modules/monitoring/application/views/scripts/show/components/checksource.phtml b/modules/monitoring/application/views/scripts/show/components/checksource.phtml new file mode 100644 index 0000000..ac9799f --- /dev/null +++ b/modules/monitoring/application/views/scripts/show/components/checksource.phtml @@ -0,0 +1,6 @@ +<?php if ($object->check_source !== null): ?> +<tr> + <th><?= $this->translate('Check Source') ?></th> + <td><?= $this->escape($object->check_source) ?></td> +</tr> +<?php endif ?> diff --git a/modules/monitoring/application/views/scripts/show/components/checkstatistics.phtml b/modules/monitoring/application/views/scripts/show/components/checkstatistics.phtml new file mode 100644 index 0000000..e37e30a --- /dev/null +++ b/modules/monitoring/application/views/scripts/show/components/checkstatistics.phtml @@ -0,0 +1,85 @@ +<?php +/** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */ +$activeChecksEnabled = (bool) $object->active_checks_enabled; +?> + +<tr> + <th><?= $activeChecksEnabled ? $this->translate('Last check') : $this->translate('Last update') ?></th> + <td data-base-target="_self"> +<?php if ((int) $object->state !== 99): ?> + <?= $this->timeAgo($object->last_check) ?> + <?php if ($object->next_update < time()): ?> + <?= $this->icon('circle', $this->translate('Check result is late'), array('class' => 'icon-stateful state-critical')) ?> + <?php endif ?> +<?php endif ?> + <?php if (isset($checkNowForm)) { // Form is unset if the current user lacks the respective permission + echo $checkNowForm; + } ?> + </td> +</tr> + +<tr> + <th><?= $activeChecksEnabled ? $this->translate('Next check') : $this->translate('Next update') ?></th> + <td> + <?php if ((int) $object->state !== 99) { + if ($activeChecksEnabled) { + echo $this->timeUntil($object->next_check); + } else { + echo sprintf($this->translate('expected %s'), $this->timeUntil($object->next_update)); + } + } ?> + <?php if ($activeChecksEnabled && $this->hasPermission('monitoring/command/schedule-check')) { + if ($object->getType() === $object::TYPE_SERVICE) { + echo $this->qlink( + $this->translate('Reschedule'), + 'monitoring/service/reschedule-check', + array('host' => $object->getHost()->getName(), 'service' => $object->getName()), + array( + 'class' => 'action-link', + 'data-base-target' => '_self', + 'icon' => 'calendar-empty', + 'title' => $this->translate( + 'Schedule the next active check at a different time than the current one' + ) + ) + ); + } else { + echo $this->qlink( + $this->translate('Reschedule'), + 'monitoring/host/reschedule-check', + array('host' => $object->getName()), + array( + 'class' => 'action-link', + 'data-base-target' => '_self', + 'icon' => 'calendar-empty', + 'title' => $this->translate( + 'Schedule the next active check at a different time than the current one' + ) + ) + ); + } + } ?> + </td> +</tr> + +<tr> + <th><?= $this->translate('Check attempts') ?></th> + <td> + <?= $object->attempt ?> + (<?= (int) $object->state_type === 0 ? $this->translate('soft state') : $this->translate('hard state') ?>) + </td> +</tr> + +<?php if ($object->check_execution_time): ?> +<tr> + <th><?= $this->translate('Check execution time') ?></th> + <td><?= round((float) $object->check_execution_time, 3) ?>s</td> +</tr> +<?php endif ?> + +<?php if ($object->check_latency): ?> +<tr> + <th><?= $this->translate('Check latency') ?></th> + <td><?= $object->check_latency ?>s</td> +</tr> +<?php endif ?> diff --git a/modules/monitoring/application/views/scripts/show/components/checktimeperiod.phtml b/modules/monitoring/application/views/scripts/show/components/checktimeperiod.phtml new file mode 100644 index 0000000..34c4eb9 --- /dev/null +++ b/modules/monitoring/application/views/scripts/show/components/checktimeperiod.phtml @@ -0,0 +1,21 @@ +<?php if (isset($object->service_check_timeperiod)): ?> + +<tr> + <th><?= $this->translate('Check Timeperiod') ?></th> + <td> + <?= $object->service_check_timeperiod ?> + </td> +</tr> + +<?php endif ?> + +<?php if (isset($object->host_check_timeperiod)): ?> + + <tr> + <th><?= $this->translate('Check Timeperiod') ?></th> + <td> + <?= $object->host_check_timeperiod ?> + </td> + </tr> + +<?php endif ?> diff --git a/modules/monitoring/application/views/scripts/show/components/command.phtml b/modules/monitoring/application/views/scripts/show/components/command.phtml new file mode 100644 index 0000000..9b51458 --- /dev/null +++ b/modules/monitoring/application/views/scripts/show/components/command.phtml @@ -0,0 +1,52 @@ +<?php +$parts = explode('!', $object->check_command); +$command = array_shift($parts); + +if ($showInstance): ?> +<tr> + <th><?= $this->translate('Instance') ?></th> + <td><?= $this->escape($object->instance_name) ?></td> +</tr> +<?php endif ?> +<tr> + <th><?= $this->translate('Command') ?></th> + <td> + <?= $this->escape($command) ?> + <?php if ($this->hasPermission('monitoring/command/process-check-result') && $object->passive_checks_enabled) { + $title = sprintf( + $this->translate('Submit a one time or so called passive result for the %s check'), $command + ); + if ($object->getType() === $object::TYPE_HOST) { + echo $this->qlink( + $this->translate('Process check result'), + 'monitoring/host/process-check-result', + array('host' => $object->getName()), + array( + 'class' => 'action-link', + 'data-base-target' => '_self', + 'icon' => 'edit', + 'title' => $title + ) + ); + } else { + echo $this->qlink( + $this->translate('Process check result'), + 'monitoring/service/process-check-result', + array('host' => $object->getHost()->getName(), 'service' => $object->getName()), + array( + 'class' => 'action-link', + 'data-base-target' => '_self', + 'icon' => 'edit', + 'title' => $title + ) + ); + } + } ?> + </td> +</tr> + +<?php +$row = "<tr>\n <th>%s</th>\n <td>%s</td>\n</tr>\n"; +for ($i = 0; $i < count($parts); $i++) { + printf($row, '$ARG' . ($i + 1) . '$', $this->escape($parts[$i])); +} diff --git a/modules/monitoring/application/views/scripts/show/components/comments.phtml b/modules/monitoring/application/views/scripts/show/components/comments.phtml new file mode 100644 index 0000000..fd980ee --- /dev/null +++ b/modules/monitoring/application/views/scripts/show/components/comments.phtml @@ -0,0 +1,86 @@ +<?php +$addLink = false; +if ($this->hasPermission('monitoring/command/comment/add')) { + /** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */ + if ($object->getType() === $object::TYPE_HOST) { + $addLink = $this->qlink( + $this->translate('Add comment'), + 'monitoring/host/add-comment', + array('host' => $object->getName()), + array( + 'class' => 'action-link', + 'data-base-target' => '_self', + 'icon' => 'comment-empty', + 'title' => $this->translate('Add a new comment to this host') + ) + ); + } else { + $addLink = $this->qlink( + $this->translate('Add comment'), + 'monitoring/service/add-comment', + array('host' => $object->getHost()->getName(), 'service' => $object->getName()), + array( + 'class' => 'action-link', + 'data-base-target' => '_self', + 'icon' => 'comment-empty', + 'title' => $this->translate('Add a new comment to this service') + ) + ); + } +} +if (empty($object->comments) && ! $addLink) { + return; +} +?> +<tr> + <th><?php + echo $this->translate('Comments'); + if (! empty($object->comments) && $addLink) { + echo '<br>' . $addLink; + } + ?></th> + <td data-base-target="_self"> + <?php if (empty($object->comments)): + echo $addLink; + else: ?> + <dl class="comment-list"> + <?php foreach ($object->comments as $comment): ?> + <dt> + <a data-base-target="_next" href="<?= $this->href('monitoring/comment/show', array('comment_id' => $comment->id)) ?>"> + <?= $this->escape($comment->author) ?> + <span class="comment-time"> + <?= $this->translate('commented') ?> + <?= $this->timeAgo($comment->timestamp) ?> + <?php if ($comment->expiration): ?> + <span aria-hidden="true">ǀ</span> + <?= sprintf( + $this->translate('Expires %s'), + $this->timeUntil($comment->expiration) + ) ?> + <?php endif ?> + </span> + </a> + <?= $comment->persistent ? $this->icon('attach', 'This comment is persistent.') : '' ?> + <?php if (isset($delCommentForm)) { + // Form is unset if the current user lacks the respective permission + $deleteButton = clone($delCommentForm); + /** @var \Icinga\Module\Monitoring\Forms\Command\Object\DeleteCommentCommandForm $deleteButton */ + $deleteButton->setAttrib('class', $deleteButton->getAttrib('class') . ' remove-action'); + $deleteButton->populate( + array( + 'comment_id' => $comment->id, + 'comment_is_service' => isset($comment->service_description), + 'comment_name' => $comment->name + ) + ); + echo $deleteButton; + } ?> + </dt> + <dd> + <?= $this->nl2br($this->createTicketLinks($this->markdownLine($comment->comment, [ 'class' => 'caption']))) ?> + </dd> + <?php endforeach ?> + </dl> + <?php endif ?> + </td> +</tr> diff --git a/modules/monitoring/application/views/scripts/show/components/contacts.phtml b/modules/monitoring/application/views/scripts/show/components/contacts.phtml new file mode 100644 index 0000000..5661c1a --- /dev/null +++ b/modules/monitoring/application/views/scripts/show/components/contacts.phtml @@ -0,0 +1,38 @@ +<?php + +if ($object->contacts->hasResult()) { + + $list = array(); + foreach ($object->contacts as $contact) { + $list[] = $this->qlink( + $contact->contact_alias, + 'monitoring/show/contact', + array('contact_name' => $contact->contact_name), + array('title' => sprintf($this->translate('Show detailed information about %s'), $contact->contact_alias)) + ); + } + + printf( + "<tr><th>%s</th><td class=\"go-ahead\">%s</td></tr>\n", + $this->translate('Contacts'), + implode(', ', $list) + ); +} + +if ($object->contactgroups->hasResult()) { + $list = array(); + foreach ($object->contactgroups as $contactgroup) { + $list[] = $this->qlink( + $contactgroup->contactgroup_alias, + 'monitoring/list/contactgroups', + array('contactgroup_name' => $contactgroup->contactgroup_name), + array('title' => sprintf($this->translate('List contacts in contact-group "%s"'), $contactgroup->contactgroup_alias)) + ); + } + + printf( + "<tr><th>%s</th><td class=\"go-ahead\">%s</td></tr>\n", + $this->translate('Contactgroups'), + implode(', ', $list) + ); +} diff --git a/modules/monitoring/application/views/scripts/show/components/downtime.phtml b/modules/monitoring/application/views/scripts/show/components/downtime.phtml new file mode 100644 index 0000000..618d4d9 --- /dev/null +++ b/modules/monitoring/application/views/scripts/show/components/downtime.phtml @@ -0,0 +1,109 @@ +<?php +$addLink = false; +if ($this->hasPermission('monitoring/command/downtime/schedule')) { + /** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */ + if ($object->getType() === $object::TYPE_HOST) { + $addLink = $this->qlink( + $this->translate('Schedule downtime'), + 'monitoring/host/schedule-downtime', + array('host' => $object->getName()), + array( + 'class' => 'action-link', + 'data-base-target' => '_self', + 'icon' => 'plug', + 'title' => $this->translate( + 'Schedule a downtime to suppress all problem notifications within a specific period of time' + ) + ) + ); + } else { + $addLink = $this->qlink( + $this->translate('Schedule downtime'), + 'monitoring/service/schedule-downtime', + array('host' => $object->getHost()->getName(), 'service' => $object->getName()), + array( + 'class' => 'action-link', + 'data-base-target' => '_self', + 'icon' => 'plug', + 'title' => $this->translate( + 'Schedule a downtime to suppress all problem notifications within a specific period of time' + ) + ) + ); + } +} +if (empty($object->downtimes) && ! $addLink) { + return; +} +?> +<tr> + <th><?php + echo $this->translate('Downtimes'); + if (! empty($object->downtimes) && $addLink) { + echo '<br>' . $addLink; + } + ?></th> + <td data-base-target="_self"> + <?php if (empty($object->downtimes)): + echo $addLink; + else: ?> + <dl class="comment-list"> + <?php foreach ($object->downtimes as $downtime): + if ((bool) $downtime->is_in_effect) { + $state = sprintf( + $this->translate('expires %s', 'Last format parameter represents the downtime expire time'), + $this->timeUntil($downtime->end, false, true) + ); + } else { + if ($downtime->start <= time()) { + $state = sprintf( + $this->translate('ends %s', 'Last format parameter represents the end time'), + $this->timeUntil($downtime->is_flexible ? $downtime->scheduled_end : $downtime->end, false, true) + ); + } else { + $state = sprintf( + $this->translate('scheduled %s', 'Last format parameter represents the time scheduled'), + $this->timeUntil($downtime->start, false, true) + ) . ' ' . sprintf( + $this->translate('expires %s', 'Last format parameter represents the downtime expire time'), + $this->timeUntil($downtime->is_flexible ? $downtime->scheduled_end : $downtime->end, false, true) + ); + } + } + ?> + <dt> + <?= $this->escape(sprintf( + $downtime->is_flexible + ? $this->translate('Flexible downtime by %s') + : $this->translate('Fixed downtime by %s'), + $downtime->author_name + )) ?> + <span class="comment-time"> + <?= $state ?> + <span aria-hidden="true">ǀ</span> + <?= $this->translate('created') ?> + <?= $this->timeAgo($downtime->entry_time) ?> + </span> + <?php if (isset($delDowntimeForm)) { + // Form is unset if the current user lacks the respective permission + $deleteButton = clone($delDowntimeForm); + /** @var \Icinga\Module\Monitoring\Forms\Command\Object\DeleteDowntimeCommandForm $deleteButton */ + $deleteButton->setAttrib('class', $deleteButton->getAttrib('class') . ' remove-action'); + $deleteButton->populate( + array( + 'downtime_id' => $downtime->id, + 'downtime_is_service' => $object->getType() === $object::TYPE_SERVICE, + 'downtime_name' => $downtime->name + ) + ); + echo $deleteButton; + } ?> + </dt> + <dd> + <?= $this->nl2br($this->createTicketLinks($this->markdown($downtime->comment))) ?> + </dd> + <?php endforeach ?> + </dl> + <?php endif ?> + </td> +</tr> diff --git a/modules/monitoring/application/views/scripts/show/components/extensions.phtml b/modules/monitoring/application/views/scripts/show/components/extensions.phtml new file mode 100644 index 0000000..263b7e4 --- /dev/null +++ b/modules/monitoring/application/views/scripts/show/components/extensions.phtml @@ -0,0 +1,4 @@ +<?php +foreach ($extensionsHtml as $extensionHtml) { + echo $extensionHtml; +} diff --git a/modules/monitoring/application/views/scripts/show/components/flags.phtml b/modules/monitoring/application/views/scripts/show/components/flags.phtml new file mode 100644 index 0000000..871a4dd --- /dev/null +++ b/modules/monitoring/application/views/scripts/show/components/flags.phtml @@ -0,0 +1,4 @@ +<div data-base-target="_self"> + <h2><?= $this->translate('Feature Commands') ?></h2> + <?= $toggleFeaturesForm ?> +</div> diff --git a/modules/monitoring/application/views/scripts/show/components/flapping.phtml b/modules/monitoring/application/views/scripts/show/components/flapping.phtml new file mode 100644 index 0000000..f09b107 --- /dev/null +++ b/modules/monitoring/application/views/scripts/show/components/flapping.phtml @@ -0,0 +1,14 @@ +<?php + +if ($object->is_flapping) { + printf( + "<tr><th>%s</th><td>%s %s</td></tr>\n", + 'Flapping', + $this->icon('flapping', 'Flapping'), + sprintf( + 'Currently flapping with a %.2f%% state change rate', + $object->percent_state_change + ) + ); +} + diff --git a/modules/monitoring/application/views/scripts/show/components/grapher.phtml b/modules/monitoring/application/views/scripts/show/components/grapher.phtml new file mode 100644 index 0000000..0b49e63 --- /dev/null +++ b/modules/monitoring/application/views/scripts/show/components/grapher.phtml @@ -0,0 +1,6 @@ +<?php if (isset($graphers)) { + foreach ($graphers as $grapher) { + echo $grapher->getPreviewHtml($object); + } +} ?> + diff --git a/modules/monitoring/application/views/scripts/show/components/hostgroups.phtml b/modules/monitoring/application/views/scripts/show/components/hostgroups.phtml new file mode 100644 index 0000000..377b56f --- /dev/null +++ b/modules/monitoring/application/views/scripts/show/components/hostgroups.phtml @@ -0,0 +1,19 @@ +<?php + +if (empty($object->hostgroups)) return; + +$list = array(); +foreach ($object->hostgroups as $name => $alias) { + $list[] = $this->qlink( + $alias, + 'monitoring/list/hosts', + array('hostgroup_name' => $name), + array('title' => sprintf($this->translate('List all hosts in the group "%s"'), $alias)) + ); +} +printf( + "<tr><th>%s</th><td class=\"go-ahead\">%s</td></tr>\n", + $this->translate('Hostgroups'), + implode(', ', $list) +); + diff --git a/modules/monitoring/application/views/scripts/show/components/notes.phtml b/modules/monitoring/application/views/scripts/show/components/notes.phtml new file mode 100644 index 0000000..c868c95 --- /dev/null +++ b/modules/monitoring/application/views/scripts/show/components/notes.phtml @@ -0,0 +1,48 @@ +<?php + +use Icinga\Web\Navigation\Navigation; + +/** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */ + +$navigation = new Navigation(); +$notes = trim($object->notes); + +$links = $object->getNotesUrls(); +if (! empty($links)) { + foreach ($links as $link) { + $navigation->addItem( + // add warning to links that open in new tabs to improve accessibility, as recommended by WCAG20 G201 + $this->icon( + 'forward', + $this->translate('Link opens in new window'), + array('aria-label' => $this->translate('Link opens in new window')) + ) . ' ' . $this->escape($link), + array( + 'url' => $link, + 'target' => '_blank', + 'renderer' => array( + 'NavigationItemRenderer', + 'escape_label' => false + ) + ) + ); + } +} + +if (($navigation->isEmpty() || ! $navigation->hasRenderableItems()) && $notes === '') { + return; +} +?> +<tr> + <th><?= $this->translate('Notes') ?></th> + <td> + <?= $navigation->getRenderer() ?> + <?php if ($notes !== ''): ?> + <?= $this->markdown($notes, [ + 'id' => $object->type . '-notes', + 'class' => 'collapsible', + 'data-visible-height' => 200 + ]) ?> + <?php endif ?> + </td> +</tr>
\ No newline at end of file diff --git a/modules/monitoring/application/views/scripts/show/components/notifications.phtml b/modules/monitoring/application/views/scripts/show/components/notifications.phtml new file mode 100644 index 0000000..3e8c665 --- /dev/null +++ b/modules/monitoring/application/views/scripts/show/components/notifications.phtml @@ -0,0 +1,68 @@ +<tr> + <th><?= $this->translate('Notifications') ?></th> + <td> + <?php + /** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */ + if ($this->hasPermission('monitoring/command/send-custom-notification')) { + if ($object->getType() === $object::TYPE_HOST) { + /** @var \Icinga\Module\Monitoring\Object\Host $object */ + echo $this->qlink( + $this->translate('Send notification'), + 'monitoring/host/send-custom-notification', + array('host' => $object->getName()), + array( + 'class' => 'action-link', + 'data-base-target' => '_self', + 'icon' => 'bell', + 'title' => $this->translate( + 'Send a custom notification to contacts responsible for this host' + ) + ) + ); + } else { + /** @var \Icinga\Module\Monitoring\Object\Service $object */ + echo $this->qlink( + $this->translate('Send notification'), + 'monitoring/service/send-custom-notification', + array('host' => $object->getHost()->getName(), 'service' => $object->getName()), + array( + 'class' => 'action-link', + 'data-base-target' => '_self', + 'icon' => 'bell', + 'title' => $this->translate( + 'Send a custom notification to contacts responsible for this service' + ) + ) + ); + } + if (! in_array((int) $object->state, array(0, 99))) { + echo '<br>'; + } + } elseif (in_array((int) $object->state, array(0, 99))) { + echo '-'; + } + // We are not interested in notifications for OK or pending objects + if (! in_array((int) $object->state, array(0, 99))) { + if ($object->current_notification_number > 0) { + if ((int) $object->current_notification_number === 1) { + $msg = sprintf( + $this->translate('A notification has been sent for this issue %s.'), + $this->timeAgo($object->last_notification) + ); + } else { + $msg = sprintf( + $this->translate('%d notifications have been sent for this issue.'), + $object->current_notification_number + ) . '<br>' . sprintf( + $this->translate('The last one was sent %s.'), + $this->timeAgo($object->last_notification) + ); + } + } else { + $msg = $this->translate('No notification has been sent for this issue.'); + } + echo $msg; + } + ?> + </td> +</tr> diff --git a/modules/monitoring/application/views/scripts/show/components/output.phtml b/modules/monitoring/application/views/scripts/show/components/output.phtml new file mode 100644 index 0000000..34d8268 --- /dev/null +++ b/modules/monitoring/application/views/scripts/show/components/output.phtml @@ -0,0 +1,5 @@ +<h2><?= $this->translate('Plugin Output') ?></h2> +<div id="check-output-<?= $this->escape(str_replace(' ', '-', $object->check_command)) ?>" class="collapsible" data-visible-height="100"> + <?= $this->pluginOutput($object->output, false, $object->check_command) ?> + <?= $this->pluginOutput($object->long_output, false, $object->check_command) ?> +</div> diff --git a/modules/monitoring/application/views/scripts/show/components/perfdata.phtml b/modules/monitoring/application/views/scripts/show/components/perfdata.phtml new file mode 100644 index 0000000..78ea6d2 --- /dev/null +++ b/modules/monitoring/application/views/scripts/show/components/perfdata.phtml @@ -0,0 +1,4 @@ +<?php if ($object->perfdata): ?> +<h2><?= $this->translate('Performance data') ?></h2> +<div id="check-perfdata-<?= $this->escape(str_replace(' ', '-', $object->check_command)) ?>"><?= $this->perfdata($object->perfdata) ?></div> +<?php endif ?> diff --git a/modules/monitoring/application/views/scripts/show/components/reachable.phtml b/modules/monitoring/application/views/scripts/show/components/reachable.phtml new file mode 100644 index 0000000..8d55e84 --- /dev/null +++ b/modules/monitoring/application/views/scripts/show/components/reachable.phtml @@ -0,0 +1,15 @@ +<?php if ($object->is_reachable !== null): ?> +<tr> + <th> + <?= $this->translate('Reachable') ?> + </th> + <td> + <span class="check-source-meta"><?= (bool) $object->is_reachable ? $this->translate('yes') : $this->translate('no') ?></span> + <?php if ((bool) $object->is_reachable) { + echo $this->icon('circle', $this->translate('Is reachable'), array('class' => 'icon-stateful state-ok')); + } else { + echo $this->icon('circle', $this->translate('Not reachable'), array('class' => 'icon-stateful state-critical')); + } ?> + </td> +</tr> +<?php endif ?> diff --git a/modules/monitoring/application/views/scripts/show/components/servicegroups.phtml b/modules/monitoring/application/views/scripts/show/components/servicegroups.phtml new file mode 100644 index 0000000..09ff248 --- /dev/null +++ b/modules/monitoring/application/views/scripts/show/components/servicegroups.phtml @@ -0,0 +1,20 @@ +<?php + +if (empty($object->servicegroups)) return; + +$list = array(); +foreach ($object->servicegroups as $name => $alias) { + $list[] = $this->qlink( + $alias, + 'monitoring/list/services', + array('servicegroup_name' => $name), + array('title' => sprintf($this->translate('List all services in the group "%s"'), $alias)) + ); +} + +printf( + "<tr><th>%s</th><td class=\"go-ahead\">%s</td></tr>\n", + $this->translate('Servicegroups'), + implode(', ', $list) +); + diff --git a/modules/monitoring/application/views/scripts/show/components/status.phtml b/modules/monitoring/application/views/scripts/show/components/status.phtml new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/modules/monitoring/application/views/scripts/show/components/status.phtml diff --git a/modules/monitoring/application/views/scripts/show/contact.phtml b/modules/monitoring/application/views/scripts/show/contact.phtml new file mode 100644 index 0000000..b0fce72 --- /dev/null +++ b/modules/monitoring/application/views/scripts/show/contact.phtml @@ -0,0 +1,67 @@ +<?php $contactHelper = $this->getHelper('ContactFlags') ?> +<div class="controls"> + <?php if (! $this->compact): ?> + <?= $this->tabs; ?> + <?php endif ?> + <h1><?= $this->translate('Contact details') ?></h1> + +<?php if (! $contact): ?> + <?= $this->translate('No such contact') ?>: <?= $contactName ?> +</div> +<?php return; endif ?> + + <table class="name-value-table"> + <tbody> + <tr> + <th></th> + <td><strong><?= $this->escape($contact->contact_alias) ?></strong> (<?= $contact->contact_name ?>)</td> + </tr> +<?php if ($contact->contact_email): ?> + <tr> + <th><?= $this->translate('Email') ?></th> + <td> + <a href="mailto:<?= $contact->contact_email; ?>" title="<?= sprintf($this->translate('Send a mail to %s'), $contact->contact_alias); ?>" aria-label="<?= sprintf($this->translate('Send a mail to %s'), $contact->contact_alias); ?>"> + <?= $this->escape($contact->contact_email); ?> + </a> + </td> + </tr> +<?php endif ?> +<?php if ($contact->contact_pager): ?> + <tr> + <th><?= $this->translate('Pager') ?></th> + <td><?= $this->escape($contact->contact_pager) ?></td> + </tr> +<?php endif ?> + <tr> + <th><?= $this->translate('Hosts') ?></th> + <td><?= $this->escape($contactHelper->contactFlags($contact, 'host')) ?><br /> + <?= $this->escape($contact->contact_notify_host_timeperiod) ?></td> + </tr> + <tr> + <th><?= $this->translate('Services') ?></th> + <td><?= $this->escape($contactHelper->contactFlags($contact, 'service')) ?><br /> + <?= $this->escape($contact->contact_notify_service_timeperiod) ?></td> + </tr> + </tbody> + </table> + <?php if (count($commands)): ?> + <h1><?= $this->translate('Commands') ?>:</h1> + <ul> + <?php foreach ($commands as $command): ?> + <li><?= $command->command_name ?></li> + <?php endforeach ?> + </ul> + <?php endif ?> + <h1><?= $this->translate('Notifications sent to this contact') ?></h1> + <?= $this->limiter; ?> + <?= $this->paginator; ?> +</div> + +<?php if (count($notifications)): ?> +<?= $this->partial('list/notifications.phtml', array( + 'notifications' => $notifications, + 'compact' => true +)); ?> +<?php else: ?> +<div class="content"><?= $this->translate('No notifications have been sent for this contact') ?></div> +<?php endif ?> |