2015-06-30 11:19:31 +02:00
|
|
|
<?php
|
|
|
|
|
2015-10-20 22:34:04 +02:00
|
|
|
namespace Icinga\Module\Director\Controllers;
|
|
|
|
|
2016-05-03 08:27:12 +02:00
|
|
|
use Exception;
|
2017-08-16 23:27:13 +02:00
|
|
|
use Icinga\Module\Director\CustomVariable\CustomVariableDictionary;
|
2017-02-16 17:34:06 +01:00
|
|
|
use Icinga\Module\Director\Db\AppliedServiceSetLoader;
|
2017-08-21 19:55:24 +02:00
|
|
|
use Icinga\Module\Director\Forms\IcingaAddServiceForm;
|
2017-07-24 10:52:36 +02:00
|
|
|
use Icinga\Module\Director\Forms\IcingaServiceForm;
|
2017-08-21 21:02:41 +02:00
|
|
|
use Icinga\Module\Director\Forms\IcingaServiceSetForm;
|
2016-09-08 13:25:48 +02:00
|
|
|
use Icinga\Module\Director\Objects\IcingaHost;
|
2016-08-23 16:18:54 +02:00
|
|
|
use Icinga\Module\Director\Objects\IcingaService;
|
2017-01-02 10:51:54 +01:00
|
|
|
use Icinga\Module\Director\Objects\IcingaServiceSet;
|
2017-06-22 00:13:09 +02:00
|
|
|
use Icinga\Module\Director\Restriction\HostgroupRestriction;
|
2017-08-14 12:22:28 +02:00
|
|
|
use Icinga\Module\Director\Repository\IcingaTemplateRepository;
|
2015-06-30 11:19:31 +02:00
|
|
|
use Icinga\Module\Director\Web\Controller\ObjectController;
|
2017-08-14 12:22:28 +02:00
|
|
|
use Icinga\Module\Director\Web\SelfService;
|
2017-08-16 23:27:13 +02:00
|
|
|
use Icinga\Module\Director\Web\Table\IcingaHostAppliedForServiceTable;
|
|
|
|
use Icinga\Module\Director\Web\Table\IcingaHostAppliedServicesTable;
|
|
|
|
use Icinga\Module\Director\Web\Table\IcingaHostServiceTable;
|
|
|
|
use Icinga\Module\Director\Web\Table\IcingaServiceSetServiceTable;
|
2017-01-18 15:09:57 +01:00
|
|
|
use Icinga\Web\Url;
|
2017-10-09 15:23:27 +02:00
|
|
|
use dipl\Html\Link;
|
2015-06-30 11:19:31 +02:00
|
|
|
|
2015-10-20 22:34:04 +02:00
|
|
|
class HostController extends ObjectController
|
2015-06-30 11:19:31 +02:00
|
|
|
{
|
2016-11-03 16:06:18 +01:00
|
|
|
protected function checkDirectorPermissions()
|
|
|
|
{
|
|
|
|
$this->assertPermission('director/hosts');
|
|
|
|
}
|
|
|
|
|
2017-03-06 21:46:22 +01:00
|
|
|
protected function getHostgroupRestriction()
|
|
|
|
{
|
2017-06-22 00:13:09 +02:00
|
|
|
return new HostgroupRestriction($this->db(), $this->Auth());
|
2017-03-06 21:46:22 +01:00
|
|
|
}
|
|
|
|
|
2017-08-16 23:27:13 +02:00
|
|
|
public function editAction()
|
2017-07-25 10:18:07 +02:00
|
|
|
{
|
2017-08-16 23:27:13 +02:00
|
|
|
parent::editAction();
|
|
|
|
$this->addOptionalMonitoringLink();
|
2017-07-25 10:18:07 +02:00
|
|
|
}
|
|
|
|
|
2017-08-16 23:27:13 +02:00
|
|
|
public function serviceAction()
|
2017-07-25 10:18:07 +02:00
|
|
|
{
|
2017-08-16 23:27:13 +02:00
|
|
|
$host = $this->getHostObject();
|
|
|
|
$this->addServicesHeader();
|
|
|
|
$this->addTitle($this->translate('Add Service: %s'), $host->getObjectName());
|
2017-08-21 19:55:24 +02:00
|
|
|
$this->content()->add(
|
|
|
|
IcingaAddServiceForm::load()
|
|
|
|
->setHost($host)
|
|
|
|
->setDb($this->db())
|
|
|
|
->handleRequest()
|
|
|
|
);
|
2017-07-25 10:18:07 +02:00
|
|
|
}
|
|
|
|
|
2017-08-16 23:27:13 +02:00
|
|
|
public function servicesetAction()
|
2016-03-20 11:27:19 +01:00
|
|
|
{
|
2017-08-16 23:27:13 +02:00
|
|
|
$host = $this->getHostObject();
|
|
|
|
$this->addServicesHeader();
|
|
|
|
$this->addTitle($this->translate('Add Service Set: %s'), $host->getObjectName());
|
2017-08-21 21:02:41 +02:00
|
|
|
$this->content()->add(
|
|
|
|
IcingaServiceSetForm::load()
|
|
|
|
->setHost($host)
|
|
|
|
->setDb($this->db())
|
|
|
|
->handleRequest()
|
|
|
|
);
|
2016-03-20 11:27:19 +01:00
|
|
|
}
|
|
|
|
|
2017-08-16 23:27:13 +02:00
|
|
|
protected function addServicesHeader()
|
2015-12-10 13:00:08 +01:00
|
|
|
{
|
2017-07-24 10:52:36 +02:00
|
|
|
$host = $this->getHostObject();
|
|
|
|
$hostname = $host->getObjectName();
|
2017-07-03 21:46:04 +02:00
|
|
|
$this->tabs()->activate('services');
|
|
|
|
|
|
|
|
$this->actions()->add(Link::create(
|
2016-03-18 12:59:26 +01:00
|
|
|
$this->translate('Add service'),
|
2017-08-16 23:27:13 +02:00
|
|
|
'director/host/service',
|
|
|
|
['name' => $hostname],
|
2017-07-03 21:46:04 +02:00
|
|
|
['class' => 'icon-plus']
|
|
|
|
))->add(Link::create(
|
2016-10-20 09:15:42 +02:00
|
|
|
$this->translate('Add service set'),
|
2017-08-21 21:02:41 +02:00
|
|
|
'director/host/serviceset',
|
|
|
|
['name' => $hostname],
|
2017-07-03 21:46:04 +02:00
|
|
|
['class' => 'icon-plus']
|
|
|
|
));
|
2017-08-16 23:27:13 +02:00
|
|
|
}
|
2016-08-23 16:18:54 +02:00
|
|
|
|
2017-08-16 23:27:13 +02:00
|
|
|
public function servicesAction()
|
|
|
|
{
|
|
|
|
$this->addServicesHeader();
|
|
|
|
$db = $this->db();
|
|
|
|
$host = $this->getHostObject();
|
|
|
|
$this->addTitle($this->translate('Services: %s'), $host->getObjectName());
|
|
|
|
$content = $this->content();
|
|
|
|
$table = IcingaHostServiceTable::load($host)
|
|
|
|
->setTitle($this->translate('Individual Service objects'));
|
2016-08-23 16:18:54 +02:00
|
|
|
|
|
|
|
if (count($table)) {
|
2017-08-16 23:27:13 +02:00
|
|
|
$content->add($table);
|
2016-08-23 16:18:54 +02:00
|
|
|
}
|
|
|
|
|
2016-08-27 15:20:03 +02:00
|
|
|
if ($applied = $host->vars()->get($db->settings()->magic_apply_for)) {
|
2017-08-16 23:27:13 +02:00
|
|
|
if ($applied instanceof CustomVariableDictionary) {
|
|
|
|
$table = IcingaHostAppliedForServiceTable::load($host, $applied)
|
|
|
|
->setTitle($this->translate('Generated from host vars'));
|
|
|
|
if (count($table)) {
|
|
|
|
$content->add($table);
|
|
|
|
}
|
2016-08-23 16:18:54 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-16 23:27:13 +02:00
|
|
|
/** @var IcingaHost[] $parents */
|
|
|
|
$parents = IcingaTemplateRepository::instanceByObject($this->object)
|
2017-08-25 14:22:49 +02:00
|
|
|
->getTemplatesFor($this->object, true);
|
2017-01-13 16:44:16 +01:00
|
|
|
foreach ($parents as $parent) {
|
2017-08-16 23:27:13 +02:00
|
|
|
$table = IcingaHostServiceTable::load($parent)->setInheritedBy($host);
|
|
|
|
if (count($table)) {
|
|
|
|
$content->add(
|
|
|
|
$table->setTitle(sprintf(
|
|
|
|
'Inherited from %s',
|
|
|
|
$parent->getObjectName()
|
|
|
|
))
|
|
|
|
);
|
2016-08-23 16:18:54 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-16 23:27:13 +02:00
|
|
|
$this->addHostServiceSetTables($host);
|
2017-01-13 16:44:16 +01:00
|
|
|
foreach ($parents as $parent) {
|
2017-08-16 23:27:13 +02:00
|
|
|
$this->addHostServiceSetTables($parent, $host);
|
2017-01-13 16:44:16 +01:00
|
|
|
}
|
2017-01-02 10:51:54 +01:00
|
|
|
|
2017-02-16 17:34:06 +01:00
|
|
|
$appliedSets = AppliedServiceSetLoader::fetchForHost($host);
|
|
|
|
foreach ($appliedSets as $set) {
|
|
|
|
$title = sprintf($this->translate('%s (Applied Service set)'), $set->getObjectName());
|
2017-08-16 23:27:13 +02:00
|
|
|
|
|
|
|
$content->add(
|
|
|
|
IcingaServiceSetServiceTable::load($set)
|
|
|
|
// ->setHost($host)
|
|
|
|
->setAffectedHost($host)
|
|
|
|
->setTitle($title)
|
|
|
|
);
|
2017-02-16 17:34:06 +01:00
|
|
|
}
|
|
|
|
|
2017-08-16 23:27:13 +02:00
|
|
|
$table = IcingaHostAppliedServicesTable::load($host)
|
|
|
|
->setTitle($this->translate('Applied services'));
|
2016-10-20 09:15:42 +02:00
|
|
|
|
2017-02-16 11:07:23 +01:00
|
|
|
if (count($table)) {
|
2017-08-16 23:27:13 +02:00
|
|
|
$content->add($table);
|
2017-07-03 21:46:04 +02:00
|
|
|
}
|
2016-08-23 16:18:54 +02:00
|
|
|
}
|
|
|
|
|
2017-08-16 23:27:13 +02:00
|
|
|
protected function addHostServiceSetTables(IcingaHost $host, IcingaHost $affectedHost = null)
|
2017-01-13 16:44:16 +01:00
|
|
|
{
|
|
|
|
$db = $this->db();
|
2017-02-16 11:45:45 +01:00
|
|
|
if ($affectedHost === null) {
|
|
|
|
$affectedHost = $host;
|
|
|
|
}
|
2017-01-13 16:44:16 +01:00
|
|
|
|
|
|
|
$query = $db->getDbAdapter()->select()
|
|
|
|
->from(
|
|
|
|
array('ss' => 'icinga_service_set'),
|
|
|
|
'ss.*'
|
|
|
|
)->join(
|
|
|
|
array('hsi' => 'icinga_service_set_inheritance'),
|
|
|
|
'hsi.parent_service_set_id = ss.id',
|
|
|
|
array()
|
|
|
|
)->join(
|
|
|
|
array('hs' => 'icinga_service_set'),
|
|
|
|
'hs.id = hsi.service_set_id',
|
|
|
|
array()
|
2017-08-18 17:08:04 +02:00
|
|
|
)->where('hs.host_id = ?', $host->get('id'));
|
2017-01-13 16:44:16 +01:00
|
|
|
|
|
|
|
$sets = IcingaServiceSet::loadAll($db, $query, 'object_name');
|
2017-08-16 23:27:13 +02:00
|
|
|
/** @var IcingaServiceSet $set*/
|
2017-01-13 20:48:50 +01:00
|
|
|
foreach ($sets as $name => $set) {
|
2017-01-13 16:44:16 +01:00
|
|
|
$title = sprintf($this->translate('%s (Service set)'), $name);
|
2017-08-16 23:27:13 +02:00
|
|
|
$this->content()->add(
|
|
|
|
IcingaServiceSetServiceTable::load($set)
|
|
|
|
->setHost($host)
|
|
|
|
->setAffectedHost($affectedHost)
|
|
|
|
->setTitle($title)
|
|
|
|
);
|
2017-01-13 16:44:16 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-23 16:18:54 +02:00
|
|
|
public function appliedserviceAction()
|
|
|
|
{
|
|
|
|
$db = $this->db();
|
2017-07-24 10:52:36 +02:00
|
|
|
$host = $this->getHostObject();
|
2017-01-02 10:51:54 +01:00
|
|
|
$serviceId = $this->params->get('service_id');
|
|
|
|
$parent = IcingaService::loadWithAutoIncId($serviceId, $db);
|
2017-07-24 10:52:36 +02:00
|
|
|
$serviceName = $parent->getObjectName();
|
2016-09-08 15:10:42 +02:00
|
|
|
|
2017-07-24 10:52:36 +02:00
|
|
|
$service = IcingaService::create([
|
2017-01-02 10:51:54 +01:00
|
|
|
'imports' => $parent,
|
2016-08-23 16:18:54 +02:00
|
|
|
'object_type' => 'apply',
|
|
|
|
'object_name' => $serviceName,
|
2017-08-18 17:08:04 +02:00
|
|
|
'host_id' => $host->get('id'),
|
2016-09-08 15:10:42 +02:00
|
|
|
'vars' => $host->getOverriddenServiceVars($serviceName),
|
2017-07-24 10:52:36 +02:00
|
|
|
], $db);
|
2016-08-23 16:18:54 +02:00
|
|
|
|
2017-07-03 21:46:04 +02:00
|
|
|
$this->addTitle(
|
2016-08-23 16:18:54 +02:00
|
|
|
$this->translate('Applied service: %s'),
|
|
|
|
$serviceName
|
|
|
|
);
|
|
|
|
|
2017-07-03 21:46:04 +02:00
|
|
|
$this->content()->add(
|
2017-07-24 10:52:36 +02:00
|
|
|
IcingaServiceForm::load()
|
2017-07-03 21:46:04 +02:00
|
|
|
->setDb($db)
|
|
|
|
->setHost($host)
|
|
|
|
->setApplyGenerated($parent)
|
|
|
|
->setObject($service)
|
2017-07-24 10:52:36 +02:00
|
|
|
->handleRequest()
|
2017-07-03 21:46:04 +02:00
|
|
|
);
|
2016-08-23 16:18:54 +02:00
|
|
|
|
2017-01-02 10:51:54 +01:00
|
|
|
$this->commonForServices();
|
2015-12-10 13:00:08 +01:00
|
|
|
}
|
2016-02-05 16:37:57 +01:00
|
|
|
|
2016-09-08 13:25:48 +02:00
|
|
|
public function inheritedserviceAction()
|
|
|
|
{
|
|
|
|
$db = $this->db();
|
2017-07-24 10:52:36 +02:00
|
|
|
$host = $this->getHostObject();
|
2016-09-08 13:25:48 +02:00
|
|
|
$serviceName = $this->params->get('service');
|
|
|
|
$from = IcingaHost::load($this->params->get('inheritedFrom'), $this->db());
|
|
|
|
|
2017-07-24 10:52:36 +02:00
|
|
|
$parent = IcingaService::load([
|
|
|
|
'object_name' => $serviceName,
|
2017-08-18 17:08:04 +02:00
|
|
|
'host_id' => $from->get('id')
|
2017-07-24 10:52:36 +02:00
|
|
|
], $this->db());
|
2016-09-08 13:25:48 +02:00
|
|
|
|
2017-01-18 14:21:29 +01:00
|
|
|
// TODO: we want to eventually show the host template name, doesn't work
|
|
|
|
// as template resolution would break.
|
|
|
|
// $parent->object_name = $from->object_name;
|
2016-09-08 13:25:48 +02:00
|
|
|
|
2017-07-24 10:52:36 +02:00
|
|
|
$service = IcingaService::create([
|
2016-09-08 13:25:48 +02:00
|
|
|
'object_type' => 'apply',
|
|
|
|
'object_name' => $serviceName,
|
2017-08-18 17:08:04 +02:00
|
|
|
'host_id' => $host->get('id'),
|
2017-07-24 10:52:36 +02:00
|
|
|
'imports' => [$parent],
|
2016-09-08 13:25:48 +02:00
|
|
|
'vars' => $host->getOverriddenServiceVars($serviceName),
|
2017-07-24 10:52:36 +02:00
|
|
|
], $db);
|
2016-09-08 13:25:48 +02:00
|
|
|
|
2017-07-03 21:46:04 +02:00
|
|
|
$this->addTitle($this->translate('Inherited service: %s'), $serviceName);
|
2017-07-24 10:52:36 +02:00
|
|
|
|
|
|
|
$form = IcingaServiceForm::load()
|
2016-09-08 13:25:48 +02:00
|
|
|
->setDb($db)
|
|
|
|
->setHost($host)
|
2017-08-18 17:08:04 +02:00
|
|
|
->setInheritedFrom($from->getObjectName())
|
2017-07-24 10:52:36 +02:00
|
|
|
->setObject($service)
|
|
|
|
->handleRequest();
|
2017-07-03 21:46:04 +02:00
|
|
|
$this->content()->add($form);
|
2017-01-02 10:51:54 +01:00
|
|
|
$this->commonForServices();
|
|
|
|
}
|
|
|
|
|
2017-01-18 15:09:57 +01:00
|
|
|
public function removesetAction()
|
|
|
|
{
|
|
|
|
// TODO: clean this up, use POST
|
|
|
|
$db = $this->db()->getDbAdapter();
|
|
|
|
$query = $db->select()->from(
|
|
|
|
array('ss' => 'icinga_service_set'),
|
|
|
|
array('id' => 'ss.id')
|
|
|
|
)->join(
|
|
|
|
array('si' => 'icinga_service_set_inheritance'),
|
|
|
|
'si.service_set_id = ss.id',
|
|
|
|
array()
|
2017-07-03 21:46:04 +02:00
|
|
|
)->where(
|
|
|
|
'si.parent_service_set_id = ?',
|
|
|
|
$this->params->get('setId')
|
2017-08-18 17:08:04 +02:00
|
|
|
)->where('ss.host_id = ?', $this->object->get('id'));
|
2017-01-18 15:09:57 +01:00
|
|
|
|
|
|
|
IcingaServiceSet::loadWithAutoIncId($db->fetchOne($query), $this->db())->delete();
|
|
|
|
$this->redirectNow(
|
|
|
|
Url::fromPath('director/host/services', array(
|
|
|
|
'name' => $this->object->getObjectName()
|
|
|
|
))
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2017-01-02 10:51:54 +01:00
|
|
|
public function servicesetserviceAction()
|
|
|
|
{
|
|
|
|
$db = $this->db();
|
2017-07-24 10:52:36 +02:00
|
|
|
$host = $this->getHostObject();
|
2017-01-02 10:51:54 +01:00
|
|
|
$serviceName = $this->params->get('service');
|
2017-01-13 16:44:16 +01:00
|
|
|
$set = IcingaServiceSet::load($this->params->get('set'), $db);
|
2016-09-08 13:25:48 +02:00
|
|
|
|
2017-07-24 10:52:36 +02:00
|
|
|
$service = IcingaService::load([
|
|
|
|
'object_name' => $serviceName,
|
|
|
|
'service_set_id' => $set->get('id')
|
|
|
|
], $this->db());
|
|
|
|
$service = IcingaService::create([
|
2017-01-18 14:21:29 +01:00
|
|
|
'object_type' => 'apply',
|
|
|
|
'object_name' => $serviceName,
|
2017-08-18 17:08:04 +02:00
|
|
|
'host_id' => $host->get('id'),
|
2017-09-12 11:37:39 +02:00
|
|
|
'imports' => $service->listImportNames(),
|
2017-01-18 14:21:29 +01:00
|
|
|
'vars' => $host->getOverriddenServiceVars($serviceName),
|
2017-07-24 10:52:36 +02:00
|
|
|
], $db);
|
2017-01-02 10:51:54 +01:00
|
|
|
|
2017-01-18 14:21:29 +01:00
|
|
|
// $set->copyVarsToService($service);
|
2017-07-03 21:46:04 +02:00
|
|
|
$this->addTitle(
|
2017-01-13 16:44:16 +01:00
|
|
|
$this->translate('%s on %s (from set: %s)'),
|
2017-01-02 10:51:54 +01:00
|
|
|
$serviceName,
|
2017-01-13 16:44:16 +01:00
|
|
|
$host->getObjectName(),
|
|
|
|
$set->getObjectName()
|
2017-01-02 10:51:54 +01:00
|
|
|
);
|
|
|
|
|
2017-07-24 10:52:36 +02:00
|
|
|
$form = IcingaServiceForm::load()
|
2017-01-02 10:51:54 +01:00
|
|
|
->setDb($db)
|
|
|
|
->setHost($host)
|
2017-01-13 16:44:16 +01:00
|
|
|
->setServiceSet($set)
|
2017-07-24 10:52:36 +02:00
|
|
|
->setObject($service)
|
|
|
|
->handleRequest();
|
|
|
|
$this->tabs()->activate('services');
|
2017-07-03 21:46:04 +02:00
|
|
|
$this->content()->add($form);
|
2017-01-02 10:51:54 +01:00
|
|
|
$this->commonForServices();
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function commonForServices()
|
|
|
|
{
|
|
|
|
$host = $this->object;
|
2017-07-03 21:46:04 +02:00
|
|
|
$this->actions()->add(Link::create(
|
2017-01-02 10:51:54 +01:00
|
|
|
$this->translate('back'),
|
|
|
|
'director/host/services',
|
2017-07-24 10:52:36 +02:00
|
|
|
['name' => $host->getObjectName()],
|
2017-07-03 21:46:04 +02:00
|
|
|
['class' => 'icon-left-big']
|
|
|
|
));
|
2017-07-14 16:03:00 +02:00
|
|
|
$this->tabs()->activate('services');
|
2016-09-08 13:25:48 +02:00
|
|
|
}
|
|
|
|
|
2016-02-05 16:37:57 +01:00
|
|
|
public function agentAction()
|
|
|
|
{
|
2017-08-14 12:22:28 +02:00
|
|
|
$selfService = new SelfService($this->getHostObject(), $this->api());
|
2017-01-18 15:11:14 +01:00
|
|
|
if ($os = $this->params->get('download')) {
|
2017-08-14 12:22:28 +02:00
|
|
|
$selfService->handleLegacyAgentDownloads($os);
|
2017-07-20 16:58:48 +02:00
|
|
|
return;
|
|
|
|
}
|
2017-01-18 15:11:14 +01:00
|
|
|
|
2017-08-14 12:22:28 +02:00
|
|
|
$selfService->renderTo($this);
|
2017-07-20 16:58:48 +02:00
|
|
|
$this->tabs()->activate('agent');
|
|
|
|
}
|
|
|
|
|
2017-08-14 12:22:28 +02:00
|
|
|
protected function addOptionalMonitoringLink()
|
2017-07-20 16:58:48 +02:00
|
|
|
{
|
2017-08-14 12:22:28 +02:00
|
|
|
$host = $this->object;
|
2016-05-03 08:27:12 +02:00
|
|
|
try {
|
2017-08-14 12:22:28 +02:00
|
|
|
$mon = $this->monitoring();
|
2017-08-18 17:08:04 +02:00
|
|
|
if ($host->isObject()
|
|
|
|
&& $mon->isAvailable()
|
|
|
|
&& $mon->hasHost($host->getObjectName())
|
|
|
|
) {
|
2017-08-14 12:22:28 +02:00
|
|
|
$this->actions()->add(Link::create(
|
|
|
|
$this->translate('Show'),
|
|
|
|
'monitoring/host/show',
|
|
|
|
['host' => $host->getObjectName()],
|
|
|
|
[
|
|
|
|
'class' => 'icon-globe critical',
|
|
|
|
'data-base-target' => '_next'
|
|
|
|
]
|
|
|
|
));
|
2018-02-20 15:33:28 +01:00
|
|
|
|
|
|
|
// Intentionally placed here, show it only for deployed Hosts
|
|
|
|
$this->addOptionalInspectLink();
|
2017-02-08 12:38:14 +01:00
|
|
|
}
|
2017-08-14 12:22:28 +02:00
|
|
|
} catch (Exception $e) {
|
|
|
|
// Silently ignore errors in the monitoring module
|
2017-02-08 12:38:14 +01:00
|
|
|
}
|
2016-04-08 00:24:20 +02:00
|
|
|
}
|
2017-07-24 10:52:36 +02:00
|
|
|
|
2018-02-20 15:33:28 +01:00
|
|
|
protected function addOptionalInspectLink()
|
|
|
|
{
|
|
|
|
if (! $this->hasPermission('director/inspect')) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->actions()->add(Link::create(
|
|
|
|
$this->translate('Inspect'),
|
|
|
|
'director/inspect/object',
|
|
|
|
[
|
|
|
|
'type' => 'host',
|
|
|
|
'plural' => 'hosts',
|
|
|
|
'name' => $this->object->getObjectName()
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'class' => 'icon-zoom-in',
|
|
|
|
'data-base-target' => '_next'
|
|
|
|
]
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
2017-07-24 10:52:36 +02:00
|
|
|
/**
|
|
|
|
* @return IcingaHost
|
|
|
|
*/
|
|
|
|
protected function getHostObject()
|
|
|
|
{
|
2017-08-18 17:08:04 +02:00
|
|
|
/** @var IcingaHost $this->object */
|
2017-07-24 10:52:36 +02:00
|
|
|
return $this->object;
|
|
|
|
}
|
2015-06-30 11:19:31 +02:00
|
|
|
}
|