2015-06-03 14:34:54 +02:00
|
|
|
<?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,
|
2015-12-10 12:12:58 +01:00
|
|
|
'host_id' => null,
|
2015-06-03 14:34:54 +02:00
|
|
|
'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-12-18 11:07:23 +01:00
|
|
|
'use_agent' => null,
|
2015-06-03 14:34:54 +02:00
|
|
|
);
|
2015-06-08 14:41:40 +02:00
|
|
|
|
2015-12-10 12:12:58 +01:00
|
|
|
protected $relations = array(
|
|
|
|
'host' => 'IcingaHost',
|
|
|
|
'check_command' => 'IcingaCommand',
|
|
|
|
'event_command' => 'IcingaCommand',
|
|
|
|
'check_period' => 'IcingaTimePeriod',
|
|
|
|
'command_endpoint' => 'IcingaEndpoint',
|
|
|
|
'zone' => 'IcingaZone',
|
|
|
|
);
|
|
|
|
|
2015-12-18 11:52:00 +01:00
|
|
|
protected $booleans = array(
|
|
|
|
'enable_notifications',
|
|
|
|
'enable_active_checks',
|
|
|
|
'enable_passive_checks',
|
|
|
|
'enable_event_handler',
|
|
|
|
'enable_flapping',
|
|
|
|
'enable_perfdata',
|
|
|
|
'volatile',
|
|
|
|
'use_agent',
|
|
|
|
);
|
|
|
|
|
2015-06-16 17:51:01 +02:00
|
|
|
protected $supportsGroups = true;
|
|
|
|
|
2015-06-24 10:13:27 +02:00
|
|
|
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;
|
|
|
|
|
2015-12-10 12:12:58 +01:00
|
|
|
protected $keyName = array('host_id', 'object_name');
|
|
|
|
|
2015-11-15 16:39:20 +01:00
|
|
|
public function getCheckCommand()
|
|
|
|
{
|
|
|
|
$id = $this->getResolvedProperty('check_command_id');
|
|
|
|
return IcingaCommand::loadWithAutoIncId(
|
|
|
|
$id,
|
|
|
|
$this->getConnection()
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2015-12-10 12:12:58 +01:00
|
|
|
public function renderHost_id()
|
|
|
|
{
|
|
|
|
return $this->renderRelationProperty('host', $this->host_id, 'host_name');
|
|
|
|
}
|
|
|
|
|
2015-12-18 11:07:23 +01:00
|
|
|
public function renderUse_agent()
|
|
|
|
{
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
2015-12-10 12:57:45 +01:00
|
|
|
protected function renderCheck_Interval()
|
|
|
|
{
|
|
|
|
return $this->renderPropertyAsSeconds('check_interval');
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function renderRetry_Interval()
|
|
|
|
{
|
|
|
|
return $this->renderPropertyAsSeconds('retry_interval');
|
|
|
|
}
|
|
|
|
|
2015-11-15 16:39:20 +01:00
|
|
|
public function hasCheckCommand()
|
|
|
|
{
|
|
|
|
return $this->getResolvedProperty('check_command_id') !== null;
|
|
|
|
}
|
2015-06-03 14:34:54 +02:00
|
|
|
}
|