2013-07-12 08:33:17 -04:00
|
|
|
<?php
|
|
|
|
|
|
2013-08-20 09:32:25 -04:00
|
|
|
namespace Icinga\Module\Monitoring\Object;
|
2013-07-12 08:33:17 -04:00
|
|
|
|
2013-10-15 13:56:33 -04:00
|
|
|
use Icinga\Module\Monitoring\DataView\HostStatus;
|
2014-06-06 02:51:11 -04:00
|
|
|
use Icinga\Data\Db\DbQuery;
|
2013-07-12 08:33:17 -04:00
|
|
|
|
|
|
|
|
class Host extends AbstractObject
|
|
|
|
|
{
|
2014-03-09 15:05:59 -04:00
|
|
|
public $type = 'host';
|
2014-03-09 14:29:23 -04:00
|
|
|
public $prefix = 'host_';
|
2013-07-12 08:33:17 -04:00
|
|
|
|
2014-06-06 02:51:11 -04:00
|
|
|
protected function applyObjectFilter(DbQuery $query)
|
2014-03-04 07:59:26 -05:00
|
|
|
{
|
|
|
|
|
return $query->where('host_name', $this->host_name);
|
|
|
|
|
}
|
2013-07-12 08:33:17 -04:00
|
|
|
|
2013-10-15 13:56:33 -04:00
|
|
|
public function populate()
|
2013-07-12 08:33:17 -04:00
|
|
|
{
|
2013-10-15 13:56:33 -04:00
|
|
|
$this->fetchComments()
|
|
|
|
|
->fetchHostgroups()
|
2013-07-12 08:33:17 -04:00
|
|
|
->fetchContacts()
|
2014-01-30 10:34:23 -05:00
|
|
|
->fetchContactGroups()
|
2014-03-08 12:28:19 -05:00
|
|
|
->fetchCustomvars()
|
|
|
|
|
->fetchDowntimes();
|
2013-07-12 08:33:17 -04:00
|
|
|
}
|
2013-09-04 12:27:16 -04:00
|
|
|
|
2013-10-15 13:56:33 -04:00
|
|
|
protected function getProperties()
|
2013-07-12 08:33:17 -04:00
|
|
|
{
|
2014-06-17 09:10:54 -04:00
|
|
|
$this->view = HostStatus::fromParams(array('backend' => null), array(
|
2014-05-20 18:19:26 -04:00
|
|
|
'host_name',
|
|
|
|
|
'host_alias',
|
|
|
|
|
'host_address',
|
|
|
|
|
'host_state',
|
|
|
|
|
'host_state_type',
|
|
|
|
|
'host_handled',
|
|
|
|
|
'host_in_downtime',
|
|
|
|
|
'host_acknowledged',
|
|
|
|
|
'host_last_state_change',
|
|
|
|
|
'host_last_notification',
|
|
|
|
|
'host_last_check',
|
|
|
|
|
'host_next_check',
|
|
|
|
|
'host_check_execution_time',
|
|
|
|
|
'host_check_latency',
|
|
|
|
|
'host_check_source',
|
|
|
|
|
'host_output',
|
|
|
|
|
'host_long_output',
|
|
|
|
|
'host_check_command',
|
|
|
|
|
'host_perfdata',
|
|
|
|
|
'host_passive_checks_enabled',
|
|
|
|
|
'host_passive_checks_enabled_changed',
|
|
|
|
|
'host_obsessing',
|
|
|
|
|
'host_obsessing_changed',
|
|
|
|
|
'host_notifications_enabled',
|
|
|
|
|
'host_notifications_enabled_changed',
|
|
|
|
|
'host_event_handler_enabled',
|
|
|
|
|
'host_event_handler_enabled_changed',
|
|
|
|
|
'host_flap_detection_enabled',
|
|
|
|
|
'host_flap_detection_enabled_changed',
|
|
|
|
|
'host_active_checks_enabled',
|
|
|
|
|
'host_active_checks_enabled_changed',
|
|
|
|
|
'host_current_check_attempt',
|
|
|
|
|
'host_max_check_attempts',
|
|
|
|
|
'host_current_notification_number',
|
|
|
|
|
'host_percent_state_change',
|
|
|
|
|
'host_is_flapping',
|
|
|
|
|
'host_action_url',
|
|
|
|
|
'host_notes_url',
|
|
|
|
|
'host_modified_host_attributes',
|
|
|
|
|
'host_problem'
|
2014-06-17 09:12:36 -04:00
|
|
|
))->where('host_name', $this->params->get('host'));
|
2013-10-15 13:56:33 -04:00
|
|
|
return $this->view->getQuery()->fetchRow();
|
2013-07-12 08:33:17 -04:00
|
|
|
}
|
|
|
|
|
}
|