2013-09-24 15:26:10 +02:00
|
|
|
<?php
|
2015-02-04 10:46:36 +01:00
|
|
|
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
|
2013-09-24 15:26:10 +02:00
|
|
|
|
|
|
|
namespace Icinga\Module\Monitoring\DataView;
|
|
|
|
|
2013-10-14 13:25:25 +02:00
|
|
|
class HostStatus extends DataView
|
2013-09-24 15:26:10 +02:00
|
|
|
{
|
2014-10-08 12:30:08 +02:00
|
|
|
/**
|
2015-05-26 13:42:42 +02:00
|
|
|
* {@inheritdoc}
|
2013-09-24 15:26:10 +02:00
|
|
|
*/
|
|
|
|
public function getColumns()
|
|
|
|
{
|
2015-11-13 15:09:54 +01:00
|
|
|
return array_merge($this->getHookedColumns(), array(
|
2015-08-25 16:35:35 +02:00
|
|
|
'instance_name',
|
2013-09-24 15:26:10 +02:00
|
|
|
'host_name',
|
2015-01-20 16:21:56 +01:00
|
|
|
'host_display_name',
|
2013-10-15 19:56:33 +02:00
|
|
|
'host_alias',
|
|
|
|
'host_address',
|
2015-07-16 10:35:28 +02:00
|
|
|
'host_address6',
|
2013-09-24 15:26:10 +02:00
|
|
|
'host_state',
|
2015-11-11 17:13:41 +01:00
|
|
|
'host_hard_state',
|
2013-09-24 15:26:10 +02:00
|
|
|
'host_state_type',
|
|
|
|
'host_handled',
|
2013-10-22 14:27:19 +02:00
|
|
|
'host_unhandled',
|
2013-09-24 15:26:10 +02:00
|
|
|
'host_in_downtime',
|
2013-10-15 19:56:33 +02:00
|
|
|
'host_acknowledged',
|
|
|
|
'host_last_state_change',
|
|
|
|
'host_last_state_change',
|
|
|
|
'host_last_notification',
|
2013-09-24 15:26:10 +02:00
|
|
|
'host_last_check',
|
2013-10-14 13:25:25 +02:00
|
|
|
'host_next_check',
|
2013-10-15 19:56:33 +02:00
|
|
|
'host_check_execution_time',
|
|
|
|
'host_check_latency',
|
|
|
|
'host_output',
|
|
|
|
'host_long_output',
|
|
|
|
'host_check_command',
|
2015-09-14 12:05:15 +02:00
|
|
|
'host_check_timeperiod',
|
2013-10-15 19:56:33 +02:00
|
|
|
'host_perfdata',
|
2014-06-25 21:38:55 +02:00
|
|
|
'host_check_source',
|
2013-10-15 19:56:33 +02:00
|
|
|
'host_passive_checks_enabled',
|
2013-10-20 13:15:11 +02:00
|
|
|
'host_passive_checks_enabled_changed',
|
2013-10-15 19:56:33 +02:00
|
|
|
'host_obsessing',
|
2013-10-20 13:15:11 +02:00
|
|
|
'host_obsessing_changed',
|
2013-09-24 15:26:10 +02:00
|
|
|
'host_notifications_enabled',
|
2013-10-20 13:15:11 +02:00
|
|
|
'host_notifications_enabled_changed',
|
2013-10-15 19:56:33 +02:00
|
|
|
'host_event_handler_enabled',
|
2013-10-20 13:15:11 +02:00
|
|
|
'host_event_handler_enabled_changed',
|
2013-10-15 19:56:33 +02:00
|
|
|
'host_flap_detection_enabled',
|
2013-10-20 13:15:11 +02:00
|
|
|
'host_flap_detection_enabled_changed',
|
2013-10-15 19:56:33 +02:00
|
|
|
'host_active_checks_enabled',
|
2013-10-20 13:15:11 +02:00
|
|
|
'host_active_checks_enabled_changed',
|
2013-10-15 19:56:33 +02:00
|
|
|
'host_current_check_attempt',
|
|
|
|
'host_max_check_attempts',
|
|
|
|
'host_last_notification',
|
|
|
|
'host_current_notification_number',
|
|
|
|
'host_percent_state_change',
|
|
|
|
'host_is_flapping',
|
2013-09-24 15:26:10 +02:00
|
|
|
'host_action_url',
|
|
|
|
'host_notes_url',
|
2013-10-20 13:15:11 +02:00
|
|
|
'host_percent_state_change',
|
2013-10-20 16:08:01 +02:00
|
|
|
'host_modified_host_attributes',
|
2013-10-23 15:55:53 +02:00
|
|
|
'host_severity',
|
2014-10-06 11:37:33 +02:00
|
|
|
'host_problem',
|
2015-09-04 16:35:41 +02:00
|
|
|
'host_ipv4',
|
2015-09-14 12:05:15 +02:00
|
|
|
'host_acknowledgement_type'
|
2015-11-13 15:09:54 +01:00
|
|
|
));
|
2013-09-24 15:26:10 +02:00
|
|
|
}
|
|
|
|
|
2015-05-26 13:48:48 +02:00
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
2015-08-17 13:46:16 +02:00
|
|
|
public function getStaticFilterColumns()
|
2015-05-26 13:48:48 +02:00
|
|
|
{
|
2015-06-03 14:39:10 +02:00
|
|
|
return array(
|
|
|
|
'host',
|
|
|
|
'hostgroup', 'hostgroup_alias', 'hostgroup_name',
|
|
|
|
'service', 'service_description', 'service_display_name',
|
|
|
|
'servicegroup', 'servicegroup_alias', 'servicegroup_name'
|
|
|
|
);
|
2015-05-26 13:48:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
2015-10-01 18:48:36 +02:00
|
|
|
public function getSearchColumns($search = null)
|
2015-05-26 13:48:48 +02:00
|
|
|
{
|
2015-10-01 18:48:36 +02:00
|
|
|
if ($search !== null
|
|
|
|
&& (@inet_pton($search) !== false || preg_match('/^\d{1,3}\.\d{1,3}\./', $search))
|
|
|
|
) {
|
|
|
|
return array('host', 'host_address', 'host_address6');
|
|
|
|
} else {
|
|
|
|
return array('host', 'host_display_name');
|
|
|
|
}
|
2015-05-26 13:48:48 +02:00
|
|
|
}
|
|
|
|
|
2013-10-15 19:56:33 +02:00
|
|
|
/**
|
2015-08-17 13:46:16 +02:00
|
|
|
* {@inheritdoc}
|
2013-10-15 19:56:33 +02:00
|
|
|
*/
|
2013-09-24 15:26:10 +02:00
|
|
|
public function getSortRules()
|
|
|
|
{
|
|
|
|
return array(
|
2015-03-13 17:19:56 +01:00
|
|
|
'host_display_name' => array(
|
|
|
|
'order' => self::SORT_ASC
|
|
|
|
),
|
2015-03-13 17:01:52 +01:00
|
|
|
'host_severity' => array(
|
|
|
|
'columns' => array(
|
2015-05-21 12:17:25 +02:00
|
|
|
'host_severity',
|
2015-05-15 10:54:30 +02:00
|
|
|
'host_last_state_change DESC',
|
2015-03-13 17:14:14 +01:00
|
|
|
'host_display_name ASC'
|
2015-05-21 12:17:25 +02:00
|
|
|
),
|
|
|
|
'order' => self::SORT_DESC
|
2015-03-13 17:01:52 +01:00
|
|
|
),
|
2013-09-24 15:26:10 +02:00
|
|
|
'host_address' => array(
|
|
|
|
'columns' => array(
|
2013-10-19 20:09:17 +02:00
|
|
|
'host_ipv4'
|
2013-09-24 15:26:10 +02:00
|
|
|
),
|
|
|
|
'order' => self::SORT_ASC
|
|
|
|
),
|
|
|
|
'host_last_state_change' => array(
|
2015-12-18 15:48:55 +01:00
|
|
|
'order' => self::SORT_DESC
|
2013-09-24 15:26:10 +02:00
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|