monitoring: Use $hostgroup instead of $h in the list/hostgroups view script

refs #5543
This commit is contained in:
Eric Lippmann 2015-09-24 15:07:36 +02:00
parent 1b46348a1a
commit da50ade2fb
1 changed files with 111 additions and 111 deletions

View File

@ -14,7 +14,7 @@ if (! $this->compact): ?>
<?php
$firstRow = true;
foreach ($hostgroups as $h): ?>
foreach ($hostgroups as $hostgroup): ?>
<?php if ($firstRow): ?>
<?php $firstRow = false ?>
<table class="groupview action" data-base-target="_next">
@ -30,34 +30,34 @@ foreach ($hostgroups as $h): ?>
<?php endif ?>
<?php
if ($h->hosts_down_unhandled) {
if ($hostgroup->hosts_down_unhandled) {
$handled = false;
$state = Host::STATE_DOWN;
$lastStateChange = $h->hosts_down_last_state_change_unhandled;
} elseif ($h->hosts_unreachable_unhandled) {
$lastStateChange = $hostgroup->hosts_down_last_state_change_unhandled;
} elseif ($hostgroup->hosts_unreachable_unhandled) {
$handled = false;
$state = Host::STATE_UNREACHABLE;
$lastStateChange = $h->hosts_unreachable_last_state_change_unhandled;
$lastStateChange = $hostgroup->hosts_unreachable_last_state_change_unhandled;
} else {
$handled = true;
if ($h->hosts_down_handled) {
if ($hostgroup->hosts_down_handled) {
$state = Host::STATE_DOWN;
$lastStateChange = $h->hosts_down_last_state_change_handled;
} elseif ($h->hosts_unreachable_handled) {
$lastStateChange = $hostgroup->hosts_down_last_state_change_handled;
} elseif ($hostgroup->hosts_unreachable_handled) {
$state = Host::STATE_UNREACHABLE;
$lastStateChange = $h->hosts_unreachable_last_state_change_handled;
} elseif ($h->hosts_up) {
$lastStateChange = $hostgroup->hosts_unreachable_last_state_change_handled;
} elseif ($hostgroup->hosts_up) {
$state = Host::STATE_UP;
$lastStateChange = $h->hosts_up_last_state_change;
$lastStateChange = $hostgroup->hosts_up_last_state_change;
} else {
$state = Host::STATE_PENDING;
$lastStateChange = $h->hosts_pending_last_state_change;
$lastStateChange = $hostgroup->hosts_pending_last_state_change;
}
}
?>
<tr class="state <?= Host::getStateText($state) ?><?= $handled ? ' handled' : '' ?>" href="<?=
$this->href('monitoring/list/hosts', array('hostgroup_name' => $h->hostgroup_name))
$this->href('monitoring/list/hosts', array('hostgroup_name' => $hostgroup->hostgroup_name))
?>">
<td class="state">
<strong><?= Host::getStateText($state, true) ?></strong>
@ -66,32 +66,32 @@ if ($h->hosts_down_unhandled) {
</td>
<td class="groupname">
<?= $this->qlink(
$h->hostgroup_alias,
$hostgroup->hostgroup_alias,
'monitoring/list/hosts',
array('hostgroup_name' => $h->hostgroup_name),
array('title' => sprintf($this->translate('List all hosts in the group "%s"'), $h->hostgroup_alias))
array('hostgroup_name' => $hostgroup->hostgroup_name),
array('title' => sprintf($this->translate('List all hosts in the group "%s"'), $hostgroup->hostgroup_alias))
) ?>
</td>
<td class="total">
<?= $this->qlink(
$h->hosts_total,
$hostgroup->hosts_total,
'monitoring/list/hosts',
array('hostgroup_name' => $h->hostgroup_name),
array('hostgroup_name' => $hostgroup->hostgroup_name),
array('title' => sprintf(
$this->translate('List all hosts in host group "%s"'),
$h->hostgroup_alias
$hostgroup->hostgroup_alias
))
) ?>
</td>
<td>
<?php if ($h->hosts_up): ?>
<?php if ($hostgroup->hosts_up): ?>
<span class="state ok">
<?= $this->qlink(
$h->hosts_up,
$hostgroup->hosts_up,
'monitoring/list/hosts',
array(
'host_state' => 0,
'hostgroup_name' => $h->hostgroup_name,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'host_severity'
),
array(
@ -99,25 +99,25 @@ if ($h->hosts_down_unhandled) {
$this->translatePlural(
'List %u host that is currently in state UP in the host group "%s"',
'List %u hosts which are currently in state UP in the host group "%s"',
$h->hosts_up
$hostgroup->hosts_up
),
$h->hosts_up,
$h->hostgroup_alias
$hostgroup->hosts_up,
$hostgroup->hostgroup_alias
)
)
) ?>
</span>
<?php endif ?>
<?php if ($h->hosts_down_unhandled): ?>
<?php if ($hostgroup->hosts_down_unhandled): ?>
<span class="state critical">
<?= $this->qlink(
$h->hosts_down_unhandled,
$hostgroup->hosts_down_unhandled,
'monitoring/list/hosts',
array(
'host_state' => 1,
'host_acknowledged' => 0,
'host_in_downtime' => 0,
'hostgroup_name' => $h->hostgroup_name,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'host_severity'
),
array(
@ -125,23 +125,23 @@ if ($h->hosts_down_unhandled) {
$this->translatePlural(
'List %u host that is currently in state DOWN in the host group "%s"',
'List %u hosts which are currently in state DOWN in the host group "%s"',
$h->hosts_down_unhandled
$hostgroup->hosts_down_unhandled
),
$h->hosts_down_unhandled,
$h->hostgroup_alias
$hostgroup->hosts_down_unhandled,
$hostgroup->hostgroup_alias
)
)
) ?>
<?php endif ?>
<?php if ($h->hosts_down_handled): ?>
<?php if ($hostgroup->hosts_down_handled): ?>
<span class="state critical handled">
<?= $this->qlink(
$h->hosts_down_handled,
$hostgroup->hosts_down_handled,
'monitoring/list/hosts',
array(
'host_state' => 1,
'host_handled' => 1,
'hostgroup_name' => $h->hostgroup_name,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'host_severity'
),
array(
@ -149,28 +149,28 @@ if ($h->hosts_down_unhandled) {
$this->translatePlural(
'List %u host that is currently in state DOWN (Acknowledged) in the host group "%s"',
'List %u hosts which are currently in state DOWN (Acknowledged) in the host group "%s"',
$h->hosts_down_handled
$hostgroup->hosts_down_handled
),
$h->hosts_down_handled,
$h->hostgroup_alias
$hostgroup->hosts_down_handled,
$hostgroup->hostgroup_alias
)
)
) ?>
</span>
<?php endif ?>
<?php if ($h->hosts_down_unhandled): ?>
<?php if ($hostgroup->hosts_down_unhandled): ?>
</span>
<?php endif ?>
<?php if ($h->hosts_unreachable_unhandled): ?>
<?php if ($hostgroup->hosts_unreachable_unhandled): ?>
<span class="state unknown">
<?= $this->qlink(
$h->hosts_unreachable_unhandled,
$hostgroup->hosts_unreachable_unhandled,
'monitoring/list/hosts',
array(
'host_state' => 2,
'host_acknowledged' => 0,
'host_in_downtime' => 0,
'hostgroup_name' => $h->hostgroup_name,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'host_severity'
),
array(
@ -178,23 +178,23 @@ if ($h->hosts_down_unhandled) {
$this->translatePlural(
'List %u host that is currently in state UNREACHABLE in the host group "%s"',
'List %u hosts which are currently in state UNREACHABLE in the host group "%s"',
$h->hosts_unreachable_unhandled
$hostgroup->hosts_unreachable_unhandled
),
$h->hosts_unreachable_unhandled,
$h->hostgroup_alias
$hostgroup->hosts_unreachable_unhandled,
$hostgroup->hostgroup_alias
)
)
) ?>
<?php endif ?>
<?php if ($h->hosts_unreachable_handled): ?>
<?php if ($hostgroup->hosts_unreachable_handled): ?>
<span class="state unknown handled">
<?= $this->qlink(
$h->hosts_unreachable_handled,
$hostgroup->hosts_unreachable_handled,
'monitoring/list/hosts',
array(
'host_state' => 2,
'host_handled' => 1,
'hostgroup_name' => $h->hostgroup_name,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'host_severity'
),
array(
@ -202,26 +202,26 @@ if ($h->hosts_down_unhandled) {
$this->translatePlural(
'List %u host that is currently in state UNREACHABLE (Acknowledged) in the host group "%s"',
'List %u hosts which are currently in state UNREACHABLE (Acknowledged) in the host group "%s"',
$h->hosts_unreachable_handled
$hostgroup->hosts_unreachable_handled
),
$h->hosts_unreachable_handled,
$h->hostgroup_alias
$hostgroup->hosts_unreachable_handled,
$hostgroup->hostgroup_alias
)
)
) ?>
</span>
<?php endif ?>
<?php if ($h->hosts_unreachable_unhandled): ?>
<?php if ($hostgroup->hosts_unreachable_unhandled): ?>
</span>
<?php endif ?>
<?php if ($h->hosts_pending): ?>
<?php if ($hostgroup->hosts_pending): ?>
<span class="state pending">
<?= $this->qlink(
$h->hosts_pending,
$hostgroup->hosts_pending,
'monitoring/list/hosts',
array(
'host_state' => 99,
'hostgroup_name' => $h->hostgroup_name,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'host_severity'
),
array(
@ -229,10 +229,10 @@ if ($h->hosts_down_unhandled) {
$this->translatePlural(
'List %u host that is currently in state PENDING in the host group "%s"',
'List %u hosts which are currently in state PENDING in the host group "%s"',
$h->hosts_pending
$hostgroup->hosts_pending
),
$h->hosts_pending,
$h->hostgroup_alias
$hostgroup->hosts_pending,
$hostgroup->hostgroup_alias
)
)
) ?>
@ -241,24 +241,24 @@ if ($h->hosts_down_unhandled) {
</td>
<td class="total">
<?= $this->qlink(
$h->services_total,
$hostgroup->services_total,
'monitoring/list/services',
array('hostgroup_name' => $h->hostgroup_name),
array('hostgroup_name' => $hostgroup->hostgroup_name),
array('title' => sprintf(
$this->translate('List all services of all hosts in host group "%s"'),
$h->hostgroup_alias
$hostgroup->hostgroup_alias
))
) ?>
</td>
<td>
<?php if ($h->services_ok): ?>
<?php if ($hostgroup->services_ok): ?>
<span class="state ok">
<?= $this->qlink(
$h->services_ok,
$hostgroup->services_ok,
'monitoring/list/services',
array(
'service_state' => 0,
'hostgroup_name' => $h->hostgroup_name,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'service_severity'
),
array(
@ -266,26 +266,26 @@ if ($h->hosts_down_unhandled) {
$this->translatePlural(
'List %u service that is currently in state OK on hosts in the host group "%s"',
'List %u services which are currently in state OK on hosts in the host group "%s"',
$h->services_ok
$hostgroup->services_ok
),
$h->services_ok,
$h->hostgroup_alias
$hostgroup->services_ok,
$hostgroup->hostgroup_alias
)
)
) ?>
</span>
<?php endif ?>
<?php if ($h->services_critical_unhandled): ?>
<?php if ($hostgroup->services_critical_unhandled): ?>
<span class="state critical">
<?= $this->qlink(
$h->services_critical_unhandled,
$hostgroup->services_critical_unhandled,
'monitoring/list/services',
array(
'service_state' => 2,
'service_acknowledged' => 0,
'service_in_downtime' => 0,
'host_problem' => 0,
'hostgroup_name' => $h->hostgroup_name,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'service_severity'
),
array(
@ -293,23 +293,23 @@ if ($h->hosts_down_unhandled) {
$this->translatePlural(
'List %u service that is currently in state CRITICAL on hosts in the host group "%s"',
'List %u services which are currently in state CRITICAL on hosts in the host group "%s"',
$h->services_critical_unhandled
$hostgroup->services_critical_unhandled
),
$h->services_critical_unhandled,
$h->hostgroup_alias
$hostgroup->services_critical_unhandled,
$hostgroup->hostgroup_alias
)
)
) ?>
<?php endif ?>
<?php if ($h->services_critical_handled): ?>
<?php if ($hostgroup->services_critical_handled): ?>
<span class="state critical handled">
<?= $this->qlink(
$h->services_critical_handled,
$hostgroup->services_critical_handled,
'monitoring/list/services',
array(
'service_state' => 2,
'service_handled' => 1,
'hostgroup_name' => $h->hostgroup_name,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'service_severity'
),
array(
@ -317,29 +317,29 @@ if ($h->hosts_down_unhandled) {
$this->translatePlural(
'List %u service that is currently in state CRITICAL (Acknowledged) on hosts in the host group "%s"',
'List %u services which are currently in state CRITICAL (Acknowledged) on hosts in the host group "%s"',
$h->services_critical_handled
$hostgroup->services_critical_handled
),
$h->services_critical_handled,
$h->hostgroup_alias
$hostgroup->services_critical_handled,
$hostgroup->hostgroup_alias
)
)
) ?>
</span>
<?php endif ?>
<?php if ($h->services_critical_unhandled): ?>
<?php if ($hostgroup->services_critical_unhandled): ?>
</span>
<?php endif ?>
<?php if ($h->services_unknown_unhandled): ?>
<?php if ($hostgroup->services_unknown_unhandled): ?>
<span class="state unknown">
<?= $this->qlink(
$h->services_unknown_unhandled,
$hostgroup->services_unknown_unhandled,
'monitoring/list/services',
array(
'service_state' => 3,
'service_acknowledged' => 0,
'service_in_downtime' => 0,
'host_problem' => 0,
'hostgroup_name' => $h->hostgroup_name,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'service_severity'
),
array(
@ -347,23 +347,23 @@ if ($h->hosts_down_unhandled) {
$this->translatePlural(
'List %u service that is currently in state UNKNOWN on hosts in the host group "%s"',
'List %u services which are currently in state UNKNOWN on hosts in the host group "%s"',
$h->services_unknown_unhandled
$hostgroup->services_unknown_unhandled
),
$h->services_unknown_unhandled,
$h->hostgroup_alias
$hostgroup->services_unknown_unhandled,
$hostgroup->hostgroup_alias
)
)
) ?>
<?php endif ?>
<?php if ($h->services_unknown_handled): ?>
<?php if ($hostgroup->services_unknown_handled): ?>
<span class="state unknown handled">
<?= $this->qlink(
$h->services_unknown_handled,
$hostgroup->services_unknown_handled,
'monitoring/list/services',
array(
'service_state' => 3,
'service_handled' => 1,
'hostgroup_name' => $h->hostgroup_name,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'service_severity'
),
array(
@ -371,29 +371,29 @@ if ($h->hosts_down_unhandled) {
$this->translatePlural(
'List %u service that is currently in state UNKNOWN (Acknowledged) on hosts in the host group "%s"',
'List %u services which are currently in state UNKNOWN (Acknowledged) on hosts in the host group "%s"',
$h->services_unknown_handled
$hostgroup->services_unknown_handled
),
$h->services_unknown_handled,
$h->hostgroup_alias
$hostgroup->services_unknown_handled,
$hostgroup->hostgroup_alias
)
)
) ?>
</span>
<?php endif ?>
<?php if ($h->services_unknown_unhandled): ?>
<?php if ($hostgroup->services_unknown_unhandled): ?>
</span>
<?php endif ?>
<?php if ($h->services_warning_unhandled): ?>
<?php if ($hostgroup->services_warning_unhandled): ?>
<span class="state warning">
<?= $this->qlink(
$h->services_warning_unhandled,
$hostgroup->services_warning_unhandled,
'monitoring/list/services',
array(
'service_state' => 1,
'service_acknowledged' => 0,
'service_in_downtime' => 0,
'host_problem' => 0,
'hostgroup_name' => $h->hostgroup_name,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'service_severity'
),
array(
@ -401,23 +401,23 @@ if ($h->hosts_down_unhandled) {
$this->translatePlural(
'List %u service that is currently in state WARNING on hosts in the host group "%s"',
'List %u services which are currently in state WARNING on hosts in the host group "%s"',
$h->services_warning_unhandled
$hostgroup->services_warning_unhandled
),
$h->services_warning_unhandled,
$h->hostgroup_alias
$hostgroup->services_warning_unhandled,
$hostgroup->hostgroup_alias
)
)
) ?>
<?php endif ?>
<?php if ($h->services_warning_handled): ?>
<?php if ($hostgroup->services_warning_handled): ?>
<span class="state warning handled">
<?= $this->qlink(
$h->services_warning_handled,
$hostgroup->services_warning_handled,
'monitoring/list/services',
array(
'service_state' => 1,
'service_handled' => 1,
'hostgroup_name' => $h->hostgroup_name,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'service_severity'
),
array(
@ -425,26 +425,26 @@ if ($h->hosts_down_unhandled) {
$this->translatePlural(
'List %u service that is currently in state WARNING (Acknowledged) on hosts in the host group "%s"',
'List %u services which are currently in state WARNING (Acknowledged) on hosts in the host group "%s"',
$h->services_warning_handled
$hostgroup->services_warning_handled
),
$h->services_warning_handled,
$h->hostgroup_alias
$hostgroup->services_warning_handled,
$hostgroup->hostgroup_alias
)
)
) ?>
</span>
<?php endif ?>
<?php if ($h->services_warning_unhandled): ?>
<?php if ($hostgroup->services_warning_unhandled): ?>
</span>
<?php endif ?>
<?php if ($h->services_pending): ?>
<?php if ($hostgroup->services_pending): ?>
<span class="state pending">
<?= $this->qlink(
$h->services_pending,
$hostgroup->services_pending,
'monitoring/list/services',
array(
'service_state' => 99,
'hostgroup_name' => $h->hostgroup_name,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'service_severity'
),
array(
@ -452,10 +452,10 @@ if ($h->hosts_down_unhandled) {
$this->translatePlural(
'List %u service that is currently in state PENDING on hosts in the host group "%s"',
'List %u services which are currently in state PENDING on hosts in the host group "%s"',
$h->services_pending
$hostgroup->services_pending
),
$h->services_pending,
$h->hostgroup_alias
$hostgroup->services_pending,
$hostgroup->hostgroup_alias
)
)
) ?>