Design: Host and service list

Fix: Command controller and downtimes

refs #4824
This commit is contained in:
Marius Hein 2013-10-09 16:38:46 +02:00 committed by Eric Lippmann
parent f011b56911
commit fe4ed3476f
36 changed files with 180 additions and 144 deletions

View File

@ -267,7 +267,7 @@ class Monitoring_CommandController extends ActionController
$given = array_intersect_key($supported, $this->getRequest()->getParams());
if (empty($given)) {
throw new \Exception('Missing parameter, supported: '.implode(', ', $supported));
throw new \Exception('Missing parameter, supported: '.implode(', ', array_flip($supported)));
}
if (isset($given['host'])) {
@ -815,19 +815,19 @@ class Monitoring_CommandController extends ActionController
*/
public function removedowntimeAction()
{
$this->setSupportedParameters(array('downtimeid'));
$form = new CommandWithIdentifierForm();
$this->setSupportedParameters(array('host', 'service', 'downtimeid'));
$form = new SingleArgumentCommandForm();
$form->setRequest($this->getRequest());
$form->setSubmitLabel(t('Delete Downtime'));
$form->setFieldName('downtimeid');
$form->setFieldLabel(t('Downtime Id'));
$form->setParameterName('downtimeid');
$form->addNote(t('Delete a single downtime with the id shown above'));
$form->setCommand('DEL_HOST_DOWNTIME', 'DEL_SVC_DOWNTIME');
$form->setObjectIgnoreFlag(true);
$this->setForm($form);
if ($form->IsSubmittedAndValid() === true) {
$this->target->removeDowntime($this->view->objects);
$this->target->sendCommand($form->createCommand(), $this->view->objects);
}
}
}

View File

@ -28,17 +28,17 @@
*/
// {{{ICINGA_LICENSE_HEADER}}}
use \Icinga\Application\Benchmark;
use \Icinga\Data\Db\Query;
use \Icinga\File\Csv;
use \Icinga\Module\Monitoring\Controller as MonitoringController;
use \Icinga\Web\Hook;
use \Icinga\Web\Widget\Tabextension\DashboardAction;
use \Icinga\Web\Widget\Tabextension\OutputFormat;
use \Icinga\Web\Widget\Tabs;
use \Icinga\Module\Monitoring\Backend;
use \Icinga\Web\Widget\SortBox;
use \Icinga\Application\Config as IcingaConfig;
use Icinga\Application\Benchmark;
use Icinga\Data\Db\Query;
use Icinga\File\Csv;
use Icinga\Module\Monitoring\Controller as MonitoringController;
use Icinga\Web\Hook;
use Icinga\Web\Widget\Tabextension\DashboardAction;
use Icinga\Web\Widget\Tabextension\OutputFormat;
use Icinga\Web\Widget\Tabs;
use Icinga\Module\Monitoring\Backend;
use Icinga\Web\Widget\SortBox;
use Icinga\Application\Config as IcingaConfig;
use Icinga\Module\Monitoring\DataView\Notification as NotificationView;
use Icinga\Module\Monitoring\DataView\Downtime as DowntimeView;

View File

