2015-05-19 11:31:17 -04:00
|
|
|
<?php
|
|
|
|
|
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
|
|
|
|
|
|
|
|
|
|
namespace Icinga\Module\Monitoring\DataView;
|
|
|
|
|
|
2015-05-20 09:40:49 -04:00
|
|
|
/**
|
|
|
|
|
* Data view for the host group summary
|
|
|
|
|
*/
|
|
|
|
|
class Hostgroupsummary extends DataView
|
2015-05-19 11:31:17 -04:00
|
|
|
{
|
2015-05-20 09:40:49 -04:00
|
|
|
/**
|
|
|
|
|
* {@inheritdoc}
|
|
|
|
|
*/
|
|
|
|
|
public function getColumns()
|
|
|
|
|
{
|
|
|
|
|
return array(
|
|
|
|
|
'hostgroup_alias',
|
|
|
|
|
'hostgroup_name',
|
|
|
|
|
'hosts_down_handled',
|
2015-06-03 05:49:21 -04:00
|
|
|
'hosts_down_handled_last_state_change',
|
2015-05-20 09:40:49 -04:00
|
|
|
'hosts_down_unhandled',
|
2015-06-03 05:49:21 -04:00
|
|
|
'hosts_down_unhandled_last_state_change',
|
2015-05-20 09:40:49 -04:00
|
|
|
'hosts_pending',
|
|
|
|
|
'hosts_pending_last_state_change',
|
2015-05-20 11:03:23 -04:00
|
|
|
'hosts_total',
|
2015-05-20 09:40:49 -04:00
|
|
|
'hosts_unreachable_handled',
|
2015-06-03 05:49:21 -04:00
|
|
|
'hosts_unreachable_handled_last_state_change',
|
2015-05-20 09:40:49 -04:00
|
|
|
'hosts_unreachable_unhandled',
|
2015-06-03 05:49:21 -04:00
|
|
|
'hosts_unreachable_unhandled_last_state_change',
|
2015-05-20 09:40:49 -04:00
|
|
|
'hosts_up',
|
|
|
|
|
'hosts_up_last_state_change',
|
|
|
|
|
'services_critical_handled',
|
|
|
|
|
'services_critical_unhandled',
|
|
|
|
|
'services_ok',
|
|
|
|
|
'services_pending',
|
|
|
|
|
'services_total',
|
|
|
|
|
'services_unknown_handled',
|
|
|
|
|
'services_unknown_unhandled',
|
|
|
|
|
'services_warning_handled',
|
|
|
|
|
'services_warning_unhandled'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* {@inheritdoc}
|
|
|
|
|
*/
|
2015-05-19 11:31:17 -04:00
|
|
|
public function getFilterColumns()
|
|
|
|
|
{
|
2015-06-03 05:49:21 -04:00
|
|
|
return array(
|
|
|
|
|
'hosts_severity',
|
2015-06-05 03:14:26 -04:00
|
|
|
'host', 'host_alias', 'host_display_name', 'host_name',
|
|
|
|
|
'hostgroup',
|
2015-06-05 09:48:58 -04:00
|
|
|
'service', 'service_description', 'service_display_name',
|
2015-06-05 03:14:26 -04:00
|
|
|
'servicegroup', 'servicegroup_alias', 'servicegroup_name'
|
2015-06-03 05:49:21 -04:00
|
|
|
);
|
2015-05-19 11:31:17 -04:00
|
|
|
}
|
2015-05-19 11:50:07 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* {@inheritdoc}
|
2015-05-20 09:37:24 -04:00
|
|
|
*/
|
2015-05-21 05:24:31 -04:00
|
|
|
public function getSearchColumns()
|
2015-05-20 09:37:24 -04:00
|
|
|
{
|
2015-06-25 06:45:56 -04:00
|
|
|
return array('host', 'host_display_name', 'hostgroup', 'hostgroup_alias');
|
2015-05-20 09:37:24 -04:00
|
|
|
}
|
2015-05-21 06:26:27 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* {@inheritdoc}
|
|
|
|
|
*/
|
|
|
|
|
public function getSortRules()
|
|
|
|
|
{
|
|
|
|
|
return array(
|
|
|
|
|
'hostgroup_alias' => array(
|
|
|
|
|
'order' => self::SORT_ASC
|
|
|
|
|
),
|
|
|
|
|
'hosts_severity' => array(
|
|
|
|
|
'columns' => array(
|
|
|
|
|
'hosts_severity',
|
|
|
|
|
'hostgroup_alias ASC'
|
|
|
|
|
),
|
|
|
|
|
'order' => self::SORT_DESC
|
|
|
|
|
),
|
|
|
|
|
'hosts_total' => array(
|
|
|
|
|
'columns' => array(
|
|
|
|
|
'hosts_total',
|
|
|
|
|
'hostgroup_alias ASC'
|
|
|
|
|
),
|
|
|
|
|
'order' => self::SORT_ASC
|
2015-05-21 06:37:53 -04:00
|
|
|
),
|
|
|
|
|
'services_total' => array(
|
|
|
|
|
'columns' => array(
|
|
|
|
|
'services_total',
|
|
|
|
|
'hostgroup_alias ASC'
|
|
|
|
|
),
|
|
|
|
|
'order' => self::SORT_ASC
|
2015-05-21 06:26:27 -04:00
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
}
|
2015-06-05 03:14:26 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* {@inheritdoc}
|
|
|
|
|
*/
|
|
|
|
|
public function isValidFilterTarget($column)
|
|
|
|
|
{
|
|
|
|
|
if ($column[0] === '_'
|
|
|
|
|
&& preg_match('/^_(?:host|service)_/', $column)
|
|
|
|
|
) {
|
|
|
|
|
return true;
|
|
|
|
|
} else {
|
|
|
|
|
return parent::isValidFilterTarget($column);
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-05-19 11:31:17 -04:00
|
|
|
}
|