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>
<?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'): ?>
<i class="icinga-icon-service" rel="tooltip" title="Service comment"></i>
<?= $this->img('img/icons/service.png', array('title' => 'Service comment')) ?>
<?php endif; ?>
<small>
<?php
switch ($comment->comment_type) {
case 'flapping':
$icon = 'icinga-icon-flapping';
$icon = 'flapping';
$tooltip = 'Comment was caused by a flapping host or service.';
break;
case 'comment':
$icon = 'icinga-icon-user';
$icon = 'user';
$tooltip = 'Comment was created by an user.';
break;
case 'downtime':
$icon = 'icinga-icon-down';
$icon = 'down';
$tooltip = 'Comment was caused by a downtime.';
case 'ack':
$icon = 'icinga-icon-acknowledgement';
$icon = '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>
</td>

View File

@ -1,115 +1,185 @@
<div class="row">
<div class="pull-left">
<h1>Hostgroups</h1>
</div>
<div class="pull-right">
<?= $this->tabs->render($this); ?>
</div>
<div class="controls">
<?= $this->tabs ?>
<?= $this->paginationControl($hostgroups, null, null, array('preserve' => $this->preserve)); ?>
<table class="action wide">
<thead>
<tr>
<th style="width: 40%; padding-left: 1em;">Hosts</th>
<th style="width: 60%; padding-left: 1em;">Services</th>
</tr>
</thead>
</table>
</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>
<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>
<div class="row">
<div class="col-md-12">
<?= $this->paginationControl($hostgroups, null, null, array('preserve' => $this->preserve)); ?>
</div>
</div>
<?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 ?>
<br />
<div class="row">
<?= $this->selectionToolbar('single'); ?>
</div>
</div>
<?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 ?>
<table class="table table-condensed pull-left">
<tbody>
<?php foreach($hostgroups as $hostgroup): ?>
<tr>
<td>
<a href="<?= $this->href('monitoring/list/services', array('hostgroup' => $hostgroup->hostgroup)); ?>">
<?= $hostgroup->hostgroup; ?>
</a>
</td>
<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>
</td>
<td>
<div class="nav navbar-nav topbar-service-status-summary">
<span class="topbar-status-ok">
<a href="<?= $this->href('monitoring/list/services', array('service_state' => 0, 'hostgroup' => $hostgroup->hostgroup)); ?>" title="Services Ok">
<?= $hostgroup->services_ok ?>
</a>
</span>
<span class="topbar-status-critical">
<a href="<?= $this->href('monitoring/list/services', array('service_state' => 2, 'service_unhandled' => 1, 'hostgroup' => $hostgroup->hostgroup)); ?>" title="Services Critical Unhandled">
<?= $hostgroup->services_critical_unhandled ?>
</a>/
<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 ?>
</a>
</span>
<span class="topbar-status-warning">
<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 class="topbar-status-unknown">
<a href="<?= $this->href('monitoring/list/services', array('service_state' => 3, 'service_unhandled' => 1, 'hostgroup' => $hostgroup->hostgroup)); ?>" title="Services Unknown Unhandled">
<?= $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">
<?= $hostgroup->services_unknown_handled ?>
</a>
</span>
<span class="topbar-status-pending">
<a href="<?= $this->href('monitoring/list/services', array('service_state' => 99, 'hostgroup' => $hostgroup->hostgroup)); ?>" title="Services Pending">
<?= $hostgroup->services_pending ?>
</a>
</span>
</div>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?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 style="width: 60%" class="summary">
<?php if ($h->services_ok): ?>
<!-- Services OK -->
<span class="state 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 ?>
<div class="container pull-left">
<?= $this->paginationControl($hostgroups, null, null, array('preserve' => $this->preserve)); ?>
</div>
</div>
<?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>
</span>
<?php endif ?>
</span>
<!-- End of services CRITICAL -->
<?php endif ?>
<?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>
</span>
<?php endif ?>
</span>
<!-- End of WARNING services -->
<?php endif ?>
<?php if ($h->services_unknown): ?>
<!-- Services UNKNOWN -->
<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>
<?php endif ?>
</span>
<!-- 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>
</tr>
<?php endforeach; ?>
</tbody>
</table>

View File

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

View File

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

View File

@ -1,30 +1,30 @@
<h1><?= $this->escape($this->title) ?></h1>
<table class="action">
<tbody>
<?php
$viewHelper = $this->getHelper('MonitoringState');
?>
<div data-icinga-component="app/mainDetailGrid" data-icinga-grid-selection-type="multi">
$helper = $this->getHelper('MonitoringState');
<table class="table table-condensed pull-left">
<tbody>
<?php foreach ($services as $service): ?>
<?php
$serviceLink = $this->href(
'monitoring/show/service',
array(
'host' => $service->host_name,
'service' => $service->service_description
)
foreach ($services as $service):
$serviceLink = $this->href(
'monitoring/show/service',
array(
'host' => $service->host_name,
'service' => $service->service_description
)
);
$hostLink = $this->href(
'monitoring/show/host',
array(
'host' => $service->host_name,
)
'monitoring/show/host',
array('host' => $service->host_name)
);
$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 -->
<!--
<td class="tacheader-status-<?= $serviceStateName; ?>">
<a style="visibility:hidden" href="<?= $serviceLink; ?>"></a>
</td>
@ -72,36 +72,26 @@ $viewHelper = $this->getHelper('MonitoringState');
<?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">
<i class="icon-table icinga-icon-comment"></i>
</a>
<?php endif; ?>
</td>
<td title="<?= $viewHelper->getStateTitle($service, 'service'); ?>">
<strong><?= ucfirst($viewHelper->monitoringState($service, 'service')); ?></strong><br />
<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>
-->
<td class="state" title="<?= $helper->getStateTitle($service, 'service'); ?>">
<?= $this->timeSince($service->service_last_state_change); ?>
</div>
</td>
<td title="<?= $viewHelper->getStateTitle($service, 'host'); ?>">
<td>
<a href="<?= $serviceLink ?>"><?= $service->service_display_name ?></a> on <a href="<?= $hostLink ?>"><?= $service->host_name; ?></a><br />
<div class="output-text">
<?= $this->escape(substr(strip_tags($service->service_output), 0, 10000)); ?>
</div>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>

View File

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

View File

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

View File

@ -12,7 +12,7 @@
$scheduleDowntimeHref = $this->href('monitoring/command/scheduleDowntime', $scheduleDowntimeData);
?>
<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>
</div>
Downtimes
@ -32,7 +32,7 @@
<td>
<div class="pull-right">
<?= $this->getHelper('CommandForm')->iconSubmitForm(
'icinga-icon-remove',
'img/icons/remove.png',
'Remove Downtime',
'btn-small',
'removedowntime',

View File

@ -1,57 +1,66 @@
<?php
$o = $this->object;
$isService = (isset($o->service_description)) ? true : false;
$transitionObject = new \stdClass();
$transitionObject->handled =
$obj = new \stdClass();
$obj->handled =
($isService) ? $o->service_handled : $o->host_handled;
$transitionObject->state =
$obj->state =
($isService) ? $o->service_state : $o->host_state;
$transitionObject->acknowledged =
$obj->acknowledged =
($isService) ? $o->service_acknowledged : $o->host_acknowledged;
$transitionObject->in_downtime =
$obj->in_downtime =
($isService) ? $o->in_downtime : $o->host_in_downtime;
$transitionObject->is_flapping =
$obj->is_flapping =
($isService) ? $o->is_flapping : $o->host_is_flapping;
$transitionObject->notifications_enabled =
$obj->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;
$transitionObject->passive_checks_enabled =
$obj->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;
?>
<span>
<?php if (!$transitionObject->handled && $transitionObject->state > 0): ?>
<i title="Unhandled" class="icinga-icon-unhandled"></i>
<?php endif; ?>
$i = array();
if (! $obj->handled && $obj->state > 0) {
$i[] = $this->img('img/icons/unhandled.png', array('title' => 'Unhandled'));
}
<?php if ($transitionObject->acknowledged && !$transitionObject->in_downtime): ?>
<i title="Acknowledged" class="icinga-icon-acknowledgement"></i>
<?php endif; ?>
if ($obj->acknowledged && ! $obj->in_downtime) {
$i[] = $this->img('img/icons/acknowledgement.png', array('title' => 'Acknowledged'));
}
<?php if ($transitionObject->is_flapping): ?>
<i title="Flapping" class="icinga-icon-flapping"></i>
<?php endif; ?>
if ($obj->is_flapping) {
$i[] = $this->img('img/icons/flapping.png', array('title' => 'Flapping'));
}
<?php if (!$transitionObject->notifications_enabled): ?>
<i title="Notifications Disabled" class="icinga-icon-notification-disabled"></i>
<?php endif; ?>
if (!$obj->notifications_enabled) {
$i[] = $this->img('img/icons/notification_disabled.png', array('title' => 'Notifications Disabled'));
}
<?php if ($transitionObject->in_downtime): ?>
<i title="In Downtime" class="icinga-icon-in-downtime"></i>
<?php endif; ?>
if ($obj->in_downtime) {
$i[] = $this->img('img/icons/in_downtime.png', array('title' => 'In Downtime'));
}
<?php if (!$transitionObject->active_checks_enabled): ?>
<?php if (!$transitionObject->passive_checks_enabled): ?>
<i title="Active And Passive Checks Disabled" class="icinga-icon-active-passive-checks-disabled"></i>
<?php else: ?>
<i title="Active Checks Disabled" class="icinga-icon-active-checks-disabled"></i>
<?php endif; ?>
<?php endif; ?>
if (! $obj->active_checks_enabled) {
if ($obj->passive_checks_enabled) {
$i[] = $this->img(
'img/icons/active_checks_disabled.png',
array('title' => 'Active Checks Disabled')
);
} else {
$i[] = $this->img(
'img/icons/active_passive_checks_disabled.png',
array('title' => 'Active And Passive Checks Disabled')
);
}
}
if ($obj->last_comment !== null) {
$i[] = $this->img('img/icons/comment.png', array('title' => 'Comments'));
}
?><span>
<?= implode("\n ", $i) . "\n" ?>
</span>
<?php if ($transitionObject->last_comment !== null): ?>
<i title="Comments" class="icinga-icon-comment"></i>
<?php endif; ?>
</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); ?>
<a href="<?= $this->href('monitoring/list/eventhistory', $params); ?>">All events for <?= $title ?></a>
<h1>History</h1>
</div>
<?php if($history->count() === 0): ?>
<div class="alert alert-info">
No History Available For This Object
No History Available For This Object
</div>
<?php return; endif ?>
</div>
<?= $this->paginationControl($history, null, null, array('preserve' => $this->preserve)); ?>
<table class="action">
<tbody>
<?php foreach ($history as $event):
if (array_key_exists($event->state, $states[$event->object_type])) {
$state_class = $states[$event->object_type][$event->state];
} else {
$state_class = 'invalid';
}
?>
<tr class="state <?= $state_class ?>">
<td class="state"><?= $this->timeSince($event->raw_timestamp) ?></td>
<td>
<?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(
'host' => $object->host_name,
'service' => $event->service_description
)); ?>"><?= $this->escape($event->service_description) ?></a>
<?php else: ?>
<a href="<?= $this->href('monitoring/show/host', array(
'host' => $object->host_name
)); ?>"><?= $this->escape($event->host_name) ?></a>
<?php endif;
<div data-icinga-component="app/mainDetailGrid">
if ($event->attempt !== null) {
printf('[ %d/%d ] ', $event->attempt, $event->max_attempts);
}
echo $output;
<?= $this->paginationControl($history, null, null, array('preserve' => $this->preserve)); ?>
<table class="table table-condensed">
<tbody>
?>
</td>
</tr>
<? endforeach; ?>
</tbody>
</table>
<?php foreach ($history as $event): ?>
<tr>
<td><?= date('d.m. H:i', $event->raw_timestamp); ?></td>
<td>
<?php if ($object instanceof Icinga\Module\Monitoring\Object\Service): ?>
<a href="<?= $this->href('monitoring/show/service', array(
'host' => $object->host_name,
'service' => $event->service_description
)); ?>">
<?= $event->service_description ?>
</a>
<?php else: ?>
<a href="<?= $this->href('monitoring/show/host', array(
'host' => $object->host_name
)); ?>">
<?= $event->host_name ?>
</a>
<?php endif; ?>
</td>
<td>
<?php
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;
}
?>
<a href="#" title="<?= $title ?>"><i><?= $icon ?></i></a>
<?php if (!empty($msg)) { echo $msg; } ?>
</td>
</tr>
<? endforeach; ?>
</tbody>
</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/comments.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/comments.phtml'); ?>
<?= $this->render('show/components/downtime.phtml'); ?>