monitoring: Use the state badges widget in the service groups overview

refs #5543
This commit is contained in:
Eric Lippmann 2015-09-28 17:52:30 +02:00
parent 56df5e1f8b
commit 2e611bfd03
1 changed files with 108 additions and 201 deletions

View File

@ -1,4 +1,6 @@
<?php if (! $this->compact): ?> <?php use Icinga\Module\Monitoring\Web\Widget\StateBadges;
if (! $this->compact): ?>
<div class="controls"> <div class="controls">
<?= $this->tabs ?> <?= $this->tabs ?>
<?= $this->sortBox ?> <?= $this->sortBox ?>
@ -36,216 +38,121 @@ foreach ($servicegroups as $serviceGroup): ?>
<?= $serviceGroup->services_total ?> <?= $serviceGroup->services_total ?>
</td> </td>
<td> <td>
<?php if ( $serviceGroup->services_ok): ?> <?php
<span class="state ok"> $stateBadges = new StateBadges();
<?= $this->qlink( $stateBadges
$serviceGroup->services_ok, ->setUrl('monitoring/list/services')
'monitoring/list/services', ->add(
array( StateBadges::STATE_OK,
'service_state' => 0, $serviceGroup->services_ok,
'servicegroup_name' => $serviceGroup->servicegroup_name, array(
'sort' => 'service_severity' 'service_state' => 0,
), 'servicegroup_name' => $serviceGroup->servicegroup_name,
array( 'sort' => 'service_severity'
'title' => sprintf(
$this->translatePlural(
'List %s service that is currently in state OK in service group "%s"',
'List %s services which are currently in state OK in service group "%s"',
$serviceGroup->services_ok
), ),
$serviceGroup->services_ok, 'List %s service that is currently in state OK in service group "%s"',
$serviceGroup->servicegroup_alias 'List %s services which are currently in state OK in service group "%s"',
) array($serviceGroup->services_ok, $serviceGroup->servicegroup_alias)
) )
) ?> ->add(
</span> StateBadges::STATE_CRITICAL,
<?php endif ?> $serviceGroup->services_critical_unhandled,
<?php if ( $serviceGroup->services_critical_unhandled): ?> array(
<span class="state critical"> 'service_state' => 2,
<?= $this->qlink( 'service_acknowledged' => 0,
$serviceGroup->services_critical_unhandled, 'service_in_downtime' => 0,
'monitoring/list/services', 'host_problem' => 0,
array( 'servicegroup_name' => $serviceGroup->servicegroup_name,
'service_state' => 2, 'sort' => 'service_severity'
'service_acknowledged' => 0,
'service_in_downtime' => 0,
'host_problem' => 0,
'servicegroup_name' => $serviceGroup->servicegroup_name,
'sort' => 'service_severity'
),
array(
'title' => sprintf(
$this->translatePlural(
'List %s service that is currently in state CRITICAL in service group "%s"',
'List %s services which are currently in state CRITICAL in service group "%s"',
$serviceGroup->services_critical_unhandled
), ),
$serviceGroup->services_critical_unhandled, 'List %s service that is currently in state CRITICAL in service group "%s"',
$serviceGroup->servicegroup_alias 'List %s services which are currently in state CRITICAL in service group "%s"',
) array($serviceGroup->services_critical_unhandled, $serviceGroup->servicegroup_alias)
) )
) ?> ->add(
<?php endif ?> StateBadges::STATE_CRITICAL_HANDLED,
<?php if ( $serviceGroup->services_critical_handled): ?> $serviceGroup->services_critical_handled,
<span class="state critical handled"> array(
<?= $this->qlink( 'service_state' => 2,
$serviceGroup->services_critical_handled, 'service_handled' => 1,
'monitoring/list/services', 'servicegroup_name' => $serviceGroup->servicegroup_name,
array( 'sort' => 'service_severity'
'service_state' => 2,
'service_handled' => 1,
'servicegroup_name' => $serviceGroup->servicegroup_name,
'sort' => 'service_severity'
),
array(
'title' => sprintf(
$this->translatePlural(
'List %s service that is currently in state CRITICAL (Acknowledged) in service group "%s"',
'List %s services which are currently in state CRITICAL (Acknowledged) in service group "%s"',
$serviceGroup->services_critical_handled
),
$serviceGroup->services_critical_handled,
$serviceGroup->servicegroup_alias
)
)
) ?>
</span>
<?php endif ?>
<?php if ( $serviceGroup->services_critical_unhandled): ?>
</span>
<?php endif ?>
<?php if ( $serviceGroup->services_unknown_unhandled): ?>
<span class="state unknown">
<?= $this->qlink(
$serviceGroup->services_unknown_unhandled,
'monitoring/list/services',
array(
'service_state' => 3,
'service_acknowledged' => 0,
'service_in_downtime' => 0,
'host_problem' => 0,
'servicegroup_name' => $serviceGroup->servicegroup_name,
'sort' => 'service_severity'
),
array(
'title' => sprintf(
$this->translatePlural(
'List %s service that is currently in state UNKNOWN in service group "%s"',
'List %s services which are currently in state UNKNOWN in service group "%s"',
$serviceGroup->services_unknown_unhandled
), ),
$serviceGroup->services_unknown_unhandled, 'List %s service that is currently in state CRITICAL (Acknowledged) in service group "%s"',
$serviceGroup->servicegroup_alias 'List %s services which are currently in state CRITICAL (Acknowledged) in service group "%s"',
) array($serviceGroup->services_critical_unhandled, $serviceGroup->servicegroup_alias)
) )
) ?> ->add(
<?php endif ?> StateBadges::STATE_UNKNOWN,
<?php if ( $serviceGroup->services_unknown_handled): ?> $serviceGroup->services_unknown_unhandled,
<span class="state unknown handled"> array(
<?= $this->qlink( 'service_state' => 3,
$serviceGroup->services_unknown_handled, 'service_acknowledged' => 0,
'monitoring/list/services', 'service_in_downtime' => 0,
array( 'host_problem' => 0,
'service_state' => 3, 'servicegroup_name' => $serviceGroup->servicegroup_name,
'service_handled' => 1, 'sort' => 'service_severity'
'servicegroup_name' => $serviceGroup->servicegroup_name,
'sort' => 'service_severity'
),
array(
'title' => sprintf(
$this->translatePlural(
'List %s service that is currently in state UNKNOWN (Acknowledged) in service group "%s"',
'List %s services which are currently in state UNKNOWN (Acknowledged) in service group "%s"',
$serviceGroup->services_unknown_handled
),
$serviceGroup->services_unknown_handled,
$serviceGroup->servicegroup_alias
)
)
) ?>
</span>
<?php endif ?>
<?php if ( $serviceGroup->services_unknown_unhandled): ?>
</span>
<?php endif ?>
<?php if ( $serviceGroup->services_warning_unhandled): ?>
<span class="state warning">
<?= $this->qlink(
$serviceGroup->services_warning_unhandled,
'monitoring/list/services',
array(
'service_state' => 1,
'service_acknowledged' => 0,
'service_in_downtime' => 0,
'host_problem' => 0,
'servicegroup_name' => $serviceGroup->servicegroup_name,
'sort' => 'service_severity'
),
array(
'title' => sprintf(
$this->translatePlural(
'List %s service that is currently in state WARNING in service group "%s"',
'List %s services which are currently in state WARNING in service group "%s"',
$serviceGroup->services_warning_unhandled
), ),
$serviceGroup->services_warning_unhandled, 'List %s service that is currently in state UNKNOWN in service group "%s"',
$serviceGroup->servicegroup_alias 'List %s services which are currently in state UNKNOWN in service group "%s"',
) array($serviceGroup->services_unknown_unhandled, $serviceGroup->servicegroup_alias)
) )
) ?> ->add(
<?php endif ?> StateBadges::STATE_UNKNOWN_HANDLED,
<?php if ( $serviceGroup->services_warning_handled): ?> $serviceGroup->services_unknown_handled,
<span class="state warning handled"> array(
<?= $this->qlink( 'service_state' => 3,
$serviceGroup->services_warning_handled, 'service_handled' => 1,
'monitoring/list/services', 'servicegroup_name' => $serviceGroup->servicegroup_name,
array( 'sort' => 'service_severity'
'service_state' => 1,
'service_handled' => 1,
'servicegroup_name' => $serviceGroup->servicegroup_name,
'sort' => 'service_severity'
),
array(
'title' => sprintf(
$this->translatePlural(
'List %s service that is currently in state WARNING (Acknowledged) in service group "%s"',
'List %s services which are currently in state WARNING (Acknowledged) in service group "%s"',
$serviceGroup->services_warning_handled
),
$serviceGroup->services_warning_handled,
$serviceGroup->servicegroup_alias
)
)
) ?>
</span>
<?php endif ?>
<?php if ( $serviceGroup->services_warning_unhandled): ?>
</span>
<?php endif ?>
<?php if ( $serviceGroup->services_pending): ?>
<span class="state pending">
<?= $this->qlink(
$serviceGroup->services_pending,
'monitoring/list/services',
array(
'service_state' => 99,
'servicegroup_name' => $serviceGroup->servicegroup_name,
'sort' => 'service_severity'
),
array(
'title' => sprintf(
$this->translatePlural(
'List %s service that is currenlty in state PENDING in service group "%s"',
'List %s services which are currently in state PENDING in service group "%s"',
$serviceGroup->services_pending
), ),
$serviceGroup->services_pending, 'List %s service that is currently in state UNKNOWN (Acknowledged) in service group "%s"',
$serviceGroup->servicegroup_alias 'List %s services which are currently in state UNKNOWN (Acknowledged) in service group "%s"',
) array($serviceGroup->services_unknown_handled, $serviceGroup->servicegroup_alias)
) )
) ?> ->add(
</span> StateBadges::STATE_WARNING,
<?php endif ?> $serviceGroup->services_warning_unhandled,
array(
'service_state' => 1,
'service_acknowledged' => 0,
'service_in_downtime' => 0,
'host_problem' => 0,
'servicegroup_name' => $serviceGroup->servicegroup_name,
'sort' => 'service_severity'
),
'List %s service that is currently in state WARNING in service group "%s"',
'List %s services which are currently in state WARNING in service group "%s"',
array($serviceGroup->services_warning_unhandled, $serviceGroup->servicegroup_alias)
)
->add(
StateBadges::STATE_WARNING_HANDLED,
$serviceGroup->services_warning_handled,
array(
'service_state' => 1,
'service_handled' => 1,
'servicegroup_name' => $serviceGroup->servicegroup_name,
'sort' => 'service_severity'
),
'List %s service that is currently in state WARNING (Acknowledged) in service group "%s"',
'List %s services which are currently in state WARNING (Acknowledged) in service group "%s"',
array($serviceGroup->services_warning_handled, $serviceGroup->servicegroup_alias)
)
->add(
StateBadges::STATE_PENDING,
$serviceGroup->services_pending,
array(
'service_state' => 99,
'servicegroup_name' => $serviceGroup->servicegroup_name,
'sort' => 'service_severity'
),
'List %s service that is currenlty in state PENDING in service group "%s"',
'List %s services which are currently in state PENDING in service group "%s"',
array($serviceGroup->services_pending, $serviceGroup->servicegroup_alias)
);
echo $stateBadges->render();
?>
</td> </td>
</tr> </tr>
<?php endforeach ?> <?php endforeach ?>