Implement hosts view

refs #4824
This commit is contained in:
Marius Hein 2013-10-09 11:48:42 +02:00 committed by Eric Lippmann
parent e06e38ac5f
commit 7e396fdf3f
23 changed files with 144 additions and 33 deletions

View File

@ -113,6 +113,7 @@
</a>
</span>
<div>
<b>Up</b><br />
Since&nbsp;
30.09.

View File

@ -116,7 +116,9 @@ class Monitoring_ListController extends MonitoringController
'host_notes_url',
'host_last_comment',
'host_active_checks_enabled',
'host_passive_checks_enabled'
'host_passive_checks_enabled',
'host_current_check_attempt',
'host_max_check_attempts'
)
)->getQuery();
$this->view->hosts = $query->paginate();

View File

@ -15,37 +15,42 @@ $viewHelper = $this->getHelper('MonitoringState');
<tr>
<th colspan="3">Status</th>
<th>Host</th>
<th>Output</th>
</tr>
</thead>
<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"' : ''; ?> >
<td>
<!-- 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 -->
<td>
<?php if (!$host->host_handled && $host->host_state > 0): ?>
<a href="#" title="Unhandled">
<i>{{UNHANDLED_ICON}}</i>
<i class="icon-table icinga-icon-unhandled"></i>
</a>
<?php endif; ?>
<?php if ($host->host_acknowledged && !$host->host_in_downtime): ?>
<a href="#" title="Acknowledged">
<i>{{ACKNOWLEDGED_ICON}}</i>
<i class="icon-table icinga-icon-acknowledgement"></i>
</a>
<?php endif; ?>
<?php if ($host->host_is_flapping): ?>
<a href="#" title="Flapping">
<i>{{FLAPPING_ICON}}</i>
<i class="icon-table icinga-icon-flapping"></i>
</a>
<?php endif; ?>
@ -57,7 +62,7 @@ $viewHelper = $this->getHelper('MonitoringState');
<?php if ($host->host_in_downtime): ?>
<a href="#" title="In Downtime">
<i>{{IN_DOWNTIME_ICON}}</i>
<i class="icon-table icinga-icon-in-downtime"></i>
</a>
<?php endif; ?>
@ -68,43 +73,38 @@ $viewHelper = $this->getHelper('MonitoringState');
</a>
<?php else: ?>
<a href="#" title="Active Checks Disabled">
<i>{{ACTIVE_CHECKS_DISABLED_ICON}}</i>
<i class="icon-table icinga-icon-disabled"></i>
</a>
<?php endif; ?>
<?php endif; ?>
<?php if ($host->host_last_comment !== null): ?>
<a href="#" title="Comments">
<i>{{COMMENT_ICON}}</i>
<i class="icon-table icinga-icon-comment"></i>
</a>
<?php endif; ?>
</td>
<!-- State -->
<td title="<?= $viewHelper->getStateTitle($host, 'host'); ?>">
<div>
<?php if ($host->host_state_type == 0): ?>
<a href="#" title="Soft State">
<i>{{SOFTSTATE_ICON}}</i>
</a>
<?php endif; ?>
<b><?= ucfirst($viewHelper->monitoringState($host, 'host')); ?></b>
Since&nbsp;
<?= $this->timeSince($host->host_last_state_change); ?>
</div>
</td>
<td>
<?php if ($host->host_unhandled_service_count): ?>
<span class="badge pull-right">
<?php if ($host->host_unhandled_service_count): ?>
<span class="badge pull-right">
<a href="<?= $this->href('monitoring/list/services', array('host' => $host->host_name, 'service_problems' => 1)); ?>">
<?= $host->host_unhandled_service_count; ?>
</a>
</span>
<?php endif; ?>
<?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; ?>)
</div>
</td>
<!-- Host / Status / Output -->
<td>
<a href="<?= $this->href('monitoring/list/services', array('host' => $host->host_name)) ?>">
<b><?= $host->host_name ?></b><br/>
<i><?= $host->host_address ?></i>
<b><?= $host->host_name ?></b> (<i><?= $host->host_address ?></i>)
</a>
<?php if (!empty($host->host_action_url)): ?>
@ -113,10 +113,8 @@ $viewHelper = $this->getHelper('MonitoringState');
<?php if (!empty($host->host_notes_url)): ?>
<a href="<?= $host->host_notes_url; ?>">Notes</a>
<?php endif; ?>
</td>
<td>
<?= $this->escape(substr(strip_tags($host->host_output), 0, 10000)); ?>
<br /><?= $this->escape(substr(strip_tags($host->host_output), 0, 10000)); ?>
</td>
</tr>
<?php endforeach; ?>

