Provide native implementations for the hooks: icingadb/HostActions and icingadb/ServiceActions

This commit is contained in:
raviks789 2022-02-15 10:29:19 +01:00
parent d4bd45233b
commit 6c5c38d425
3 changed files with 50 additions and 0 deletions

View file

@ -0,0 +1,22 @@
<?php
namespace Icinga\Module\Businessprocess\ProvidedHook\Icingadb;
use Icinga\Module\Icingadb\Hook\HostActionsHook;
use Icinga\Module\Icingadb\Model\Host;
use ipl\Web\Widget\Link;
class HostActions extends HostActionsHook
{
public function getActionsForObject(Host $host): array
{
$label = mt('businessprocess', 'Business Impact');
return array(
new Link(
$label,
'businessprocess/node/impact?name='
. rawurlencode($host->name . ';Hoststatus')
)
);
}
}

View file

@ -0,0 +1,26 @@
<?php
namespace Icinga\Module\Businessprocess\ProvidedHook\Icingadb;
use Icinga\Module\Icingadb\Hook\ServiceActionsHook;
use Icinga\Module\Icingadb\Model\Service;
use ipl\Web\Widget\Link;
class ServiceActions extends ServiceActionsHook
{
public function getActionsForObject(Service $service): array
{
$label = mt('businessprocess', 'Business Impact');
return array(
new Link(
$label,
sprintf(
'businessprocess/node/impact?name=%s',
rawurlencode(
sprintf('%s;%s', $service->host->name, $service->name)
)
)
)
);
}
}

View file

@ -2,5 +2,7 @@
$this->provideHook('monitoring/HostActions');
$this->provideHook('monitoring/ServiceActions');
$this->provideHook('icingadb/HostActions');
$this->provideHook('icingadb/ServiceActions');
$this->provideHook('icingadb/icingadbSupport');
//$this->provideHook('director/shipConfigFiles');