HTML changes in the monitoring module

This commit is contained in:
Thomas Gelf 2014-02-18 19:17:33 +00:00
parent 158b137cdb
commit 0942a94958
12 changed files with 508 additions and 468 deletions

View File

@ -67,30 +67,30 @@
<td> <td>
<?php if ($comment->comment_objecttype_id === '1'): ?> <?php if ($comment->comment_objecttype_id === '1'): ?>
<i class="icinga-icon-host" rel="tooltip" title="Host comment" ></i> <?= $this->img('img/icons/host.png', array('title' => 'Host comment')) ?>
<?php elseif ($comment->comment_objecttype_id === '2'): ?> <?php elseif ($comment->comment_objecttype_id === '2'): ?>
<i class="icinga-icon-service" rel="tooltip" title="Service comment"></i> <?= $this->img('img/icons/service.png', array('title' => 'Service comment')) ?>
<?php endif; ?> <?php endif; ?>
<small> <small>
<?php <?php
switch ($comment->comment_type) { switch ($comment->comment_type) {
case 'flapping': case 'flapping':
$icon = 'icinga-icon-flapping'; $icon = 'flapping';
$tooltip = 'Comment was caused by a flapping host or service.'; $tooltip = 'Comment was caused by a flapping host or service.';
break; break;
case 'comment': case 'comment':
$icon = 'icinga-icon-user'; $icon = 'user';
$tooltip = 'Comment was created by an user.'; $tooltip = 'Comment was created by an user.';
break; break;
case 'downtime': case 'downtime':
$icon = 'icinga-icon-down'; $icon = 'down';
$tooltip = 'Comment was caused by a downtime.'; $tooltip = 'Comment was caused by a downtime.';
case 'ack': case 'ack':
$icon = 'icinga-icon-acknowledgement'; $icon = 'acknowledgement';
$tooltip = 'Comment was caused by an acknowledgement.'; $tooltip = 'Comment was caused by an acknowledgement.';
} }
?> ?>
<i class="<?= $icon ?>" rel="tooltip" title="<?= $tooltip ?>"> </i> <?= $this->img('img/icons/' . $icon . '.png', array('title' => $tooltip)) ?>
</small> </small>
</td> </td>

View File

