monitoring/lib: Change StateBadges::add() signature

refs #5543
This commit is contained in:
Eric Lippmann 2015-09-27 15:43:17 +02:00
parent 63e0549618
commit 705432b5fb
2 changed files with 18 additions and 18 deletions

View File

@ -1,6 +1,6 @@
<?php
use Icinga\Module\Monitoring\Web\Widget\StateBadges;
/** @var \Icinga\Module\Monitoring\DataView\Hostgroup $hostgroups */
if (! $this->compact): ?>
<div class="controls">
<?= $this->tabs ?>
@ -58,18 +58,19 @@ if (! $this->compact): ?>
->setUrl('monitoring/list/hosts')
->add(
StateBadges::STATE_UP,
$hostgroup->hosts_up,
array(
'host_state' => 0,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'host_severity'
),
$hostgroup->hosts_up,
'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"',
array($hostgroup->hosts_up, $hostgroup->hostgroup_alias)
)
->add(
StateBadges::STATE_DOWN,
$hostgroup->hosts_down_unhandled,
array(
'host_state' => 1,
'host_acknowledged' => 0,
@ -77,26 +78,26 @@ if (! $this->compact): ?>
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'host_severity'
),
$hostgroup->hosts_down_unhandled,
'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"',
array($hostgroup->hosts_down_unhandled, $hostgroup->hostgroup_alias)
)
->add(
StateBadges::STATE_DOWN_HANDLED,
$hostgroup->hosts_down_handled,
array(
'host_state' => 1,
'host_handled' => 1,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'host_severity'
),
$hostgroup->hosts_down_handled,
'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"',
array($hostgroup->hosts_down_handled, $hostgroup->hostgroup_alias)
)
->add(
StateBadges::STATE_UNREACHABLE,
$hostgroup->hosts_unreachable_unhandled,
array(
'host_state' => 2,
'host_acknowledged' => 0,
@ -104,32 +105,31 @@ if (! $this->compact): ?>
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'host_severity'
),
$hostgroup->hosts_unreachable_unhandled,
'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"',
array($hostgroup->hosts_unreachable_unhandled, $hostgroup->hostgroup_alias)
)
->add(
StateBadges::STATE_UNREACHABLE_HANDLED,
$hostgroup->hosts_unreachable_handled,
array(
'host_state' => 2,
'host_handled' => 1,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'host_severity'
),
$hostgroup->hosts_unreachable_handled,
'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"',
array($hostgroup->hosts_unreachable_handled, $hostgroup->hostgroup_alias)
)
->add(
StateBadges::STATE_PENDING,
$hostgroup->hosts_pending,
array(
'host_state' => 99,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'host_severity'
),
$hostgroup->hosts_pending,
'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"',
array($hostgroup->hosts_pending, $hostgroup->hostgroup_alias)
@ -155,18 +155,19 @@ if (! $this->compact): ?>
->setUrl('monitoring/list/services')
->add(
StateBadges::STATE_OK,
$hostgroup->services_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"',
array($hostgroup->services_ok, $hostgroup->hostgroup_alias)
)
->add(
StateBadges::STATE_CRITICAL,
$hostgroup->services_critical_unhandled,
array(
'service_state' => 2,
'service_acknowledged' => 0,
@ -175,26 +176,26 @@ if (! $this->compact): ?>
'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"',
array($hostgroup->services_critical_unhandled, $hostgroup->hostgroup_alias)
)
->add(
StateBadges::STATE_CRITICAL_HANDLED,
$hostgroup->services_critical_handled,
array(
'service_state' => 2,
'service_handled' => 1,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'service_severity'
),
$hostgroup->services_critical_handled,
'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(
StateBadges::STATE_UNKNOWN,
$hostgroup->services_unknown_unhandled,
array(
'service_state' => 3,
'service_acknowledged' => 0,
@ -203,20 +204,19 @@ if (! $this->compact): ?>
'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"',
array($hostgroup->services_unknown_unhandled, $hostgroup->hostgroup_alias)
)
->add(
StateBadges::STATE_UNKNOWN_HANDLED,
$hostgroup->services_unknown_handled,
array(
'service_state' => 3,
'service_handled' => 1,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'service_severity'
),
$hostgroup->services_unknown_handled,
'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)
@ -224,6 +224,7 @@ if (! $this->compact): ?>
)
->add(
StateBadges::STATE_WARNING,
$hostgroup->services_warning_unhandled,
array(
'service_state' => 1,
'service_acknowledged' => 0,
@ -232,32 +233,31 @@ if (! $this->compact): ?>
'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"',
array($hostgroup->services_warning_unhandled, $hostgroup->hostgroup_alias)
)
->add(
StateBadges::STATE_WARNING_HANDLED,
$hostgroup->services_warning_handled,
array(
'service_state' => 1,
'service_handled' => 1,
'hostgroup_name' => $hostgroup->hostgroup_name,
'sort' => 'service_severity'
),
$hostgroup->services_warning_handled,
'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(
StateBadges::STATE_PENDING,
$hostgroup->services_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"',
array($hostgroup->services_pending, $hostgroup->hostgroup_alias)

View File

@ -160,8 +160,8 @@ class StateBadges extends AbstractWidget
* Add a state badge
*
* @param string $state
* @param array $filter
* @param int $count
* @param array $filter
* @param string $translateSingular
* @param string $translatePlural
* @param array $translateArgs
@ -169,7 +169,7 @@ class StateBadges extends AbstractWidget
* @return $this
*/
public function add(
$state, array $filter, $count, $translateSingular, $translatePlural, array $translateArgs = array()
$state, $count, array $filter, $translateSingular, $translatePlural, array $translateArgs = array()
) {
$this->badges[$state] = (object) array(
'count' => (int) $count,
@ -218,7 +218,7 @@ class StateBadges extends AbstractWidget
$groupItem = new NavigationItem(
uniqid(),
array(
'name' => '',
'label' => '',
'priority' => $this->priority++
)
);