2015-04-24 14:26:44 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Icinga\Module\Director\Objects;
|
|
|
|
|
2015-07-28 17:35:54 +02:00
|
|
|
use Icinga\Module\Director\Web\Form\DirectorObjectForm;
|
|
|
|
|
2015-04-24 15:57:01 +02:00
|
|
|
class IcingaHost extends IcingaObject
|
2015-04-24 14:26:44 +02:00
|
|
|
{
|
|
|
|
protected $table = 'icinga_host';
|
|
|
|
|
|
|
|
protected $defaultProperties = array(
|
|
|
|
'id' => null,
|
|
|
|
'object_name' => null,
|
|
|
|
'address' => null,
|
|
|
|
'address6' => null,
|
|
|
|
'check_command_id' => null,
|
|
|
|
'max_check_attempts' => null,
|
|
|
|
'check_period_id' => null,
|
|
|
|
'check_interval' => null,
|
|
|
|
'retry_interval' => null,
|
|
|
|
'enable_notifications' => null,
|
|
|
|
'enable_active_checks' => null,
|
|
|
|
'enable_passive_checks' => null,
|
|
|
|
'enable_event_handler' => null,
|
|
|
|
'enable_flapping' => null,
|
|
|
|
'enable_perfdata' => null,
|
|
|
|
'event_command_id' => null,
|
|
|
|
'flapping_threshold' => null,
|
|
|
|
'volatile' => null,
|
|
|
|
'zone_id' => null,
|
|
|
|
'command_endpoint_id' => null,
|
|
|
|
'notes' => null,
|
|
|
|
'notes_url' => null,
|
|
|
|
'action_url' => null,
|
|
|
|
'icon_image' => null,
|
|
|
|
'icon_image_alt' => null,
|
|
|
|
'object_type' => null,
|
|
|
|
);
|
2015-06-08 14:41:40 +02:00
|
|
|
|
2015-06-08 14:42:12 +02:00
|
|
|
protected $supportsCustomVars = true;
|
|
|
|
|
2015-06-16 17:51:01 +02:00
|
|
|
protected $supportsGroups = true;
|
|
|
|
|
2015-06-26 10:39:30 +02:00
|
|
|
protected $supportsImports = true;
|
|
|
|
|
2015-06-08 14:41:40 +02:00
|
|
|
protected function renderCheck_command_id()
|
|
|
|
{
|
|
|
|
return $this->renderCommandProperty($this->check_command_id);
|
|
|
|
}
|
2015-06-08 14:42:28 +02:00
|
|
|
|
2015-06-12 10:47:05 +02:00
|
|
|
protected function renderEnable_notifications()
|
|
|
|
{
|
|
|
|
return $this->renderBooleanProperty('enable_notifications');
|
|
|
|
}
|
|
|
|
|
2015-06-08 14:42:28 +02:00
|
|
|
protected function renderEnable_active_checks()
|
|
|
|
{
|
|
|
|
return $this->renderBooleanProperty('enable_active_checks');
|
|
|
|
}
|
2015-06-12 10:47:05 +02:00
|
|
|
|
|
|
|
protected function renderEnable_passive_checks()
|
|
|
|
{
|
|
|
|
return $this->renderBooleanProperty('enable_passive_checks');
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function renderEnable_event_handler()
|
|
|
|
{
|
|
|
|
return $this->renderBooleanProperty('enable_event_handler');
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function renderEnable_flapping()
|
|
|
|
{
|
|
|
|
return $this->renderBooleanProperty('enable_passive_checks');
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function renderEnable_perfdata()
|
|
|
|
{
|
|
|
|
return $this->renderBooleanProperty('enable_perfdata');
|
|
|
|
}
|
|
|
|
|
2015-06-15 09:57:48 +02:00
|
|
|
protected function renderVolatile()
|
2015-06-12 10:47:05 +02:00
|
|
|
{
|
|
|
|
return $this->renderBooleanProperty('volatile');
|
|
|
|
}
|
2015-07-28 17:35:54 +02:00
|
|
|
|
|
|
|
public function getFields(DirectorObjectForm $form)
|
|
|
|
{
|
|
|
|
$db = $this->getDb();
|
|
|
|
|
|
|
|
$query = $db->select()
|
|
|
|
->from(
|
|
|
|
array('df' => 'director_datafield')
|
|
|
|
)
|
|
|
|
->join(
|
|
|
|
array('hf' => 'icinga_host_field'),
|
|
|
|
'df.id = hf.datafield_id'
|
|
|
|
)
|
|
|
|
->where('hf.host_id = ?', (int) $this->id)
|
|
|
|
->order('df.caption ASC');
|
|
|
|
|
|
|
|
return $db->fetchAll($query);
|
|
|
|
}
|
2015-04-24 14:26:44 +02:00
|
|
|
}
|