@ -1,115 +1,185 @@
<div class="row"> <div class="controls">
<div class="pull-left"> <?= $this->tabs ?>
<h1>Hostgroups</h1>
</div>
<div class="pull-right">
<?= $this->tabs->render($this); ?>
</div>
</div>
<div data-icinga-component="app/mainDetailGrid" data-icinga-grid-selection-type="single">
<div class="container pull-left">
<div class="row">
<div class="col-md-12">
<?= $this->sortControl->render($this); ?>
</div>
</div>
<div class="row">
<div class="col-md-12">
<?= $this->paginationControl($hostgroups, null, null, array('preserve' => $this->preserve)); ?> <?= $this->paginationControl($hostgroups, null, null, array('preserve' => $this->preserve)); ?>
</div> <table class="action wide">
</div> <thead>
<br />
<div class="row">
<?= $this->selectionToolbar('single'); ?>
</div>
</div>
<table class="table table-condensed pull-left">
<tbody>
<?php foreach($hostgroups as $hostgroup): ?>
<tr> <tr>
<td> <th style="width: 40%; padding-left: 1em;">Hosts</th>
<a href="<?= $this->href('monitoring/list/services', array('hostgroup' => $hostgroup->hostgroup)); ?>"> <th style="width: 60%; padding-left: 1em;">Services</th>
<?= $hostgroup->hostgroup; ?> </tr>
</a> </thead>
</td> </table>
<td>
<div class="nav navbar-nav topbar-host-status-summary">
<span class="topbar-status-up">
<a href="<?= $this->href('monitoring/list/hosts', array('host_state' => 0, 'hostgroup' => $hostgroup->hostgroup)); ?>" title="Hosts Up">
<?= $hostgroup->hosts_up ?>
</a>
</span>
<span class="topbar-status-down">
<a href="<?= $this->href('monitoring/list/hosts', array('host_state' => 1, 'host_unhandled' => 1, 'hostgroup' => $hostgroup->hostgroup)); ?>" title="Hosts Down Unhandled">
<?= $hostgroup->hosts_down_unhandled ?>
</a>/
<a href="<?= $this->href('monitoring/list/hosts', array('host_state' => 1, 'host_handled' => 1, 'hostgroup' => $hostgroup->hostgroup)); ?>" title="Hosts Down Handled">
<?= $hostgroup->hosts_down_handled ?>
</a>
</span>
<span class="topbar-status-unreachable">
<a href="<?= $this->href('monitoring/list/hosts', array('host_state' => 2, 'host_unhandled' => 1, 'hostgroup' => $hostgroup->hostgroup)); ?>" title="Hosts Unreachable Unhandled">
<?= $hostgroup->hosts_unreachable_unhandled ?>
</a>/
<a href="<?= $this->href('monitoring/list/hosts', array('host_state' => 2, 'host_handled' => 1, 'hostgroup' => $hostgroup->hostgroup)); ?>" title="Hosts Unreachable Handled">
<?= $hostgroup->hosts_unreachable_handled ?>
</a>
</span>
<span class="topbar-status-pending">
<a href="<?= $this->href('monitoring/list/hosts', array('host_state' => 99)); ?>" title="Hosts Pending">
<?= $hostgroup->hosts_pending ?>
</a>
</span>
</div> </div>
<table class="action wide">
<tbody>
<?php foreach($hostgroups as $h): ?>
<tr>
<td style="width: 40%" class="summary">
<a href="<?= $this->href(
'monitoring/list/services',
array('hostgroup' => $h->hostgroup))
?>"><?= $h->hostgroup; ?></a>
<?php if ($h->hosts_up): ?>
<!-- Hosts UP -->
<span class="state up">
<a href="<?= $this->href(
'monitoring/list/hosts',
array('host_state' => 0, 'hostgroup' => $h->hostgroup)
) ?>" title="Hosts Up"><?= $h->hosts_up ?> Hosts UP</a>
</span>
<!-- End of hosts UP -->
<?php endif ?>
<?php if ($h->hosts_down): ?>
<!-- Hosts DOWN -->
<span class="state down">
<a href="<?= $this->href(
'monitoring/list/hosts',
array('host_state' => 1, 'hostgroup' => $h->hostgroup)
) ?>" title="Hosts Up"><?= $h->hosts_down ?> Hosts DOWN: </a>
<?php if ($h->hosts_down_unhandled): ?>
<a href="<?= $this->href(
'monitoring/list/hosts',
array(
'host_state' => 1,
'host_unhandled' => 1,
'hostgroup' => $h->hostgroup
)
) ?>" title="Hosts Down Unhandled"><?= $h->hosts_down_unhandled ?> Unhandled</a>
<?php endif ?>
</span>
<?php if ($h->hosts_down_handled): ?>
<span class="state down handled">
<a href="<?= $this->href(
'monitoring/list/hosts',
array(
'host_state' => 1,
'host_handled' => 1,
'hostgroup' => $h->hostgroup
)
) ?>" title="Hosts Down Handled"><?= $h->hosts_down_handled ?></a>
</span>
<?php endif ?>
<!-- End of hosts DOWN -->
<?php endif ?>
<?php if ($h->hosts_pending): ?>
<!-- Hosts PENDING -->
<span class="state pending">
<a href="<?= $this->href(
'monitoring/list/hosts',
array('host_state' => 99)
) ?>" title="Hosts Pending"><?= $h->hosts_pending ?> pending</a>
</span>
<!-- End of hosts PENDING -->
<?php endif ?>
</td> </td>
<td> <td style="width: 60%" class="summary">
<div class="nav navbar-nav topbar-service-status-summary"> <?php if ($h->services_ok): ?>
<span class="topbar-status-ok"> <!-- Services OK -->
<a href="<?= $this->href('monitoring/list/services', array('service_state' => 0, 'hostgroup' => $hostgroup->hostgroup)); ?>" title="Services Ok"> <span class="state ok">
<?= $hostgroup->services_ok ?> <a href="<?= $this->href(
'monitoring/list/services',
array(
'service_state' => 0,
'hostgroup' => $h->hostgroup)
) ?>" title="Services Ok"><?= $h->services_ok ?> OK</a>
</span>
<!-- End of services OK -->
<?php endif ?>
<?php if ($h->services_critical): ?>
<!-- Services CRITICAL -->
<span class="state critical">
<a href="<?= $this->href(
'monitoring/list/services',
array(
'service_state' => 2,
'hostgroup' => $h->hostgroup
)) ?>" title="Services Critical"><?= $h->services_critical ?> CRITICAL: </a>
<?php if ($h->services_critical_unhandled): ?>
<a href="<?= $this->href(
'monitoring/list/services',
array(
'service_state' => 2,
'service_unhandled' => 1,
'hostgroup' => $h->hostgroup
)
) ?>" title="Services Critical Unhandled"><?= $h->services_critical_unhandled ?> Unhandled</a>
<?php endif ?>
<?php if ($h->services_critical_handled): ?>
<span class="state critical handled">
<a href="<?= $this->href('monitoring/list/services', array('service_state' => 2, 'service_handled' => 1, 'hostgroup' => $h->hostgroup)); ?>" title="Services Critical Handled">
<?= $h->services_critical_handled ?> Handled
</a> </a>
</span> </span>
<span class="topbar-status-critical"> <?php endif ?>
<a href="<?= $this->href('monitoring/list/services', array('service_state' => 2, 'service_unhandled' => 1, 'hostgroup' => $hostgroup->hostgroup)); ?>" title="Services Critical Unhandled"> </span>
<?= $hostgroup->services_critical_unhandled ?> <!-- End of services CRITICAL -->
</a>/ <?php endif ?>
<a href="<?= $this->href('monitoring/list/services', array('service_state' => 2, 'service_handled' => 1, 'hostgroup' => $hostgroup->hostgroup)); ?>" title="Services Critical Handled">
<?= $hostgroup->services_critical_handled ?> <?php if ($h->services_warning): ?>
<!-- Services WARNING -->
<span class="state warning">
<a href="<?= $this->href('monitoring/list/services', array('service_state' => 1, 'hostgroup' => $h->hostgroup)); ?>" title="Services Warning">
<?= $h->services_warning ?> WARNING: </a>
<?php if ($h->services_warning_unhandled): ?>
<a href="<?= $this->href('monitoring/list/services', array('service_state' => 1, 'service_unhandled' => 1, 'hostgroup' => $h->hostgroup)); ?>" title="Services Warning Unhandled">
<?= $h->services_warning_unhandled ?> Unhandled</a>
<?php endif ?>
<?php if ($h->services_warning_handled): ?>
<span class="state warning handled">
<a href="<?= $this->href('monitoring/list/services', array('service_state' => 1, 'service_handled' => 1, 'hostgroup' => $h->hostgroup)); ?>" title="Services Warning Handled">
<?= $h->services_warning_handled ?> Handled
</a> </a>
</span> </span>
<span class="topbar-status-warning"> <?php endif ?>
<a href="<?= $this->href('monitoring/list/services', array('service_state' => 1, 'service_unhandled' => 1, 'hostgroup' => $hostgroup->hostgroup)); ?>" title="Services Warning Unhandled">
<?= $hostgroup->services_warning_unhandled ?>
</a>/
<a href="<?= $this->href('monitoring/list/services', array('service_state' => 1, 'service_handled' => 1, 'hostgroup' => $hostgroup->hostgroup)); ?>" title="Services Warning Handled">
<?= $hostgroup->services_warning_handled ?>
</a>
</span> </span>
<span class="topbar-status-unknown"> <!-- End of WARNING services -->
<a href="<?= $this->href('monitoring/list/services', array('service_state' => 3, 'service_unhandled' => 1, 'hostgroup' => $hostgroup->hostgroup)); ?>" title="Services Unknown Unhandled"> <?php endif ?>
<?= $hostgroup->services_unknown_unhandled ?>
</a>/
<a href="<?= $this->href('monitoring/list/services', array('service_state' => 3, 'service_handled' => 1, 'hostgroup' => $hostgroup->hostgroup)); ?>" title="Services Unknown Handled"> <?php if ($h->services_unknown): ?>
<?= $hostgroup->services_unknown_handled ?> <!-- Services UNKNOWN -->
</a> <span class="state unknown">
<a href="<?= $this->href(
'monitoring/list/services',
array('service_state' => 3, 'hostgroup' => $h->hostgroup)
) ?>" title="Services Unknown"><?= $h->services_unknown ?> UNKNOWN: </a>
<?php if ($h->services_unknown_unhandled): ?>
<a href="<?= $this->href('monitoring/list/services', array('service_state' => 3, 'service_unhandled' => 1, 'hostgroup' => $h->hostgroup)); ?>" title="Services Unknown Unhandled">
<?= $h->services_unknown_unhandled ?> Unhandled</a>
<?php endif ?>
<?php if ($h->services_unknown_handled): ?>
<span class="state unknown handled">
<a href="<?= $this->href(
'monitoring/list/services',
array(
'service_state' => 3,
'service_handled' => 1,
'hostgroup' => $h->hostgroup
)
) ?>" title="Services Unknown Handled"><?= $h->services_unknown_handled ?> Handled</a>
</span> </span>
<span class="topbar-status-pending"> <?php endif ?>
<a href="<?= $this->href('monitoring/list/services', array('service_state' => 99, 'hostgroup' => $hostgroup->hostgroup)); ?>" title="Services Pending">
<?= $hostgroup->services_pending ?>
</a>
</span> </span>
</div> <!-- End of UNKNOWN services -->
<?php endif ?>
<?php if ($h->services_pending): ?>
<span class="state pending">
<a href="<?= $this->href(
'monitoring/list/services',
array('service_state' => 99, 'hostgroup' => $h->hostgroup)
) ?>" title="Services Pending"><?= $h->services_pending ?></a>
</span>
<?php endif ?>
</td> </td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</tbody> </tbody>
</table> </table>
<div class="container pull-left">
<?= $this->paginationControl($hostgroups, null, null, array('preserve' => $this->preserve)); ?>
</div>
</div>

