Skip to content

Commit

Permalink
monitoring: Use state badge widget for service states in the host gro…
Browse files Browse the repository at this point in the history
…up overview

refs #5543
  • Loading branch information
lippserd committed Sep 27, 2015
1 parent d59b09c commit a3d3ba2
Showing 1 changed file with 92 additions and 187 deletions.
279 changes: 92 additions & 187 deletions modules/monitoring/application/views/scripts/list/hostgroups.phtml
Expand Up @@ -146,216 +146,121 @@ if (! $this->compact): ?>
) ?>
</td>
<td>
<?php if ($hostgroup->services_ok): ?>
<span class="state ok">
<?= $this->qlink(
$hostgroup->services_ok,
'monitoring/list/services',
array(
'service_state' => 0,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'service_severity'
),
array(
'title' => sprintf(
$this->translatePlural(
<?php
$stateBadges = new StateBadges();
$stateBadges
->setUrl('monitoring/list/services')
->add(
StateBadges::STATE_OK,
array(
'service_state' => 0,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'service_severity'
),
$hostgroup->services_ok,
'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"',
$hostgroup->services_ok
),
$hostgroup->services_ok,
$hostgroup->hostgroup_alias
array($hostgroup->services_ok, $hostgroup->hostgroup_alias)
)
)
) ?>
</span>
<?php endif ?>
<?php if ($hostgroup->services_critical_unhandled): ?>
<span class="state critical">
<?= $this->qlink(
$hostgroup->services_critical_unhandled,
'monitoring/list/services',
array(
'service_state' => 2,
'service_acknowledged' => 0,
'service_in_downtime' => 0,
'host_problem' => 0,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'service_severity'
),
array(
'title' => sprintf(
$this->translatePlural(
->add(
StateBadges::STATE_CRITICAL,
array(
'service_state' => 2,
'service_acknowledged' => 0,
'service_in_downtime' => 0,
'host_problem' => 0,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'service_severity'
),
$hostgroup->services_critical_unhandled,
'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"',
$hostgroup->services_critical_unhandled
),
$hostgroup->services_critical_unhandled,
$hostgroup->hostgroup_alias
array($hostgroup->services_critical_unhandled, $hostgroup->hostgroup_alias)
)
)
) ?>
<?php endif ?>
<?php if ($hostgroup->services_critical_handled): ?>
<span class="state critical handled">
<?= $this->qlink(
$hostgroup->services_critical_handled,
'monitoring/list/services',
array(
'service_state' => 2,
'service_handled' => 1,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'service_severity'
),
array(
'title' => sprintf(
$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"',
$hostgroup->services_critical_handled
->add(
StateBadges::STATE_CRITICAL_HANDLED,
array(
'service_state' => 2,
'service_handled' => 1,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'service_severity'
),
$hostgroup->services_critical_handled,
$hostgroup->hostgroup_alias
)
'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"',
array($hostgroup->services_critical_unhandled, $hostgroup->hostgroup_alias)
)
) ?>
</span>
<?php endif ?>
<?php if ($hostgroup->services_critical_unhandled): ?>
</span>
<?php endif ?>
<?php if ($hostgroup->services_unknown_unhandled): ?>
<span class="state unknown">
<?= $this->qlink(
$hostgroup->services_unknown_unhandled,
'monitoring/list/services',
array(
'service_state' => 3,
'service_acknowledged' => 0,
'service_in_downtime' => 0,
'host_problem' => 0,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'service_severity'
),
array(
'title' => sprintf(
$this->translatePlural(
->add(
StateBadges::STATE_UNKNOWN,
array(
'service_state' => 3,
'service_acknowledged' => 0,
'service_in_downtime' => 0,
'host_problem' => 0,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'service_severity'
),
$hostgroup->services_unknown_unhandled,
'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"',
$hostgroup->services_unknown_unhandled
),
$hostgroup->services_unknown_unhandled,
$hostgroup->hostgroup_alias
array($hostgroup->services_unknown_unhandled, $hostgroup->hostgroup_alias)
)
)
) ?>
<?php endif ?>
<?php if ($hostgroup->services_unknown_handled): ?>
<span class="state unknown handled">
<?= $this->qlink(
$hostgroup->services_unknown_handled,
'monitoring/list/services',
array(
'service_state' => 3,
'service_handled' => 1,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'service_severity'
),
array(
'title' => sprintf(
$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"',
$hostgroup->services_unknown_handled
->add(
StateBadges::STATE_UNKNOWN_HANDLED,
array(
'service_state' => 3,
'service_handled' => 1,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'service_severity'
),
$hostgroup->services_unknown_handled,
$hostgroup->hostgroup_alias
)
'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"',
array($hostgroup->services_unknown_handled, $hostgroup->hostgroup_alias)

)
) ?>
</span>
<?php endif ?>
<?php if ($hostgroup->services_unknown_unhandled): ?>
</span>
<?php endif ?>
<?php if ($hostgroup->services_warning_unhandled): ?>
<span class="state warning">
<?= $this->qlink(
$hostgroup->services_warning_unhandled,
'monitoring/list/services',
array(
'service_state' => 1,
'service_acknowledged' => 0,
'service_in_downtime' => 0,
'host_problem' => 0,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'service_severity'
),
array(
'title' => sprintf(
$this->translatePlural(
->add(
StateBadges::STATE_WARNING,
array(
'service_state' => 1,
'service_acknowledged' => 0,
'service_in_downtime' => 0,
'host_problem' => 0,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'service_severity'
),
$hostgroup->services_warning_unhandled,
'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"',
$hostgroup->services_warning_unhandled
),
$hostgroup->services_warning_unhandled,
$hostgroup->hostgroup_alias
array($hostgroup->services_warning_unhandled, $hostgroup->hostgroup_alias)
)
)
) ?>
<?php endif ?>
<?php if ($hostgroup->services_warning_handled): ?>
<span class="state warning handled">
<?= $this->qlink(
$hostgroup->services_warning_handled,
'monitoring/list/services',
array(
'service_state' => 1,
'service_handled' => 1,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'service_severity'
),
array(
'title' => sprintf(
$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"',
$hostgroup->services_warning_handled
->add(
StateBadges::STATE_WARNING_HANDLED,
array(
'service_state' => 1,
'service_handled' => 1,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'service_severity'
),
$hostgroup->services_warning_handled,
$hostgroup->hostgroup_alias
)
'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"',
array($hostgroup->services_warning_handled, $hostgroup->hostgroup_alias)
)
) ?>
</span>
<?php endif ?>
<?php if ($hostgroup->services_warning_unhandled): ?>
</span>
<?php endif ?>
<?php if ($hostgroup->services_pending): ?>
<span class="state pending">
<?= $this->qlink(
$hostgroup->services_pending,
'monitoring/list/services',
array(
'service_state' => 99,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'service_severity'
),
array(
'title' => sprintf(
$this->translatePlural(
->add(
StateBadges::STATE_PENDING,
array(
'service_state' => 99,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'service_severity'
),
$hostgroup->services_pending,
'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"',
$hostgroup->services_pending
),
$hostgroup->services_pending,
$hostgroup->hostgroup_alias
)
)
) ?>
</span>
<?php endif ?>
array($hostgroup->services_pending, $hostgroup->hostgroup_alias)
);
echo $stateBadges->render();
?>
</td>
</tr>
<?php endforeach ?>
Expand Down

0 comments on commit a3d3ba2

Please sign in to comment.