View File

@ -41,6 +41,8 @@ class HoststatusQuery extends AbstractQuery
'host_last_time_up' => 'hs.last_time_up',
'host_last_time_down' => 'hs.last_time_down',
'host_last_time_unreachable' => 'hs.last_time_unreachable',
'host_current_check_attempt' => 'hs.current_check_attempt',
'host_max_check_attempts' => 'hs.max_check_attempts',
'host_severity' => 'CASE WHEN hs.current_state = 0
THEN

View File

@ -59,8 +59,8 @@ class Host extends AbstractObject
'event_handler_enabled' => 'host_event_handler_enabled',
'flap_detection_enabled' => 'host_flap_detection_enabled',
'active_checks_enabled' => 'host_active_checks_enabled',
'current_check_attempt' => 'host_current_check_attempt',
'max_check_attempts' => 'host_max_check_attempts',
'current_check_attempt' => 'host_current_check_attempt',
'max_check_attempts' => 'host_max_check_attempts'
'last_notification' => 'host_last_notification',
'current_notification_number' => 'host_current_notification_number',
'percent_state_change' => 'host_percent_state_change',

View File

@ -37,6 +37,8 @@ class HoststatusView extends AbstractView
'host_last_time_up',
'host_last_time_down',
'host_last_time_unreachable',
'host_current_check_attempt',
'host_max_check_attempts',
// Services
'services_cnt',

104
public/css/icons.css Normal file
View File

@ -0,0 +1,104 @@
.icinga-icon-acknowledgement {
background: transparent url("../img/images/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;
display: inline-block;
width: 16px;
height: 16px;
}
.icinga-icon-create {
background: transparent url("../img/images/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;
display: inline-block;
width: 16px;
height: 16px;
}
.icinga-icon-disabled {
background: transparent url("../img/images/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;
display: inline-block;
width: 16px;
height: 16px;
}
.icinga-icon-error {
background: transparent url("../img/images/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;
display: inline-block;
width: 16px;
height: 16px;
}
.icinga-icon-in-downtime {
background: transparent url("../img/images/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;
display: inline-block;
width: 16px;
height: 16px;
}
.icinga-icon-save {
background: transparent url("../img/images/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;
display: inline-block;
width: 16px;
height: 16px;
}
.icinga-icon-submit {
background: transparent url("../img/images/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;
display: inline-block;
width: 16px;
height: 16px;
}
.icinga-icon-user {
background: transparent url("../img/images/user.png") center center no-repeat;
display: inline-block;
width: 16px;
height: 16px;
}

View File

@ -1,3 +1,5 @@
@import url("icons.css");
body { padding-top: 70px; }
.load-indicator .mask {
@ -298,7 +300,7 @@ select.input-sm {
}
.tacheader-status-ok {
background-color: #00CC33;
/* background-color: #00CC33; */
}
.tacheader-status-warning {
@ -320,7 +322,7 @@ select.input-sm {
}
.tacheader-status-up {
background-color: #00CC33;
/* background-color: #00CC33; */
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 501 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 475 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 415 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 535 B

BIN
public/img/images/edit.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 486 B

BIN
public/img/images/error.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 532 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 621 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 661 B

BIN
public/img/images/save.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 506 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 496 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 418 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 553 B

BIN
public/img/images/user.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 487 B