monitoring: Use state badge widget for service states in the host group overview

refs #5543
This commit is contained in:
Eric Lippmann 2015-09-27 14:18:41 +02:00
parent d59b09ca48
commit a3d3ba229d

View File

@ -146,216 +146,121 @@ if (! $this->compact): ?>
) ?> ) ?>
</td> </td>
<td> <td>
<?php if ($hostgroup->services_ok): ?> <?php
<span class="state ok"> $stateBadges = new StateBadges();
<?= $this->qlink( $stateBadges
$hostgroup->services_ok, ->setUrl('monitoring/list/services')
'monitoring/list/services', ->add(
array( StateBadges::STATE_OK,
'service_state' => 0, array(
'hostgroup_name' => $hostgroup->hostgroup_name, 'service_state' => 0,
'sort' => 'service_severity' 'hostgroup_name' => $hostgroup->hostgroup_name,
), 'sort' => 'service_severity'
array( ),
'title' => sprintf( $hostgroup->services_ok,
$this->translatePlural(
'List %u service that is currently in state OK on hosts in the host group "%s"', '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"', 'List %u services which are currently in state OK on hosts in the host group "%s"',
$hostgroup->services_ok array($hostgroup->services_ok, $hostgroup->hostgroup_alias)
),
$hostgroup->services_ok,
$hostgroup->hostgroup_alias
) )
) ->add(
) ?> StateBadges::STATE_CRITICAL,
</span> array(
<?php endif ?> 'service_state' => 2,
<?php if ($hostgroup->services_critical_unhandled): ?> 'service_acknowledged' => 0,
<span class="state critical"> 'service_in_downtime' => 0,
<?= $this->qlink( 'host_problem' => 0,
$hostgroup->services_critical_unhandled, 'hostgroup_name' => $hostgroup->hostgroup_name,
'monitoring/list/services', 'sort' => 'service_severity'
array( ),
'service_state' => 2, $hostgroup->services_critical_unhandled,
'service_acknowledged' => 0,
'service_in_downtime' => 0,
'host_problem' => 0,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'service_severity'
),
array(
'title' => sprintf(
$this->translatePlural(
'List %u service that is currently in state CRITICAL on hosts in the host group "%s"', '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"', 'List %u services which are currently in state CRITICAL on hosts in the host group "%s"',
$hostgroup->services_critical_unhandled array($hostgroup->services_critical_unhandled, $hostgroup->hostgroup_alias)
),
$hostgroup->services_critical_unhandled,
$hostgroup->hostgroup_alias
) )
) ->add(
) ?> StateBadges::STATE_CRITICAL_HANDLED,
<?php endif ?> array(
<?php if ($hostgroup->services_critical_handled): ?> 'service_state' => 2,
<span class="state critical handled"> 'service_handled' => 1,
<?= $this->qlink( 'hostgroup_name' => $hostgroup->hostgroup_name,
$hostgroup->services_critical_handled, 'sort' => 'service_severity'
'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
), ),
$hostgroup->services_critical_handled, $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)
) )
) ?> ->add(
</span> StateBadges::STATE_UNKNOWN,
<?php endif ?> array(
<?php if ($hostgroup->services_critical_unhandled): ?> 'service_state' => 3,
</span> 'service_acknowledged' => 0,
<?php endif ?> 'service_in_downtime' => 0,
<?php if ($hostgroup->services_unknown_unhandled): ?> 'host_problem' => 0,
<span class="state unknown"> 'hostgroup_name' => $hostgroup->hostgroup_name,
<?= $this->qlink( 'sort' => 'service_severity'
$hostgroup->services_unknown_unhandled, ),
'monitoring/list/services', $hostgroup->services_unknown_unhandled,
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(
'List %u service that is currently in state UNKNOWN on hosts in the host group "%s"', '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"', 'List %u services which are currently in state UNKNOWN on hosts in the host group "%s"',
$hostgroup->services_unknown_unhandled array($hostgroup->services_unknown_unhandled, $hostgroup->hostgroup_alias)
),
$hostgroup->services_unknown_unhandled,
$hostgroup->hostgroup_alias
) )
) ->add(
) ?> StateBadges::STATE_UNKNOWN_HANDLED,
<?php endif ?> array(
<?php if ($hostgroup->services_unknown_handled): ?> 'service_state' => 3,
<span class="state unknown handled"> 'service_handled' => 1,
<?= $this->qlink( 'hostgroup_name' => $hostgroup->hostgroup_name,
$hostgroup->services_unknown_handled, 'sort' => 'service_severity'
'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
), ),
$hostgroup->services_unknown_handled, $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)
) )
) ?> ->add(
</span> StateBadges::STATE_WARNING,
<?php endif ?> array(
<?php if ($hostgroup->services_unknown_unhandled): ?> 'service_state' => 1,
</span> 'service_acknowledged' => 0,
<?php endif ?> 'service_in_downtime' => 0,
<?php if ($hostgroup->services_warning_unhandled): ?> 'host_problem' => 0,
<span class="state warning"> 'hostgroup_name' => $hostgroup->hostgroup_name,
<?= $this->qlink( 'sort' => 'service_severity'
$hostgroup->services_warning_unhandled, ),
'monitoring/list/services', $hostgroup->services_warning_unhandled,
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(
'List %u service that is currently in state WARNING on hosts in the host group "%s"', '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"', 'List %u services which are currently in state WARNING on hosts in the host group "%s"',
$hostgroup->services_warning_unhandled array($hostgroup->services_warning_unhandled, $hostgroup->hostgroup_alias)
),
$hostgroup->services_warning_unhandled,
$hostgroup->hostgroup_alias
) )
) ->add(
) ?> StateBadges::STATE_WARNING_HANDLED,
<?php endif ?> array(
<?php if ($hostgroup->services_warning_handled): ?> 'service_state' => 1,
<span class="state warning handled"> 'service_handled' => 1,
<?= $this->qlink( 'hostgroup_name' => $hostgroup->hostgroup_name,
$hostgroup->services_warning_handled, 'sort' => 'service_severity'
'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
), ),
$hostgroup->services_warning_handled, $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)
) )
) ?> ->add(
</span> StateBadges::STATE_PENDING,
<?php endif ?> array(
<?php if ($hostgroup->services_warning_unhandled): ?> 'service_state' => 99,
</span> 'hostgroup_name' => $hostgroup->hostgroup_name,
<?php endif ?> 'sort' => 'service_severity'
<?php if ($hostgroup->services_pending): ?> ),
<span class="state pending"> $hostgroup->services_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(
'List %u service that is currently in state PENDING on hosts in the host group "%s"', '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"', 'List %u services which are currently in state PENDING on hosts in the host group "%s"',
$hostgroup->services_pending array($hostgroup->services_pending, $hostgroup->hostgroup_alias)
), );
$hostgroup->services_pending, echo $stateBadges->render();
$hostgroup->hostgroup_alias ?>
)
)
) ?>
</span>
<?php endif ?>
</td> </td>
</tr> </tr>
<?php endforeach ?> <?php endforeach ?>