Skip to content

Commit

Permalink
monitoring: Add HostController's show action view script
Browse files Browse the repository at this point in the history
  • Loading branch information
lippserd committed Sep 17, 2014
1 parent 71ffd0e commit 5cdcf36
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 15 deletions.
27 changes: 27 additions & 0 deletions modules/monitoring/application/views/scripts/host/show.phtml
@@ -0,0 +1,27 @@
<div class="controls">
<?= $this->render('show/components/header.phtml') ?>
<?= $this->render('show/components/hostservicesummary.phtml') ?>
</div>
<div class="content" data-base-target="_next">
<?= $this->render('show/components/output.phtml') ?>
<?= $this->render('show/components/grapher.phtml') ?>

<table class="avp newsection">
<tbody>
<?= $this->render('show/components/acknowledgement.phtml') ?>
<?= $this->render('show/components/comments.phtml') ?>
<?= $this->render('show/components/notifications.phtml') ?>
<?= $this->render('show/components/downtime.phtml') ?>
<?= $this->render('show/components/flapping.phtml') ?>
<?= $this->render('show/components/perfdata.phtml') ?>
<?= $this->render('show/components/checksource.phtml') ?>
<?= $this->render('show/components/actions.phtml') ?>
<?= $this->render('show/components/command.phtml') ?>
<?= $this->render('show/components/hostgroups.phtml') ?>
<?= $this->render('show/components/contacts.phtml') ?>
<?= $this->render('show/components/checkstatistics.phtml') ?>
<?= $this->render('show/components/customvars.phtml') ?>
<?= $this->render('show/components/flags.phtml') ?>
</tbody>
</table>
</div>
Expand Up @@ -6,10 +6,10 @@ $currentUrl = Url::fromRequest()->without('limit')->getRelativeUrl();

?>
<h3 class="tinystatesummary" <?= $this->compact ? ' data-base-target="col1"' : '' ?>>
<?= $this->qlink(sprintf($this->translate('%s configured services:'), $this->stats->services_total), $selfUrl) ?>
<?php if ($this->stats->services_ok > 0): ?>
<?= $this->qlink(sprintf($this->translate('%s configured services:'), $object->stats->services_total), $selfUrl) ?>
<?php if ($object->stats->services_ok > 0): ?>
<span class="state ok<?= $currentUrl === $selfUrl->with('service_state', 0)->getRelativeUrl() ? ' active' : '' ?>"><?= $this->qlink(
$this->stats->services_ok,
$object->stats->services_ok,
$selfUrl,
array('service_state' => 0),
array('title' => sprintf($this->translate('Services with state %s'), strtoupper($this->translate('ok'))))
Expand All @@ -19,12 +19,12 @@ $currentUrl = Url::fromRequest()->without('limit')->getRelativeUrl();

foreach (array(2 => 'critical', 3 => 'unknown', 1 => 'warning') as $stateId => $state) {
$pre = 'services_' . $state;
if ($this->stats->$pre) {
if ($object->stats->$pre) {
$handled = $pre . '_handled';
$unhandled = $pre . '_unhandled';
$paramsHandled = array('service_state' => $stateId, 'service_handled' => 1);
$paramsUnhandled = array('service_state' => $stateId, 'service_handled' => 0);
if ($this->stats->$unhandled) {
if ($object->stats->$unhandled) {
$compareUrl = $selfUrl->with($paramsUnhandled)->getRelativeUrl();
} else {
$compareUrl = $selfUrl->with($paramsHandled)->getRelativeUrl();
Expand All @@ -35,34 +35,34 @@ foreach (array(2 => 'critical', 3 => 'unknown', 1 => 'warning') as $stateId => $
} else {
$active = '';
}
echo '<span class="state ' . $state . $active . ($this->stats->$unhandled ? '' : ' handled') . '">';
if ($this->stats->$unhandled) {

echo '<span class="state ' . $state . $active . ($object->stats->$unhandled ? '' : ' handled') . '">';
if ($object->stats->$unhandled) {

echo $this->qlink(
$this->stats->$unhandled,
$object->stats->$unhandled,
$selfUrl,
$paramsUnhandled,
array('title' => sprintf($this->translate('Unhandled services with state %s'), strtoupper($this->translate($state))))
);
}
if ($this->stats->$handled) {
if ($object->stats->$handled) {

if ($selfUrl->with($paramsHandled)->getRelativeUrl() === $currentUrl) {
$active = ' active';
} else {
$active = '';
}
if ($this->stats->$unhandled) {
if ($object->stats->$unhandled) {
echo '<span class="state handled ' . $state . $active . '">';
}
echo $this->qlink(
$this->stats->$handled,
$object->stats->$handled,
$selfUrl,
$paramsHandled,
array('title' => sprintf($this->translate('Handled services with state %s'), strtoupper($this->translate($state))))
);
if ($this->stats->$unhandled) {
if ($object->stats->$unhandled) {
echo "</span>\n";
}
}
Expand All @@ -71,9 +71,9 @@ foreach (array(2 => 'critical', 3 => 'unknown', 1 => 'warning') as $stateId => $
}

?>
<?php if ($this->stats->services_pending): ?>
<?php if ($object->stats->services_pending): ?>
<span class="state pending<?= $currentUrl === $selfUrl->with('service_state', 99)->getRelativeUrl() ? ' active' : '' ?>"><?= $this->qlink(
$this->stats->services_pending,
$object->stats->services_pending,
$selfUrl,
array('service_state' => 99),
array('title' => sprintf($this->translate('Services with state %s'), strtoupper($this->translate('pending'))))
Expand Down

0 comments on commit 5cdcf36

Please sign in to comment.