@ -1,5 +1,3 @@
<?= $this->tabs->render($this); ?>
<?php
/**
* Create a DateTime from a string and use the util helper to
@ -14,8 +12,11 @@ function formatDateString($self,$dateString){
return $self->util()->showTime($d->getTimestamp());
}
$commandHelper = $this->getHelper('CommandForm');
?>
<?= $this->tabs->render($this); ?>
<div data-icinga-component="app/mainDetailGrid">
<div>
<?= $this->sortControl->render($this); ?>
@ -48,6 +49,7 @@ function formatDateString($self,$dateString){
<th>Downtime ID</th>
<th>Trigger ID</th>
<th>Duration</th>
<th>&nbsp;</th>
</tr>
</thead>
@ -109,6 +111,22 @@ function formatDateString($self,$dateString){
<?= $this->util()->showHourMin(intval($downtime->downtime_duration)); ?>
</td>
<td>
<?php
$data = array(
'downtimeid' => $downtime->downtime_internal_downtime_id,
'host' => $downtime->host_name
);
if ($downtime->object_type == 'service') {
$data['service'] = $downtime->service_description;
}
echo $commandHelper->simpleForm(
'removedowntime',
'Remove Downtime',
$data
);
?>
</td>
</tr>
<?php endforeach ?>

View File

@ -1,22 +1,14 @@
<?= $this->tabs->render($this); ?>
<?php
$viewHelper = $this->getHelper('MonitoringState');
?>
<?= $this->tabs->render($this); ?>
<h1>Hosts Status</h1>
<div data-icinga-component="app/mainDetailGrid">
<?= $this->sortControl->render($this); ?>
<?= $this->paginationControl($hosts, null, null, array('preserve' => $this->preserve)); ?>
<table class="table table-condensed">
<thead>
<tr>
<th colspan="3">Status</th>
<th>Host</th>
</tr>
</thead>
<tbody>
<?php foreach($hosts as $host): ?>
@ -27,11 +19,6 @@ $viewHelper = $this->getHelper('MonitoringState');
<!-- Color column -->
<td class="tacheader-status-<?= $hostStateName; ?>">
<a style="visibility:hidden" href="<?= $hostLink; ?>"></a>
<!--
<?php if ($host->host_icon_image) : ?>
<img src="<?= $host->host_icon_image; ?>"/>
<?php endif; ?>
-->
</td>
<!-- Icons -->
@ -69,11 +56,11 @@ $viewHelper = $this->getHelper('MonitoringState');
<?php if (!$host->host_active_checks_enabled): ?>
<?php if (!$host->host_passive_checks_enabled): ?>
<a href="#" title="Active And Passive Checks Disabled">
<i>{{ACTIVE_PASSIVE_CHECKS_DISABLED_ICON}}</i>
<i class="icinga-icon-active-passive-checks-disabled"></i>
</a>
<?php else: ?>
<a href="#" title="Active Checks Disabled">
<i class="icon-table icinga-icon-disabled"></i>
<i class="icon-table icinga-icon-active-checks-disabled"></i>
</a>
<?php endif; ?>
<?php endif; ?>
@ -89,32 +76,39 @@ $viewHelper = $this->getHelper('MonitoringState');
<td title="<?= $viewHelper->getStateTitle($host, 'host'); ?>">
<div>
<?php if ($host->host_unhandled_service_count): ?>
<span class="badge pull-right">
<span class="badge pull-right" title="<?= $host->host_unhandled_service_count; ?> Service Problems on Host">
<a href="<?= $this->href('monitoring/list/services', array('host' => $host->host_name, 'service_problems' => 1)); ?>">
<?= $host->host_unhandled_service_count; ?>
</a>
</span>
<?php endif; ?>
<b><?= ucfirst($viewHelper->monitoringState($host, 'host')); ?></b><br />Since
<?= $this->timeSince($host->host_last_state_change); ?> (<?= $host->host_current_check_attempt; ?>/<?= $host->host_max_check_attempts; ?>)
<strong><?= ucfirst($viewHelper->monitoringState($host, 'host')); ?></strong><br />
<div class="small-row">
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'; ?>)
<?php endif; ?>
</div>
</div>
</td>
<!-- Host / Status / Output -->
<td>
<?php if ($host->host_icon_image) : ?>
<div class="pull-left" style="margin-right: 2px;">
<i class="inline-image" style="background-image: url(<?= $host->host_icon_image; ?>);"></i>
</div>
<?php endif; ?>
<a href="<?= $this->href('monitoring/list/services', array('host' => $host->host_name)) ?>">
<b><?= $host->host_name ?></b> (<i><?= $host->host_address ?></i>)
<strong><?= $host->host_name ?></strong>
</a>
<?php if (!empty($host->host_action_url)): ?>
<a href="<?= $host->host_action_url; ?>">Action</a>
<?php endif; ?>
<?php if (!empty($host->host_notes_url)): ?>
<a href="<?= $host->host_notes_url; ?>">Notes</a>
<?php endif; ?>
<br /><?= $this->escape(substr(strip_tags($host->host_output), 0, 10000)); ?>
<div class="output-text">
<?= $this->escape(substr(strip_tags($host->host_output), 0, 10000)); ?>
</div>
</td>
</tr>
<?php endforeach; ?>

View File

@ -1,141 +1,120 @@
<?= $this->tabs->render($this); ?>
<?php
$viewHelper = $this->getHelper('MonitoringState');
?>
<?= $this->tabs->render($this); ?>
<h1>Services Status</h1>
<div data-icinga-component="app/mainDetailGrid">
<?= $this->sortControl->render($this); ?>
<?= $this->paginationControl($services, null, null, array('preserve' => $this->preserve)); ?>
<table class="table table-condensed">
<thead>
<tr>
<th colspan="3">Status</th>
<th>Service</th>
<th>Host</th>
<th>Output</th>
<th></th>
</tr>
</thead>
<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,
)
);
$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"' : ''; ?>>
<!-- Color column -->
<td class="tacheader-status-<?= $serviceStateName; ?>">
<a style="visibility:hidden" href="<?= $serviceLink; ?>"></a>
</td>
<td>
<a style="visibility:hidden" href="<?= $serviceLink; ?>"></a>
<?php if ($service->service_icon_image) : ?>
<img src="<?= $service->service_icon_image; ?>"/>
<?php endif; ?>
</td>
<td>
<?php if (!$service->service_handled && $service->service_state > 0): ?>
<a href="#" title="Unhandled">
<i>{{UNHANDLED_ICON}}</i>
<i class="icon-table icinga-icon-unhandled"></i>
</a>
<?php endif; ?>
<?php if ($service->service_acknowledged && !$service->service_in_downtime): ?>
<a href="#" title="Acknowledged">
<i>{{ACKNOWLEDGED_ICON}}</i>
<i class="icon-table icinga-icon-acknowledgement"></i>
</a>
<?php endif; ?>
<?php if ($service->service_is_flapping): ?>
<a href="#" title="Flapping">
<i>{{FLAPPING_ICON}}</i>
<i class="icon-table icinga-icon-flapping"></i>
</a>
<?php endif; ?>
<?php if (!$service->service_notifications_enabled): ?>
<a href="#" title="Notifications Disabled">
<i>{{NOTIFICATIONS_DISABLED_ICON}}</i>
<i class="icon-table icinga-icon-notification-disabled"></i>
</a>
<?php endif; ?>
<?php if ($service->service_in_downtime): ?>
<a href="#" title="In Downtime">
<i>{{IN_DOWNTIME_ICON}}</i>
<i class="icon-table icinga-icon-in-downtime"></i>
</a>
<?php endif; ?>
<?php if (!$service->service_active_checks_enabled): ?>
<?php if (!$service->service_passive_checks_enabled): ?>
<a href="#" title="Active And Passive Checks Disabled">
<i>{{ACTIVE_PASSIVE_CHECKS_DISABLED_ICON}}</i>
<i class="icon-table icinga-icon-active-passive-checks-disabled"></i>
</a>
<?php else: ?>
<a href="#" title="Active Checks Disabled">
<i>{{ACTIVE_CHECKS_DISABLED_ICON}}</i>
<i class="icon-table icinga-icon-active-checks-disabled"></i>
</a>
<?php endif; ?>
<?php endif; ?>
<?php if ($service->service_last_comment !== null): ?>
<a href="#" title="Comments">
<i>{{COMMENT_ICON}}</i>
<i class="icon-table icinga-icon-comment"></i>
</a>
<?php endif; ?>
</td>
<td title="<?= $viewHelper->getStateTitle($service, 'service'); ?>">
<div>
<?php if ($service->service_state_type == 0): ?>
<a href="#" title="Soft State">
<i>{{SOFTSTATE_ICON}}</i>
</a>
<?php endif; ?>
<b><?= ucfirst($viewHelper->monitoringState($service, 'service')); ?></b>
Since&nbsp;
<?= $this->timeSince($service->service_last_state_change); ?>
<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_current_check_attempt; ?>/<?= $service->service_max_check_attempts; ?>
(<?= ($service->service_state_type === '1') ? 'Hard' : 'Soft'; ?>)
<?php endif; ?>
</div>
</div>
</td>
<td>
<!--<a href="<?= $serviceLink; ?>">-->
<b> <?= $service->service_display_name; ?></b>
<!--</a>-->
<br/>
<?php if (!empty($service->service_action_url)): ?>
<a href="<?= $service->service_action_url; ?>">Action</a>
<?php endif; ?>
<?php if (!empty($service->service_notes_url)): ?>
<a href="<?= $service->service_notes_url; ?>">Notes</a>
<?php endif; ?>
</td>
<td title="<?= $viewHelper->getStateTitle($service, 'host'); ?>">
<?php if (!$service->host_handled && $service->host_state > 0): ?>
<a href="#" title="Unhandled Host">
<i>{{UNHANDLED_ICON}}</i>
</a>
<?php if ($service->service_icon_image): ?>
<div class="pull-left" style="margin-right: 2px;">
<i class="inline-image" style="background-image: url(<?= $service->service_icon_image; ?>);"></i>
</div>
<?php endif; ?>
<a href="<?= $this->href('monitoring/list/services', array('host' => $service->host_name)) ?>">
<b><?= $service->host_name; ?></b>
<?php if ($service->host_state != 0): ?>
(<?= ucfirst($viewHelper->monitoringState($service, 'host')); ?>)
<?php endif; ?>
<br /><?= $service->host_address ?>
</a>
</td>
<td>
<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">
<?= $this->escape(substr(strip_tags($service->service_output), 0, 10000)); ?>
</div>
</td>
</tr>
<?php endforeach; ?>

View File

@ -1,104 +1,138 @@
.icinga-icon-blank {
background: transparent;
display: inline-block;
width: 16px;
height: 16px;
}
.icinga-icon-acknowledgement {
background: transparent url("../img/images/acknowledgement.png") center center no-repeat;
background: transparent url("../img/icons/acknowledgement.png") center center no-repeat;
display: inline-block;
width: 16px;
height: 16px;
}
.icinga-icon-comment {
background: transparent url("../img/images/comment.png") center center no-repeat;
background: transparent url("../img/icons/comment.png") center center no-repeat;
display: inline-block;
width: 16px;
height: 16px;
}
.icinga-icon-create {
background: transparent url("../img/images/create.png") center center no-repeat;
background: transparent url("../img/icons/create.png") center center no-repeat;
display: inline-block;
width: 16px;
height: 16px;
}
.icinga-icon-dashboard {
background: transparent url("../img/images/dashboard.png") center center no-repeat;
background: transparent url("../img/icons/dashboard.png") center center no-repeat;
display: inline-block;
width: 16px;
height: 16px;
}
.icinga-icon-disabled {
background: transparent url("../img/images/disabled.png") center center no-repeat;
background: transparent url("../img/icons/disabled.png") center center no-repeat;
display: inline-block;
width: 16px;
height: 16px;
}
.icinga-icon-edit {
background: transparent url("../img/images/edit.png") center center no-repeat;
background: transparent url("../img/icons/edit.png") center center no-repeat;
display: inline-block;
width: 16px;
height: 16px;
}
.icinga-icon-error {
background: transparent url("../img/images/error.png") center center no-repeat;
background: transparent url("../img/icons/error.png") center center no-repeat;
display: inline-block;
width: 16px;
height: 16px;
}
.icinga-icon-flapping {
background: transparent url("../img/images/flapping.png") center center no-repeat;
background: transparent url("../img/icons/flapping.png") center center no-repeat;
display: inline-block;
width: 16px;
height: 16px;
}
.icinga-icon-in-downtime {
background: transparent url("../img/images/in_downtime.png") center center no-repeat;
background: transparent url("../img/icons/in_downtime.png") center center no-repeat;
display: inline-block;
width: 16px;
height: 16px;
}
.icinga-icon-remove {
background: transparent url("../img/images/remove.png") center center no-repeat;
background: transparent url("../img/icons/remove.png") center center no-repeat;
display: inline-block;
width: 16px;
height: 16px;
}
.icinga-icon-save {
background: transparent url("../img/images/save.png") center center no-repeat;
background: transparent url("../img/icons/save.png") center center no-repeat;
display: inline-block;
width: 16px;
height: 16px;
}
.icinga-icon-service {
background: transparent url("../img/images/service.png") center center no-repeat;
background: transparent url("../img/icons/service.png") center center no-repeat;
display: inline-block;
width: 16px;
height: 16px;
}
.icinga-icon-submit {
background: transparent url("../img/images/submit.png") center center no-repeat;
background: transparent url("../img/icons/submit.png") center center no-repeat;
display: inline-block;
width: 16px;
height: 16px;
}
.icinga-icon-unhandled {
background: transparent url("../img/images/unhandled.png") center center no-repeat;
background: transparent url("../img/icons/unhandled.png") center center no-repeat;
display: inline-block;
width: 16px;
height: 16px;
}
.icinga-icon-user {
background: transparent url("../img/images/user.png") center center no-repeat;
background: transparent url("../img/icons/user.png") center center no-repeat;
display: inline-block;
width: 16px;
height: 16px;
}
.icinga-icon-active-checks-disabled {
background: transparent url("../img/icons/active_checks_disabled.png") center center no-repeat;
display: inline-block;
width: 16px;
height: 16px;
}
.icinga-icon-active-passive-checks-disabled {
background: transparent url("../img/icons/active_passive_checks_disabled.png") center center no-repeat;
display: inline-block;
width: 16px;
height: 16px;
}
.icinga-icon-notification {
background: transparent url("../img/icons/notification.png") center center no-repeat;
display: inline-block;
width: 16px;
height: 16px;
}
.icinga-icon-notification-disabled {
background: transparent url("../img/icons/notification_disabled.png") center center no-repeat;
display: inline-block;
width: 16px;
height: 16px;
}

View File

@ -24,6 +24,18 @@ body { padding-top: 70px; }
border: none;
}
.inline-image {
display: inline-block;
width: 16px;
height: 16px;
background: #c0c0c0 center center no-repeat;
}
.small-row {
font-size: 12px;
line-height: 16px;
display: block;
}
/* ==========================================================================
Icinga Design
@ -188,12 +200,10 @@ td {
.output-text {
font-size: 12px;
line-height: 14px;
display: inline-block;
line-height: 16px;
display: block;
}
/* ==========================================================================
Forms
========================================================================== */
@ -291,10 +301,11 @@ select.input-sm {
background-color: #00cc33; /* xx */
}
.tacheader-status-pending {
background-color: #bababa;
}
/** Service status **/
.tacheader-status-critical {
background-color: #FF3300;
}

