2015-06-30 11:19:31 +02:00
|
|
|
<?php
|
|
|
|
|
2015-10-20 22:34:04 +02:00
|
|
|
namespace Icinga\Module\Director\Controllers;
|
|
|
|
|
2016-02-05 16:37:57 +01:00
|
|
|
use Icinga\Module\Director\Util;
|
2015-06-30 11:19:31 +02:00
|
|
|
use Icinga\Module\Director\Web\Controller\ObjectController;
|
|
|
|
|
2015-10-20 22:34:04 +02:00
|
|
|
class HostController extends ObjectController
|
2015-06-30 11:19:31 +02:00
|
|
|
{
|
2015-12-10 13:00:08 +01:00
|
|
|
public function init()
|
|
|
|
{
|
|
|
|
parent::init();
|
|
|
|
if ($this->object) {
|
2016-02-05 16:37:57 +01:00
|
|
|
$tabs = $this->getTabs();
|
|
|
|
$tabs->add('services', array(
|
2015-12-10 13:00:08 +01:00
|
|
|
'url' => 'director/host/services',
|
|
|
|
'urlParams' => array('name' => $this->object->object_name),
|
|
|
|
'label' => 'Services'
|
|
|
|
));
|
2016-02-05 16:37:57 +01:00
|
|
|
if ($this->object->object_type === 'object'
|
|
|
|
&& $this->object->getResolvedProperty('has_agent') === 'y'
|
|
|
|
) {
|
|
|
|
$tabs->add('agent', array(
|
|
|
|
'url' => 'director/host/agent',
|
|
|
|
'urlParams' => array('name' => $this->object->object_name),
|
|
|
|
'label' => 'Agent'
|
|
|
|
));
|
|
|
|
}
|
2015-12-10 13:00:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function servicesAction()
|
|
|
|
{
|
|
|
|
$this->getTabs()->activate('services');
|
|
|
|
$this->view->title = $this->translate('Services');
|
|
|
|
$this->view->table = $this->loadTable('IcingaService')->enforceFilter('host_id', $this->object->id)->setConnection($this->db());
|
|
|
|
$this->render('objects/table', null, true);
|
|
|
|
}
|
2016-02-05 16:37:57 +01:00
|
|
|
|
|
|
|
public function agentAction()
|
|
|
|
{
|
|
|
|
$this->getTabs()->activate('agent');
|
|
|
|
$this->view->title = 'Agent deployment instructions';
|
|
|
|
// TODO: Fail when no ticket
|
|
|
|
$this->view->certname = $this->object->object_name;
|
|
|
|
$this->view->ticket = Util::getIcingaTicket($this->view->certname, $this->api()->getTicketSalt());
|
2016-02-10 17:38:39 +01:00
|
|
|
$this->view->master = $this->db()->getDeploymentEndpointName();
|
|
|
|
$this->view->masterzone = $this->db()->getMasterZoneName();
|
|
|
|
$this->view->globalzone = $this->db()->getDefaultGlobalZoneName();
|
2016-02-05 16:37:57 +01:00
|
|
|
}
|
2015-06-30 11:19:31 +02:00
|
|
|
}
|