View File

@ -1,23 +1,26 @@
<h1><?= $this->escape($this->title) ?></h1>
<?php <?php
$viewHelper = $this->getHelper('MonitoringState');
?>
<div data-icinga-component="app/mainDetailGrid" data-icinga-grid-selection-type="multi">
<table class="table table-condensed" style="font-size:9pt" >
if ($hosts->count() === 0) {
echo '<p>No host found</p>';
return;
}
?><table class="action">
<tbody> <tbody>
<?php
<?php foreach($hosts as $host): ?> $helper = $this->getHelper('MonitoringState');
<?php $hostStateName = strtolower($this->util()->getHostStateName($host->host_state)); ?> foreach($hosts as $host):
<?php $hostLink = $this->href('monitoring/show/host', array('host' => $host->host_name)); ?>
<tr <?= ($this->activeRowHref === $hostLink) ? 'class="active"' : ''; ?> >
<!-- Color column --> $hostStateName = strtolower($this->util()->getHostStateName($host->host_state));
<td class="tacheader-status-<?= $hostStateName; ?>"> $hostLink = $this->href('monitoring/show/host', array('host' => $host->host_name));
<a style="visibility:hidden" href="<?= $hostLink; ?>"></a>
</td> ?>
<tr class="state <?= $hostStateName ?><?= $host->host_handled ? ' handled' : '' ?>">
<!-- Icons --> <!-- Icons -->
<td> <!-- <td>
<?php if (!$host->host_handled && $host->host_state > 0): ?> <?php if (!$host->host_handled && $host->host_state > 0): ?>
<a href="#" title="Unhandled"> <a href="#" title="Unhandled">
<i class="icon-table icinga-icon-unhandled"></i> <i class="icon-table icinga-icon-unhandled"></i>
@ -60,28 +63,22 @@ $viewHelper = $this->getHelper('MonitoringState');
<?php endif; ?> <?php endif; ?>
<?php endif; ?> <?php endif; ?>
<?php if ($host->host_last_comment !== null): ?> <?php if (isset($host->host_last_comment) && $host->host_last_comment !== null): ?>
<a href="#" title="Comments"> <a href="#" title="Comments">
<i class="icon-table icinga-icon-comment"></i> <i class="icon-table icinga-icon-comment"></i>
</a> </a>
<?php endif; ?> <?php endif; ?>
</td> </td>
-->
<!-- State --> <!-- State -->
<td title="<?= $viewHelper->getStateTitle($host, 'host'); ?>"> <td title="<?= $helper->getStateTitle($host, 'host') ?>" class="state">
<a href="<?= $this->href('monitoring/list/services', array('host' => $host->host_name)) ?>"> <?= $this->timeSince($host->host_last_state_change) ?>
<strong><?= $host->host_name ?></strong>
</a>
</td> </td>
<td> <td>
<div class="output-text"> <a href="<?= $hostLink ?>"><?= $host->host_name ?></a><br />
<?= $this->escape(substr(strip_tags($host->host_output), 0, 10000)); ?> <?= $this->escape(substr(strip_tags($host->host_output), 0, 10000)); ?>
</div>
</td> </td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach ?>
</tbody> </tbody>
</table> </table>
</div>

View File

