Host/Detail: List properties explicitly, not with view helper

refs #4823
This commit is contained in:
Eric Lippmann 2013-10-14 12:50:08 +02:00
parent b28b4ba96a
commit 408f369e45
3 changed files with 97 additions and 20 deletions

View File

@ -1,15 +1,93 @@
<div class="panel panel-default">
<div class="panel-heading">
<span>Properties</span>
</div>
<div class="panel-heading">Properties</div>
<div class="panel-body">
<table class="table table-bordered">
<?php foreach ($this->monitoringProperties($object) as $label => $value): ?>
<tr>
<th><?= $label ?></th>
<td><?= $value ?></td>
<th>Current Attempt</th>
<td>
<?= sprintf(
'%s/%s (%s state)',
$object->current_check_attempt,
$object->max_check_attempts,
($object->state_type === '1') ? 'HARD' : 'SOFT'
); ?>
</td>
</tr>
<tr>
<th>Check Type</th>
<td>
<?php if ($object->passive_checks_enabled === '1' && $object->active_checks_enabled === '0'): ?>
PASSIVE
<?php elseif ($object->passive_checks_enabled === '0' && $object->active_checks_enabled === '0'): ?>
DISABLED
<?php else: ?>
ACTIVE
<?php endif; ?>
</td>
</tr>
<tr>
<th>Check Latency / Duration</th>
<td>
<?php if ($object->passive_checks_enabled === '0' && $object->active_checks_enabled === '0'): ?>
N/A
<?php else: ?>
<?= sprintf('%.4f', $object->check_latency); ?> / <?= sprintf('%.4f', $object->check_execution_time); ?> seconds
<?php endif; ?>
</td>
</tr>
<tr>
<th>Last Notification</th>
<td>
<?php
if ($object->service_description) {
$notificationsHref = $this->href('monitoring/list/notifications',
array(
'host' => $object->host_name,
'service' => $object->service_description
)
);
} else {
$notificationsHref = $this->href('monitoring/list/notifications',
array(
'host' => $object->host_name
)
);
}
?>
<a href="<?= $notificationsHref ?>">
<?php if ($object->last_notification === '0000-00-00 00:00:00'): ?>
N/A
<?php else: ?>
<?= $object->last_notification ?>
<?php if ($object->current_notification_number > 0): ?>
<br />
<?= $object->current_notification_number ?> notifications sent during current problem state
<?php endif ;?>
<?php endif; ?>
</a>
</td>
</tr>
<tr>
<th>Is This <?= $object->service_description ? 'Service' : 'Host' ?> Flapping?</th>
<td>
<?php if ($object->is_flapping === '1'): ?>
YES
<?php else: ?>
NO
<?php endif; ?>
<?= sprintf('%.2f', $object->percent_state_change); ?>% state change
</td>
</tr>
<tr>
<th>In Scheduled Downtime?</th>
<td>
<?php if ($object->in_downtime === '1'): ?>
YES
<?php else: ?>
NO
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</table>
</div>
</div>

View File

@ -10,7 +10,9 @@
<?php endif; ?>
<h4>
Host Status
<?= $this->escape($this->object->host_name); ?>
<a href="<?= $this->href('monitoring/list/services', array('host' => $object->host_name)); ?>">
<?= $this->escape($this->object->host_name); ?>
</a>
<?php if ($this->object->host_address && $this->object->host_address !== $this->object->host_name): ?>
(<?= $this->object->host_address; ?>)
<?php endif; ?>
@ -53,6 +55,7 @@
<div>
<table>
<i class="successIcon"></i>
<tr>
<?php if (!$object->host_handled && $object->host_state > 0): ?>
<td>
@ -101,16 +104,6 @@
<td><?= $this->perfdata($this->object->perfdata); ?></td>
</tr>
<?php endif; ?>
<tr>
<td colspan="2">
<a href="<?= $this->href('monitoring/list/services', array('host' => $object->host_name)); ?>">
View Services For This Host
</a>
</td>
<td>
<a class="button" href="#">{{{RECHECK_ALL_SERVICES_COMMAND}}</a>
</td>
</tr>
</table>
</div>
</div>

View File

@ -41,7 +41,7 @@ class Host extends AbstractObject
'host_address',
'host_state',
'host_handled',
'host_in_downtime',
'in_downtime' => 'host_in_downtime',
'host_acknowledged',
'host_last_state_change',
'last_check' => 'host_last_check',
@ -58,7 +58,13 @@ class Host extends AbstractObject
'notifications_enabled' => 'host_notifications_enabled',
'event_handler_enabled' => 'host_event_handler_enabled',
'flap_detection_enabled' => 'host_flap_detection_enabled',
'active_checks_enabled' => 'host_active_checks_enabled'
'active_checks_enabled' => 'host_active_checks_enabled',
'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',
'is_flapping' => 'host_is_flapping'
))->where('host_name', $this->name1)->fetchRow();
}
}