icingaweb2-module-director/library/Director/Objects/IcingaService.php

116 lines
3.2 KiB
PHP
Raw Normal View History

<?php
namespace Icinga\Module\Director\Objects;
class IcingaService extends IcingaObject
{
protected $table = 'icinga_service';
protected $defaultProperties = array(
'id' => null,
'object_name' => null,
'display_name' => null,
'host_id' => 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,
);
protected $relations = array(
'host' => 'IcingaHost',
'check_command' => 'IcingaCommand',
'event_command' => 'IcingaCommand',
'check_period' => 'IcingaTimePeriod',
'command_endpoint' => 'IcingaEndpoint',
'zone' => 'IcingaZone',
);
protected $supportsGroups = true;
protected $supportsCustomVars = true;
2015-07-31 17:34:12 +02:00
protected $supportsFields = true;
2015-06-26 16:20:16 +02:00
protected $supportsImports = true;
protected $keyName = array('host_id', 'object_name');
public function getCheckCommand()
{
$id = $this->getResolvedProperty('check_command_id');
return IcingaCommand::loadWithAutoIncId(
$id,
$this->getConnection()
);
}
public function renderHost_id()
{
return $this->renderRelationProperty('host', $this->host_id, 'host_name');
}
public function hasCheckCommand()
{
return $this->getResolvedProperty('check_command_id') !== null;
}
protected function renderCheck_command_id()
{
return $this->renderCommandProperty($this->check_command_id);
}
protected function renderEnable_notifications()
{
return $this->renderBooleanProperty('enable_notifications');
}
protected function renderEnable_active_checks()
{
return $this->renderBooleanProperty('enable_active_checks');
}
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_flapping');
}
protected function renderEnable_perfdata()
{
return $this->renderBooleanProperty('enable_perfdata');
}
protected function renderVolatile()
{
return $this->renderBooleanProperty('volatile');
}
}