2013-07-12 14:33:17 +02:00
|
|
|
<?php
|
|
|
|
|
2013-08-20 15:32:25 +02:00
|
|
|
namespace Icinga\Module\Monitoring\Object;
|
2013-07-12 14:33:17 +02:00
|
|
|
|
|
|
|
use Icinga\Data\AbstractQuery as Query;
|
|
|
|
|
|
|
|
class Host extends AbstractObject
|
|
|
|
{
|
|
|
|
protected $foreign = array(
|
|
|
|
'hostgroups' => null,
|
|
|
|
'contacts' => null,
|
|
|
|
'contactgroups' => null,
|
|
|
|
'customvars' => null,
|
|
|
|
'comments' => null,
|
|
|
|
);
|
|
|
|
|
|
|
|
public function stateName()
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function applyObjectFilter(Query $query)
|
|
|
|
{
|
|
|
|
return $query->where('host_name', $this->name1);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function prefetch()
|
|
|
|
{
|
|
|
|
return $this->fetchHostgroups()
|
|
|
|
->fetchContacts()
|
|
|
|
->fetchContactgroups()
|
|
|
|
->fetchCustomvars()
|
2013-09-27 14:38:42 +02:00
|
|
|
->fetchComments()
|
|
|
|
->fetchEventHistory();
|
2013-07-12 14:33:17 +02:00
|
|
|
}
|
2013-09-04 18:27:16 +02:00
|
|
|
|
2013-07-12 14:33:17 +02:00
|
|
|
protected function fetchObject()
|
|
|
|
{
|
|
|
|
return $this->backend->select()->from('status', array(
|
|
|
|
'host_name',
|
|
|
|
'host_alias',
|
|
|
|
'host_address',
|
|
|
|
'host_state',
|
|
|
|
'host_handled',
|
|
|
|
'host_in_downtime',
|
|
|
|
'host_acknowledged',
|
|
|
|
'host_last_state_change',
|
|
|
|
'last_check' => 'host_last_check',
|
|
|
|
'next_check' => 'host_next_check',
|
|
|
|
'check_execution_time' => 'host_check_execution_time',
|
|
|
|
'check_latency' => 'host_check_latency',
|
|
|
|
'output' => 'host_output',
|
|
|
|
'long_output' => 'host_long_output',
|
|
|
|
'check_command' => 'host_check_command',
|
|
|
|
'perfdata' => 'host_perfdata',
|
2013-10-07 16:46:20 +02:00
|
|
|
'host_icon_image',
|
|
|
|
'passive_checks_enabled' => 'host_passive_checks_enabled',
|
|
|
|
'obsessing' => 'host_obsessing',
|
|
|
|
'notifications_enabled' => 'host_notifications_enabled',
|
|
|
|
'event_handler_enabled' => 'host_event_handler_enabled',
|
|
|
|
'flap_detection_enabled' => 'host_flap_detection_enabled',
|
|
|
|
'active_checks_enabled' => 'host_active_checks_enabled'
|
2013-07-12 14:33:17 +02:00
|
|
|
))->where('host_name', $this->name1)->fetchRow();
|
|
|
|
}
|
|
|
|
}
|