mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-28 08:14:04 +02:00
IcingaConfig: respect inheritance for auto-agents
This commit is contained in:
parent
c03aaada92
commit
6e6c2ee6e5
@ -356,22 +356,23 @@ throw $e;
|
||||
$zones = array();
|
||||
$endpoints = array();
|
||||
foreach (IcingaHost::prefetchAll($this->connection) as $host) {
|
||||
if ($host->object_type !== 'object') continue;
|
||||
if ($host->getResolvedProperty('has_agent') !== 'y') continue;
|
||||
$name = $host->object_name;
|
||||
if ($host->has_agent === 'y') {
|
||||
$props = array(
|
||||
'object_name' => $name,
|
||||
'object_type' => 'object',
|
||||
);
|
||||
if ($host->master_should_connect === 'y') {
|
||||
$props['host'] = $host->address;
|
||||
$props['zone_id'] = $host->zone_id;
|
||||
}
|
||||
|
||||
$endpoints[] = IcingaEndpoint::create($props);
|
||||
$zones[] = IcingaZone::create(array(
|
||||
'object_name' => $name
|
||||
))->setEndpointList(array($name));
|
||||
$props = array(
|
||||
'object_name' => $name,
|
||||
'object_type' => 'object',
|
||||
);
|
||||
if ($host->getResolvedProperty('master_should_connect') === 'y') {
|
||||
$props['host'] = $host->getResolvedProperty('address');
|
||||
$props['zone_id'] = $host->getResolvedProperty('zone_id');
|
||||
}
|
||||
|
||||
$endpoints[] = IcingaEndpoint::create($props);
|
||||
$zones[] = IcingaZone::create(array(
|
||||
'object_name' => $name
|
||||
))->setEndpointList(array($name));
|
||||
}
|
||||
|
||||
$this->createFileForObjects('endpoint', $endpoints);
|
||||
|
Loading…
x
Reference in New Issue
Block a user