@ -1,50 +1,36 @@
<?php <?php
$viewHelper = $this->getHelper('MonitoringState'); $viewHelper = $this->getHelper('MonitoringState');
?> ?>
<div class="row"> <div class="controls">
<div class="pull-left"> <?= $this->tabs ?>
<h1>Hosts Status</h1>
</div>
<div class="pull-right">
<?= $this->tabs->render($this); ?>
</div>
</div>
<div data-icinga-component="app/mainDetailGrid" data-icinga-grid-selection-type="multi">
<div class="container pull-left">
<div class="row">
<div class="col-md-5">
<?= $this->filterBox->render($this); ?> <?= $this->filterBox->render($this); ?>
</div> <?= $this->sortControl->render($this); ?><br />
<div class="col-md-7">
<?= $this->sortControl->render($this); ?>
</div>
</div>
<div class="row">
<?= $this->paginationControl($hosts, null, null, array('preserve' => $this->preserve)); ?> <?= $this->paginationControl($hosts, null, null, array('preserve' => $this->preserve)); ?>
</div>
<div class="row">
<?= $this->selectionToolbar('multi', $this->href('monitoring/multi/host',array( 'host' => '*' ))); ?> <?= $this->selectionToolbar('multi', $this->href('monitoring/multi/host',array( 'host' => '*' ))); ?>
</div> </div>
</div> <div class="content">
<?php
if ($hosts->count() === 0) {
echo '<p>No host found</p>';
return;
}
?>
<table class="table table-condensed pull-left"> <table class="action multiselect">
<tbody> <tbody>
<?php foreach($hosts as $host): ?> <?php foreach($hosts as $host): ?>
<?php $hostStateName = strtolower($this->util()->getHostStateName($host->host_state)); ?> <?php $hostStateName = strtolower($this->util()->getHostStateName($host->host_state)); ?>
<?php $hostLink = $this->href('monitoring/show/host', array('host' => $host->host_name)); ?> <?php $hostLink = $this->href('monitoring/show/host', array('host' => $host->host_name)); ?>
<tr> <!--<tr> -->
<tr class="state <?= $hostStateName ?><?= $host->host_handled ? ' handled' : '' ?>">
<!-- Color column --> <!-- Color column -->
<td class="tacheader-status-<?= $hostStateName; ?>"> <!-- <td class="tacheader-status-<?= $hostStateName; ?>">
<a style="visibility:hidden" href="<?= $hostLink; ?>"></a> <a style="visibility:hidden" href="<?= $hostLink; ?>"></a>
</td> </td>
-->
<!-- Icons --> <!-- Icons -->
<td> <!-- <td>
<?php if (!$host->host_handled && $host->host_state > 0): ?> <?php if (!$host->host_handled && $host->host_state > 0): ?>
<a href="#" title="Unhandled"> <a href="#" title="Unhandled">
<i class="icon-table icinga-icon-unhandled"></i> <i class="icon-table icinga-icon-unhandled"></i>
@ -87,17 +73,17 @@ $viewHelper = $this->getHelper('MonitoringState');
<?php endif; ?> <?php endif; ?>
<?php endif; ?> <?php endif; ?>
<?php if ($host->host_last_comment !== null): ?> <?php if (isset($host->host_last_comment) && $host->host_last_comment !== null): ?>
<a href="#" title="Comments"> <a href="#" title="Comments">
<i class="icon-table icinga-icon-comment"></i> <i class="icon-table icinga-icon-comment"></i>
</a> </a>
<?php endif; ?> <?php endif; ?>
</td> </td>
-->
<!-- State --> <!-- State -->
<td title="<?= $viewHelper->getStateTitle($host, 'host'); ?>"> <td class="state" title="<?= $viewHelper->getStateTitle($host, 'host'); ?>">
<div> <div>
<?php if ($host->host_unhandled_service_count): ?> <?php if (isset($host->host_unhandled_service_count) && $host->host_unhandled_service_count > 0): ?>
<span class="badge pull-right" title="<?= $host->host_unhandled_service_count; ?> Service Problems on Host"> <span class="badge pull-right" title="<?= $host->host_unhandled_service_count; ?> Service Problems on Host">
<a data-icinga-target="detail" href="<?= $this->href('monitoring/list/services', array('host' => $host->host_name, 'service_problem' => 1)); ?>"> <a data-icinga-target="detail" href="<?= $this->href('monitoring/list/services', array('host' => $host->host_name, 'service_problem' => 1)); ?>">
<?= $host->host_unhandled_service_count; ?> <?= $host->host_unhandled_service_count; ?>
@ -110,8 +96,7 @@ $viewHelper = $this->getHelper('MonitoringState');
Since <?= $this->timeSince($host->host_last_state_change); ?> Since <?= $this->timeSince($host->host_last_state_change); ?>
<?php if ($host->host_state > 0): ?> <?php if ($host->host_state > 0): ?>
<br /> <br />
<strong>Attempt:</strong> <?= $host->host_current_check_attempt; ?>/<?= $host->host_max_check_attempts; ?> <strong><?= ($host->host_state_type === '1') ? 'Hard' : 'Soft'; ?> </strong> <?= $host->host_current_check_attempt; ?>/<?= $host->host_max_check_attempts; ?>
(<?= ($host->host_state_type === '1') ? 'Hard' : 'Soft'; ?>)
<?php endif; ?> <?php endif; ?>
</div> </div>
</div> </div>
@ -136,8 +121,4 @@ $viewHelper = $this->getHelper('MonitoringState');
<?php endforeach; ?> <?php endforeach; ?>
</tbody> </tbody>
</table> </table>
<div class="pull-left">
<?= $this->paginationControl($hosts, null, null, array('preserve' => $this->preserve)); ?>
</div>
</div> </div>

View File

