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
|
|
|
|
2013-10-15 19:56:33 +02:00
|
|
|
use Icinga\Module\Monitoring\DataView\HostStatus;
|
2014-03-04 13:59:26 +01:00
|
|
|
use Icinga\Data\Db\Query;
|
2013-07-12 14:33:17 +02:00
|
|
|
|
|
|
|
class Host extends AbstractObject
|
|
|
|
{
|
2014-03-09 20:05:59 +01:00
|
|
|
public $type = 'host';
|
2014-03-09 19:29:23 +01:00
|
|
|
public $prefix = 'host_';
|
|
|
|
private $view = null;
|
2013-07-12 14:33:17 +02:00
|
|
|
|
2014-03-04 13:59:26 +01:00
|
|
|
protected function applyObjectFilter(Query $query)
|
|
|
|
{
|
|
|
|
return $query->where('host_name', $this->host_name);
|
|
|
|
}
|
2013-07-12 14:33:17 +02:00
|
|
|
|
2013-10-15 19:56:33 +02:00
|
|
|
public function populate()
|
2013-07-12 14:33:17 +02:00
|
|
|
{
|
2013-10-15 19:56:33 +02:00
|
|
|
$this->fetchComments()
|
|
|
|
->fetchHostgroups()
|
2013-07-12 14:33:17 +02:00
|
|
|
->fetchContacts()
|
2014-01-30 16:34:23 +01:00
|
|
|
->fetchContactGroups()
|
2014-03-08 18:28:19 +01:00
|
|
|
->fetchCustomvars()
|
|
|
|
->fetchDowntimes();
|
2013-07-12 14:33:17 +02:00
|
|
|
}
|
2013-09-04 18:27:16 +02:00
|
|
|
|
2013-10-15 19:56:33 +02:00
|
|
|
protected function getProperties()
|
2013-07-12 14:33:17 +02:00
|
|
|
{
|
2013-10-15 19:56:33 +02:00
|
|
|
$this->view = HostStatus::fromRequest($this->getRequest());
|
|
|
|
return $this->view->getQuery()->fetchRow();
|
2013-07-12 14:33:17 +02:00
|
|
|
}
|
|
|
|
}
|