blob: c670ab445cc7910265476c51782bf732d45cd82c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
<?php
namespace Icinga\Module\Cube\ProvidedHook\Cube;
use Icinga\Module\Cube\Hook\IcingaDbActionsHook;
use Icinga\Module\Cube\IcingaDb\IcingaDbCube;
use Icinga\Module\Cube\Icingadb\IcingadbServiceStatusCube;
class IcingaDbActions extends IcingaDbActionsHook
{
public function createActionLinks(IcingaDbCube $cube)
{
$type = 'host';
if ($cube instanceof IcingadbServiceStatusCube) {
$type = 'service';
}
$url = 'icingadb/' . $type . 's';
$paramsWithPrefix = [];
foreach ($cube->getSlices() as $dimension => $slice) {
$paramsWithPrefix[$type . '.vars.' . $dimension] = $slice;
}
if ($type === 'host') {
$this->addActionLink(
$this->makeUrl($url, $paramsWithPrefix),
t('Show hosts status'),
t('This shows all matching hosts and their current state in Icinga DB Web'),
'server'
);
} else {
$this->addActionLink(
$this->makeUrl($url, $paramsWithPrefix),
t('Show services status'),
t('This shows all matching hosts and their current state in Icinga DB Web'),
'cog'
);
}
}
}
|