mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2025-12-29 02:09:33 -05:00
Provide native implementations for the hooks: icingadb/HostActions and icingadb/ServiceActions
This commit is contained in:
parent
d4bd45233b
commit
6c5c38d425
3 changed files with 50 additions and 0 deletions
|
|
@ -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')
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -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)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
2
run.php
2
run.php
|
|
@ -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');
|
||||
|
|
|
|||
Loading…
Reference in a new issue