View File

Before

Width:  |  Height:  |  Size: 501 B

After

Width:  |  Height:  |  Size: 501 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 453 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 570 B

View File

Before

Width:  |  Height:  |  Size: 491 B

After

Width:  |  Height:  |  Size: 491 B

View File

Before

Width:  |  Height:  |  Size: 475 B

After

Width:  |  Height:  |  Size: 475 B

BIN
public/img/icons/csv.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 509 B

View File

Before

Width:  |  Height:  |  Size: 415 B

After

Width:  |  Height:  |  Size: 415 B

View File

Before

Width:  |  Height:  |  Size: 535 B

After

Width:  |  Height:  |  Size: 535 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 550 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 524 B

View File

Before

Width:  |  Height:  |  Size: 486 B

After

Width:  |  Height:  |  Size: 486 B

View File

Before

Width:  |  Height:  |  Size: 532 B

After

Width:  |  Height:  |  Size: 532 B

View File

Before

Width:  |  Height:  |  Size: 621 B

After

Width:  |  Height:  |  Size: 621 B

BIN
public/img/icons/host.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 500 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 541 B

View File

Before

Width:  |  Height:  |  Size: 490 B

After

Width:  |  Height:  |  Size: 490 B

BIN
public/img/icons/json.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 517 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 487 B

BIN
public/img/icons/pdf.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 507 B

View File

Before

Width:  |  Height:  |  Size: 661 B

After

Width:  |  Height:  |  Size: 661 B

View File

Before

Width:  |  Height:  |  Size: 506 B

After

Width:  |  Height:  |  Size: 506 B

View File

Before

Width:  |  Height:  |  Size: 496 B

After

Width:  |  Height:  |  Size: 496 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 599 B

View File

Before

Width:  |  Height:  |  Size: 418 B

After

Width:  |  Height:  |  Size: 418 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 509 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 553 B

After

Width:  |  Height:  |  Size: 553 B

View File

Before

Width:  |  Height:  |  Size: 487 B

After

Width:  |  Height:  |  Size: 487 B