@ -1,13 +1,12 @@
<?php <h1><?= $this->escape($this->title) ?></h1>
$viewHelper = $this->getHelper('MonitoringState'); <table class="action">
?>
<div data-icinga-component="app/mainDetailGrid" data-icinga-grid-selection-type="multi">
<table class="table table-condensed pull-left">
<tbody> <tbody>
<?php foreach ($services as $service): ?>
<?php <?php
$helper = $this->getHelper('MonitoringState');
foreach ($services as $service):
$serviceLink = $this->href( $serviceLink = $this->href(
'monitoring/show/service', 'monitoring/show/service',
array( array(
@ -17,14 +16,15 @@ $viewHelper = $this->getHelper('MonitoringState');
); );
$hostLink = $this->href( $hostLink = $this->href(
'monitoring/show/host', 'monitoring/show/host',
array( array('host' => $service->host_name)
'host' => $service->host_name,
)
); );
$serviceStateName = strtolower($this->util()->getServiceStateName($service->service_state)); $serviceStateName = strtolower($this->util()->getServiceStateName($service->service_state));
?> ?>
<tr <?= ($this->activeRowHref === $serviceLink) ? 'class="active"' : ''; ?>> <!-- <tr <?= ($this->activeRowHref === $serviceLink) ? 'class="active"' : ''; ?>>-->
<tr class="state <?= $serviceStateName ?><?= $service->service_handled ? ' handled' : '' ?>">
<!-- Color column --> <!-- Color column -->
<!--
<td class="tacheader-status-<?= $serviceStateName; ?>"> <td class="tacheader-status-<?= $serviceStateName; ?>">
<a style="visibility:hidden" href="<?= $serviceLink; ?>"></a> <a style="visibility:hidden" href="<?= $serviceLink; ?>"></a>
</td> </td>
@ -72,36 +72,26 @@ $viewHelper = $this->getHelper('MonitoringState');
<?php endif; ?> <?php endif; ?>
<?php endif; ?> <?php endif; ?>
<?php if ($service->service_last_comment !== null): ?> <?php if (isset($service->service_last_comment) && $service->service_last_comment !== null): ?>
<a href="#" title="Comments"> <a href="#" title="Comments">
<i class="icon-table icinga-icon-comment"></i> <i class="icon-table icinga-icon-comment"></i>
</a> </a>
<?php endif; ?> <?php endif; ?>
</td> </td>
-->
<td title="<?= $viewHelper->getStateTitle($service, 'service'); ?>"> <td class="state" title="<?= $helper->getStateTitle($service, 'service'); ?>">
<strong><?= ucfirst($viewHelper->monitoringState($service, 'service')); ?></strong><br /> <?= $this->timeSince($service->service_last_state_change); ?>
<div class="small-row">
Since <?= $this->timeSince($service->service_last_state_change); ?>
<?php if ($service->service_state): ?>
<br />
<strong>Attempt:</strong>
<?= $service->service_attempt; ?>
(<?= ($service->service_state_type === '1') ? 'Hard' : 'Soft'; ?>)
<?php endif; ?>
</div>
</div> </div>
</td> </td>
<td>
<td title="<?= $viewHelper->getStateTitle($service, 'host'); ?>"> <a href="<?= $serviceLink ?>"><?= $service->service_display_name ?></a> on <a href="<?= $hostLink ?>"><?= $service->host_name; ?></a><br />
<div class="output-text"> <div class="output-text">
<?= $this->escape(substr(strip_tags($service->service_output), 0, 10000)); ?> <?= $this->escape(substr(strip_tags($service->service_output), 0, 10000)); ?>
</div> </div>
</td> </td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</tbody> </tbody>
</table> </table>
</div>

View File

@ -1,37 +1,23 @@
<?php <?php
$viewHelper = $this->getHelper('MonitoringState'); $helper = $this->getHelper('MonitoringState');
?> ?>
<div class="row"> <div class="controls">
<div class="pull-left"> <?= $this->tabs ?>
<h1>Services Status</h1> <div style="display: inline-block; margin: 1em; vertical-align: top;">
</div>
<div class="pull-right">
<?= $this->tabs->render($this); ?>
</div>
</div>
<div data-icinga-component="app/mainDetailGrid" data-icinga-grid-selection-type="multi">
<div class="container pull-left">
<div class="row">
<div class="col-md-5">
<?= $this->filterBox->render($this); ?> <?= $this->filterBox->render($this); ?>
</div> </div>
<div class="col-md-7"> <div style="display: inline-block; margin: 1em; vertical-align: top;">
<?= $this->sortControl->render($this); ?> <?= $this->sortControl->render($this); ?>
</div> </div><br />
</div> <?= $this->selectionToolbar('multi', $this->href('monitoring/multi/service', array( 'service' => '*', 'host' => '*' ))); ?> <?= $this->paginationControl($services, null, null, array('preserve' => $this->preserve)); ?>
<div class="row">
<?= $this->paginationControl($services, null, null, array('preserve' => $this->preserve)); ?>
</div>
<div class="row">
<?= $this->selectionToolbar('multi', $this->href('monitoring/multi/service', array( 'service' => '*', 'host' => '*' ))); ?>
</div>
</div> </div>
<table class="table table-condensed pull-left"> <div class="content">
<table class="action multiselect">
<tbody> <tbody>
<?php foreach ($services as $service): ?>
<?php <?php
foreach ($services as $service):
$serviceLink = $this->href( $serviceLink = $this->href(
'monitoring/show/service', 'monitoring/show/service',
array( array(
@ -47,8 +33,10 @@ $viewHelper = $this->getHelper('MonitoringState');
); );
$serviceStateName = strtolower($this->util()->getServiceStateName($service->service_state)); $serviceStateName = strtolower($this->util()->getServiceStateName($service->service_state));
?> ?>
<tr <?= ($this->activeRowHref === $serviceLink) ? 'class="active"' : ''; ?>> <!-- <tr <?= ($this->activeRowHref === $serviceLink) ? 'class="active"' : ''; ?>>-->
<tr class="state <?= $serviceStateName ?><?= $service->service_handled ? ' handled' : '' ?>">
<!-- Color column --> <!-- Color column -->
<!--
<td class="tacheader-status-<?= $serviceStateName; ?>"> <td class="tacheader-status-<?= $serviceStateName; ?>">
<a style="visibility:hidden" href="<?= $serviceLink; ?>"></a> <a style="visibility:hidden" href="<?= $serviceLink; ?>"></a>
</td> </td>
@ -96,54 +84,42 @@ $viewHelper = $this->getHelper('MonitoringState');
<?php endif; ?> <?php endif; ?>
<?php endif; ?> <?php endif; ?>
<?php if ($service->service_last_comment !== null): ?> <?php if (isset($service->service_last_comment) && $service->service_last_comment !== null): ?>
<a href="#" title="Comments"> <a href="#" title="Comments">
<i class="icon-table icinga-icon-comment"></i> <i class="icon-table icinga-icon-comment"></i>
</a> </a>
<?php endif; ?> <?php endif; ?>
</td> </td>
-->
<td title="<?= $viewHelper->getStateTitle($service, 'service'); ?>"> <td class="state" title="<?= $helper->getStateTitle($service, 'service'); ?>">
<strong><?= ucfirst($viewHelper->monitoringState($service, 'service')); ?></strong><br /> <strong><?= ucfirst($helper->monitoringState($service, 'service')); ?></strong><br />
<div class="small-row"> <div class="small-row">
Since <?= $this->timeSince($service->service_last_state_change); ?> Since <?= $this->timeSince($service->service_last_state_change); ?>
<?php if ($service->service_state): ?> <?php if ($service->service_state): ?>
<br /> <br />
<strong>Attempt:</strong> <strong><?= ($service->service_state_type === '1') ? 'Hard' : 'Soft'; ?> </strong>
<?= $service->service_attempt; ?> <?= $service->service_attempt; ?>
(<?= ($service->service_state_type === '1') ? 'Hard' : 'Soft'; ?>)
<?php endif; ?> <?php endif; ?>
</div> </div>
</div> </div>
</td> </td>
<td title="<?= $viewHelper->getStateTitle($service, 'host'); ?>"> <td title="<?= $helper->getStateTitle($service, 'host'); ?>">
<?php if ($service->service_icon_image): ?> <!-- <?php if ($service->service_icon_image): ?>
<div class="pull-left" style="margin-right: 2px;"> <div class="pull-left" style="margin-right: 2px;">
<i class="inline-image" style="background-image: url(<?= $this->escape($this->resolveMacros($service->service_icon_image, $service)); ?>);"></i> <i class="inline-image" style="background-image: url(<?= $this->escape($this->resolveMacros($service->service_icon_image, $service)); ?>);"></i>
</div> </div>
<?php endif; ?> <?php endif; ?>-->
<strong> <?= $service->service_display_name; ?></strong> <a href="<?= $serviceLink ?>"><?= $service->service_display_name ?></a> on <a href="<?= $hostLink ?>"><?= $service->host_name; ?>
<small>
on <a href="<?= $this->href('monitoring/list/services', array('host' => $service->host_name)) ?>">
<?= $service->host_name; ?>
<?php if ($service->host_state != 0): ?> <?php if ($service->host_state != 0): ?>
(<?= ucfirst($viewHelper->monitoringState($service, 'host')); ?>) (<?= ucfirst($helper->monitoringState($service, 'host')); ?>)
<?php endif; ?> <?php endif; ?>
</a> </a><br />
</small>
<div class="output-text">
<?= $this->escape(substr(strip_tags($service->service_output), 0, 10000)); ?> <?= $this->escape(substr(strip_tags($service->service_output), 0, 10000)); ?>
</div>
</td> </td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</tbody> </tbody>
</table> </table>
<div class="pull-left">
<?= $this->paginationControl($this->services, null, null, array('preserve' => $this->preserve)); ?>
</div>
</div> </div>

View File

@ -1,33 +1,27 @@
<?php <?php
/** @var Zend_View_Helper_CommandForm $cf */ /** @var Zend_View_Helper_CommandForm $cf */
$cf = $this->getHelper('CommandForm'); $cf = $this->getHelper('CommandForm');
$data = array('host' => $object->host_name);
if ($object->service_description) {
$data['service'] = $object->service_description;
}
?> ?>
<div> <div>
<div class="panel-heading"> <div class="panel-heading">
<div class="panel-hostname"> <div class="panel-hostname">
Comments Comments
<?php <?php
$data = array(
'host' => $object->host_name
);
if ($object->service_description) {
$data['service'] = $object->service_description;
}
$addCommentHref = $this->href(
'monitoring/command/addComment',
$data
);
$sendNotificationHref = $this->href(
'monitoring/command/sendCustomNotification',
$data
);
?> ?>
<div class="pull-right"> <div class="pull-right">
<a rel="tooltip" title="Add a comment" href="<?= $addCommentHref; ?>" class="btn-common btn-small button"> <a rel="tooltip" title="Add a comment" href="<?= $this->href('monitoring/command/addComment', $data) ?>" class="btn-common btn-small button"><?=
<i class="icinga-icon-comment"></i> $this->img('img/icons/comment.png')
</a> ?></a>
<a rel="tooltip" title="Send custom notification" href="<?= $sendNotificationHref; ?>" class="btn-common btn-small button"> <a rel="tooltip" title="Send custom notification" href="<?= $this->href('monitoring/command/sendCustomNotification', $data
<i class="icinga-icon-notification"></i> ) ?>" class="btn-common btn-small button">
<?= $this->img('img/icons/notification.png') ?>
</a> </a>
</div> </div>
</div> </div>
@ -50,7 +44,7 @@
$deleteData['commentid'] = $comment->comment_internal_id; $deleteData['commentid'] = $comment->comment_internal_id;
echo $cf->iconSubmitForm( echo $cf->iconSubmitForm(
'icinga-icon-remove', 'img/icons/remove.png',
'Remove comment', 'Remove comment',
'btn-small', 'btn-small',
'removecomment', 'removecomment',

View File

@ -12,7 +12,7 @@
$scheduleDowntimeHref = $this->href('monitoring/command/scheduleDowntime', $scheduleDowntimeData); $scheduleDowntimeHref = $this->href('monitoring/command/scheduleDowntime', $scheduleDowntimeData);
?> ?>
<a href="<?= $scheduleDowntimeHref; ?>" class="btn-common btn-small button" title="Schedule downtime"> <a href="<?= $scheduleDowntimeHref; ?>" class="btn-common btn-small button" title="Schedule downtime">
<i class="icinga-icon-in-downtime"></i> <?= $this->img('img/icons/in_downtime.png') ?>
</a> </a>
</div> </div>
Downtimes Downtimes
@ -32,7 +32,7 @@
<td> <td>
<div class="pull-right"> <div class="pull-right">
<?= $this->getHelper('CommandForm')->iconSubmitForm( <?= $this->getHelper('CommandForm')->iconSubmitForm(
'icinga-icon-remove', 'img/icons/remove.png',
'Remove Downtime', 'Remove Downtime',
'btn-small', 'btn-small',
'removedowntime', 'removedowntime',

View File

@ -1,57 +1,66 @@
<?php <?php
$o = $this->object; $o = $this->object;
$isService = (isset($o->service_description)) ? true : false; $isService = (isset($o->service_description)) ? true : false;
$transitionObject = new \stdClass(); $obj = new \stdClass();
$transitionObject->handled = $obj->handled =
($isService) ? $o->service_handled : $o->host_handled; ($isService) ? $o->service_handled : $o->host_handled;
$transitionObject->state = $obj->state =
($isService) ? $o->service_state : $o->host_state; ($isService) ? $o->service_state : $o->host_state;
$transitionObject->acknowledged = $obj->acknowledged =
($isService) ? $o->service_acknowledged : $o->host_acknowledged; ($isService) ? $o->service_acknowledged : $o->host_acknowledged;
$transitionObject->in_downtime = $obj->in_downtime =
($isService) ? $o->in_downtime : $o->host_in_downtime; ($isService) ? $o->in_downtime : $o->host_in_downtime;
$transitionObject->is_flapping = $obj->is_flapping =
($isService) ? $o->is_flapping : $o->host_is_flapping; ($isService) ? $o->is_flapping : $o->host_is_flapping;
$transitionObject->notifications_enabled = $obj->notifications_enabled =
($isService) ? $o->notifications_enabled : $o->service_notifications_enabled; ($isService) ? $o->notifications_enabled : $o->service_notifications_enabled;
$transitionObject->active_checks_enabled = $obj->active_checks_enabled =
($isService) ? $o->active_checks_enabled : $o->host_active_checks_enabled; ($isService) ? $o->active_checks_enabled : $o->host_active_checks_enabled;
$transitionObject->passive_checks_enabled = $obj->passive_checks_enabled =
($isService) ? $o->passive_checks_enabled : $o->host_passive_checks_enabled; ($isService) ? $o->passive_checks_enabled : $o->host_passive_checks_enabled;
$transitionObject->last_comment = $obj->last_comment =
($isService) ? $o->last_comment : $o->host_last_comment; ($isService) ? $o->last_comment : $o->host_last_comment;
?>
<span> $i = array();
<?php if (!$transitionObject->handled && $transitionObject->state > 0): ?> if (! $obj->handled && $obj->state > 0) {
<i title="Unhandled" class="icinga-icon-unhandled"></i> $i[] = $this->img('img/icons/unhandled.png', array('title' => 'Unhandled'));
<?php endif; ?> }
<?php if ($transitionObject->acknowledged && !$transitionObject->in_downtime): ?> if ($obj->acknowledged && ! $obj->in_downtime) {
<i title="Acknowledged" class="icinga-icon-acknowledgement"></i> $i[] = $this->img('img/icons/acknowledgement.png', array('title' => 'Acknowledged'));
<?php endif; ?> }
<?php if ($transitionObject->is_flapping): ?> if ($obj->is_flapping) {
<i title="Flapping" class="icinga-icon-flapping"></i> $i[] = $this->img('img/icons/flapping.png', array('title' => 'Flapping'));
<?php endif; ?> }
<?php if (!$transitionObject->notifications_enabled): ?> if (!$obj->notifications_enabled) {
<i title="Notifications Disabled" class="icinga-icon-notification-disabled"></i> $i[] = $this->img('img/icons/notification_disabled.png', array('title' => 'Notifications Disabled'));
<?php endif; ?> }
<?php if ($transitionObject->in_downtime): ?> if ($obj->in_downtime) {
<i title="In Downtime" class="icinga-icon-in-downtime"></i> $i[] = $this->img('img/icons/in_downtime.png', array('title' => 'In Downtime'));
<?php endif; ?> }
<?php if (!$transitionObject->active_checks_enabled): ?> if (! $obj->active_checks_enabled) {
<?php if (!$transitionObject->passive_checks_enabled): ?> if ($obj->passive_checks_enabled) {
<i title="Active And Passive Checks Disabled" class="icinga-icon-active-passive-checks-disabled"></i> $i[] = $this->img(
<?php else: ?> 'img/icons/active_checks_disabled.png',
<i title="Active Checks Disabled" class="icinga-icon-active-checks-disabled"></i> array('title' => 'Active Checks Disabled')
<?php endif; ?> );
<?php endif; ?> } else {
$i[] = $this->img(
'img/icons/active_passive_checks_disabled.png',
array('title' => 'Active And Passive Checks Disabled')
);
}
}
<?php if ($transitionObject->last_comment !== null): ?> if ($obj->last_comment !== null) {
<i title="Comments" class="icinga-icon-comment"></i> $i[] = $this->img('img/icons/comment.png', array('title' => 'Comments'));
<?php endif; ?> }
?><span>
<?= implode("\n ", $i) . "\n" ?>
</span> </span>

View File

@ -1,111 +1,130 @@
<?php
use Icinga\Module\Monitoring\Object\Service;
if ($object instanceof Service) {
$title = $object->service_description;
$params = array(
'host' => $object->host_name,
'service' => $object->service_description
);
} else {
$title = $object->host_name;
$params = array('host' => $object->host_name);
}
// TODO: Remove this once we have better helpers
$states = array(
'service' => array(
'ok',
'warning',
'critical',
'unknown',
99 => 'pending',
),
'host' => array(
'up',
'down',
'unreachable',
99 => 'pending',
)
);
?><div class="controls">
<?= $this->tabs->render($this); ?> <?= $this->tabs->render($this); ?>
<a href="<?= $this->href('monitoring/list/eventhistory', $params); ?>">All events for <?= $title ?></a>
<h1>History</h1> <h1>History</h1>
<?php if($history->count() === 0): ?>
<div class="alert alert-info">
No History Available For This Object
</div> </div>
<?php else: ?>
<div data-icinga-component="app/mainDetailGrid"> <?php if($history->count() === 0): ?>
No History Available For This Object
</div>
<?php return; endif ?>
<?= $this->paginationControl($history, null, null, array('preserve' => $this->preserve)); ?> <?= $this->paginationControl($history, null, null, array('preserve' => $this->preserve)); ?>
<table class="table table-condensed"> <table class="action">
<tbody> <tbody>
<?php foreach ($history as $event): ?> <?php foreach ($history as $event):
<tr> if (array_key_exists($event->state, $states[$event->object_type])) {
$state_class = $states[$event->object_type][$event->state];
<td><?= date('d.m. H:i', $event->raw_timestamp); ?></td> } else {
$state_class = 'invalid';
}
?>
<tr class="state <?= $state_class ?>">
<td class="state"><?= $this->timeSince($event->raw_timestamp) ?></td>
<td> <td>
<?php if ($object instanceof Icinga\Module\Monitoring\Object\Service): ?> <?php
$output = $this->ticket_pattern ? preg_replace(
$this->ticket_pattern,
$ticket_link,
$this->pluginOutput($event->output)
) : $this->pluginOutput($event->output);
switch ($event->type) {
case 'notify':
$icon = 'notification';
$title = 'Notification';
break;
case 'comment':
$icon = 'comment';
$title = 'Comment';
break;
case 'ack':
$icon = 'acknowledgement';
$title = 'Acknowledgement';
break;
case 'dt_comment':
$icon = 'in_downtime';
$title = 'In Downtime';
break;
case 'flapping':
$icon = 'flapping';
$title = 'Flapping';
break;
case 'hard_state':
$icon = 'submit';
$title = 'Hard State';
break;
case 'soft_state':
$icon = 'softstate';
$title = 'Soft State';
break;
case 'dt_start':
$icon = 'downtime_start';
$title = 'Downtime Start';
break;
case 'dt_end':
$icon = 'downtime_end';
$title = 'Downtime End';
break;
}
echo $this->img('img/icons/' . $icon . '.png', array('title' => $title)) . ' ';
if ($object instanceof Service): ?>
<a href="<?= $this->href('monitoring/show/service', array( <a href="<?= $this->href('monitoring/show/service', array(
'host' => $object->host_name, 'host' => $object->host_name,
'service' => $event->service_description 'service' => $event->service_description
)); ?>"> )); ?>"><?= $this->escape($event->service_description) ?></a>
<?= $event->service_description ?>
</a>
<?php else: ?> <?php else: ?>
<a href="<?= $this->href('monitoring/show/host', array( <a href="<?= $this->href('monitoring/show/host', array(
'host' => $object->host_name 'host' => $object->host_name
)); ?>"> )); ?>"><?= $this->escape($event->host_name) ?></a>
<?= $event->host_name ?> <?php endif;
</a>
<?php endif; ?>
</td>
<td> if ($event->attempt !== null) {
<?php printf('[ %d/%d ] ', $event->attempt, $event->max_attempts);
switch ($event->type) {
case 'notify':
$icon = '{{NOTIFICATION_ICON}}';
$title = 'Notification';
$msg = $event->output;
break;
case 'comment':
$icon = '{{COMMENT_ICON}}';
$title = 'Comment';
$msg = $event->output;
break;
case 'ack':
$icon = '{{ACKNOWLEDGEMENT_ICON}}';
$title = 'Acknowledgement';
$msg = '';
break;
case 'dt_comment':
$icon = '{{IN_DOWNTIME_ICON}}';
$title = 'In Downtime';
$msg = $event->output;
break;
case 'flapping':
$icon = '{{FLAPPING_ICON}}';
$title = 'Flapping';
$msg = '';
break;
case 'hard_state':
$icon = '{{HARDSTATE_ICON}}';
$title = 'Hard State';
$msg = '[' . $event->attempt . '/' . $event->max_attempts . ']';
break;
case 'soft_state':
$icon = '{{SOFTSTATE_ICON}}';
$title = 'Soft State';
$msg = '[' . $event->attempt . '/' . $event->max_attempts . ']';
break;
case 'dt_start':
$icon = '{{DOWNTIME_START_ICON}}';
$title = 'Downtime Start';
$msg = $event->output;
break;
case 'dt_end':
$icon = '{{DOWNTIME_END_ICON}}';
$title = 'Downtime End';
$msg = $event->output;
break;
} }
echo $output;
?> ?>
<a href="#" title="<?= $title ?>"><i><?= $icon ?></i></a>
<?php if (!empty($msg)) { echo $msg; } ?>
</td> </td>
</tr> </tr>
<? endforeach; ?> <? endforeach; ?>
</tbody> </tbody>
</table> </table>
<?php if ($object instanceof Icinga\Module\Monitoring\Object\Service): ?>
<a href="<?= $this->href('monitoring/list/eventhistory', array(
'host' => $object->host_name,
'service' => $object->service_description
)); ?>">
All events for <?= $object->service_description ?>
</a>
<?php else: ?>
<a href="<?= $this->href('monitoring/list/eventhistory', array(
'host' => $object->host_name
)); ?>">
All events for <?= $object->host_name ?>
</a>
<?php endif; ?>
</div>
<?php endif; ?>

View File

@ -1,4 +1,6 @@
<?= $this->tabs->render($this); ?> <div class="controls">
<?= $this->tabs ?>
</div>
<?= $this->render('show/components/status.phtml'); ?> <?= $this->render('show/components/status.phtml'); ?>
<?= $this->render('show/components/comments.phtml'); ?> <?= $this->render('show/components/comments.phtml'); ?>
<?= $this->render('show/components/downtime.phtml'); ?> <?= $this->render('show/components/downtime.phtml'); ?>

View File

@ -1,4 +1,6 @@
<?= $this->tabs->render($this); ?> <div class="controls">
<?= $this->tabs; ?>
</div>
<?= $this->render('show/components/status.phtml'); ?> <?= $this->render('show/components/status.phtml'); ?>
<?= $this->render('show/components/comments.phtml'); ?> <?= $this->render('show/components/comments.phtml'); ?>
<?= $this->render('show/components/downtime.phtml'); ?> <?= $this->render('show/components/downtime.phtml'); ?>