2019-09-09 08:49:46 -04:00
|
|
|
<?php
|
|
|
|
|
|
2020-03-13 03:38:01 -04:00
|
|
|
/* Icinga DB Web | (c) 2020 Icinga GmbH | GPLv2 */
|
|
|
|
|
|
2021-11-08 09:13:20 -05:00
|
|
|
namespace Icinga\Module\Icingadb {
|
|
|
|
|
|
2022-04-04 09:38:02 -04:00
|
|
|
use Icinga\Application\Icinga;
|
2019-12-10 04:46:10 -05:00
|
|
|
use Icinga\Authentication\Auth;
|
2021-10-12 12:35:07 -04:00
|
|
|
use Icinga\Module\Icingadb\Web\Navigation\Renderer\HostProblemsBadge;
|
|
|
|
|
use Icinga\Module\Icingadb\Web\Navigation\Renderer\ServiceProblemsBadge;
|
2021-04-07 06:32:14 -04:00
|
|
|
use Icinga\Util\StringHelper;
|
2020-11-24 08:07:39 -05:00
|
|
|
use RecursiveDirectoryIterator;
|
|
|
|
|
use RecursiveIteratorIterator;
|
2019-12-10 04:46:10 -05:00
|
|
|
|
2019-09-09 08:49:46 -04:00
|
|
|
/** @var \Icinga\Application\Modules\Module $this */
|
2020-04-17 10:45:35 -04:00
|
|
|
|
2023-02-21 10:53:49 -05:00
|
|
|
$auth = Auth::getInstance();
|
|
|
|
|
$authenticated = Icinga::app()->isWeb() && $auth->isAuthenticated();
|
|
|
|
|
|
2020-04-17 10:45:35 -04:00
|
|
|
$this->provideSetupWizard('Icinga\Module\Icingadb\Setup\IcingaDbWizard');
|
|
|
|
|
|
2021-03-16 12:32:59 -04:00
|
|
|
$this->providePermission(
|
|
|
|
|
'icingadb/command/*',
|
|
|
|
|
$this->translate('Allow all commands')
|
|
|
|
|
);
|
|
|
|
|
$this->providePermission(
|
|
|
|
|
'icingadb/command/schedule-check',
|
|
|
|
|
$this->translate('Allow to schedule host and service checks')
|
|
|
|
|
);
|
|
|
|
|
$this->providePermission(
|
|
|
|
|
'icingadb/command/schedule-check/active-only',
|
|
|
|
|
$this->translate('Allow to schedule host and service checks (Only on objects with active checks enabled)')
|
|
|
|
|
);
|
|
|
|
|
$this->providePermission(
|
|
|
|
|
'icingadb/command/acknowledge-problem',
|
|
|
|
|
$this->translate('Allow to acknowledge host and service problems')
|
|
|
|
|
);
|
|
|
|
|
$this->providePermission(
|
|
|
|
|
'icingadb/command/remove-acknowledgement',
|
|
|
|
|
$this->translate('Allow to remove problem acknowledgements')
|
|
|
|
|
);
|
|
|
|
|
$this->providePermission(
|
|
|
|
|
'icingadb/command/comment/*',
|
|
|
|
|
$this->translate('Allow to add and delete host and service comments')
|
|
|
|
|
);
|
|
|
|
|
$this->providePermission(
|
|
|
|
|
'icingadb/command/comment/add',
|
|
|
|
|
$this->translate('Allow to add host and service comments')
|
|
|
|
|
);
|
|
|
|
|
$this->providePermission(
|
|
|
|
|
'icingadb/command/comment/delete',
|
|
|
|
|
$this->translate('Allow to delete host and service comments')
|
|
|
|
|
);
|
|
|
|
|
$this->providePermission(
|
|
|
|
|
'icingadb/command/downtime/*',
|
|
|
|
|
$this->translate('Allow to schedule and delete host and service downtimes')
|
|
|
|
|
);
|
|
|
|
|
$this->providePermission(
|
|
|
|
|
'icingadb/command/downtime/schedule',
|
|
|
|
|
$this->translate('Allow to schedule host and service downtimes')
|
|
|
|
|
);
|
|
|
|
|
$this->providePermission(
|
|
|
|
|
'icingadb/command/downtime/delete',
|
|
|
|
|
$this->translate('Allow to delete host and service downtimes')
|
|
|
|
|
);
|
|
|
|
|
$this->providePermission(
|
|
|
|
|
'icingadb/command/process-check-result',
|
|
|
|
|
$this->translate('Allow to process host and service check results')
|
|
|
|
|
);
|
|
|
|
|
$this->providePermission(
|
|
|
|
|
'icingadb/command/feature/instance',
|
|
|
|
|
$this->translate('Allow to toggle instance-wide features')
|
|
|
|
|
);
|
|
|
|
|
$this->providePermission(
|
|
|
|
|
'icingadb/command/feature/object/*',
|
|
|
|
|
$this->translate('Allow to toggle all features on host and service objects')
|
|
|
|
|
);
|
|
|
|
|
$this->providePermission(
|
|
|
|
|
'icingadb/command/feature/object/active-checks',
|
|
|
|
|
$this->translate('Allow to toggle active checks on host and service objects')
|
|
|
|
|
);
|
|
|
|
|
$this->providePermission(
|
|
|
|
|
'icingadb/command/feature/object/passive-checks',
|
|
|
|
|
$this->translate('Allow to toggle passive checks on host and service objects')
|
|
|
|
|
);
|
|
|
|
|
$this->providePermission(
|
|
|
|
|
'icingadb/command/feature/object/notifications',
|
|
|
|
|
$this->translate('Allow to toggle notifications on host and service objects')
|
|
|
|
|
);
|
|
|
|
|
$this->providePermission(
|
|
|
|
|
'icingadb/command/feature/object/event-handler',
|
|
|
|
|
$this->translate('Allow to toggle event handlers on host and service objects')
|
|
|
|
|
);
|
|
|
|
|
$this->providePermission(
|
|
|
|
|
'icingadb/command/feature/object/flap-detection',
|
|
|
|
|
$this->translate('Allow to toggle flap detection on host and service objects')
|
|
|
|
|
);
|
|
|
|
|
$this->providePermission(
|
|
|
|
|
'icingadb/command/send-custom-notification',
|
|
|
|
|
$this->translate('Allow to send custom notifications for hosts and services')
|
|
|
|
|
);
|
|
|
|
|
|
2021-05-05 04:28:27 -04:00
|
|
|
$this->providePermission(
|
|
|
|
|
'icingadb/object/show-source',
|
|
|
|
|
$this->translate('Allow to view an object\'s source data. (May contain sensitive data!)')
|
|
|
|
|
);
|
|
|
|
|
|
2021-01-28 06:27:23 -05:00
|
|
|
$this->provideRestriction(
|
|
|
|
|
'icingadb/filter/objects',
|
|
|
|
|
$this->translate('Restrict access to the Icinga objects that match the filter')
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$this->provideRestriction(
|
|
|
|
|
'icingadb/filter/hosts',
|
|
|
|
|
$this->translate('Restrict access to the Icinga hosts and services that match the filter')
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$this->provideRestriction(
|
|
|
|
|
'icingadb/filter/services',
|
|
|
|
|
$this->translate('Restrict access to the Icinga services that match the filter')
|
|
|
|
|
);
|
|
|
|
|
|
2021-04-07 06:28:24 -04:00
|
|
|
$this->provideRestriction(
|
2022-06-15 06:48:54 -04:00
|
|
|
'icingadb/denylist/routes',
|
2021-04-07 06:28:24 -04:00
|
|
|
$this->translate('Prevent access to routes that are part of the list')
|
|
|
|
|
);
|
|
|
|
|
|
2021-03-11 10:37:52 -05:00
|
|
|
$this->provideRestriction(
|
2022-06-15 06:48:54 -04:00
|
|
|
'icingadb/denylist/variables',
|
2021-03-11 10:37:52 -05:00
|
|
|
$this->translate('Hide custom variables of Icinga objects that are part of the list')
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$this->provideRestriction(
|
|
|
|
|
'icingadb/protect/variables',
|
|
|
|
|
$this->translate('Obfuscate custom variable values of Icinga objects that are part of the list')
|
|
|
|
|
);
|
|
|
|
|
|
2023-02-21 10:53:49 -05:00
|
|
|
if (! $this::exists('monitoring') || ($authenticated && ! $auth->getUser()->can('module/monitoring'))) {
|
2024-03-21 03:36:23 -04:00
|
|
|
$routeDenylist = [];
|
|
|
|
|
if ($authenticated && ! $auth->getUser()->isUnrestricted()) {
|
|
|
|
|
// The empty array is for PHP pre 7.4, older versions require at least a single param for array_merge
|
|
|
|
|
$routeDenylist = array_flip(array_merge([], ...array_map(function ($restriction) {
|
|
|
|
|
return StringHelper::trimSplit($restriction);
|
|
|
|
|
}, $auth->getRestrictions('icingadb/denylist/routes'))));
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-09 08:38:47 -04:00
|
|
|
/*
|
|
|
|
|
* Available navigation items
|
|
|
|
|
*/
|
|
|
|
|
$this->provideNavigationItem('icingadb-host-action', $this->translate('Host Action'));
|
|
|
|
|
$this->provideNavigationItem('icingadb-service-action', $this->translate('Service Action'));
|
|
|
|
|
|
2020-05-19 06:37:31 -04:00
|
|
|
/**
|
|
|
|
|
* Search urls
|
|
|
|
|
*/
|
|
|
|
|
$this->provideSearchUrl(
|
|
|
|
|
$this->translate('Tactical Overview'),
|
|
|
|
|
'icingadb/tactical',
|
|
|
|
|
100
|
|
|
|
|
);
|
|
|
|
|
$this->provideSearchUrl(
|
|
|
|
|
$this->translate('Hosts'),
|
|
|
|
|
'icingadb/hosts?sort=host.state.severity&limit=10',
|
|
|
|
|
99
|
|
|
|
|
);
|
2022-08-19 09:47:16 -04:00
|
|
|
$this->provideSearchUrl(
|
|
|
|
|
$this->translate('Services on Hosts'),
|
|
|
|
|
'icingadb/services?sort=service.state.severity&limit=10&_hostFilterOnly',
|
|
|
|
|
98
|
|
|
|
|
);
|
2020-05-19 06:37:31 -04:00
|
|
|
$this->provideSearchUrl(
|
|
|
|
|
$this->translate('Services'),
|
|
|
|
|
'icingadb/services?sort=service.state.severity&limit=10',
|
2022-08-19 09:47:16 -04:00
|
|
|
97
|
2020-05-19 06:37:31 -04:00
|
|
|
);
|
2024-03-21 03:36:23 -04:00
|
|
|
|
|
|
|
|
if (! array_key_exists('hostgroups', $routeDenylist)) {
|
|
|
|
|
$this->provideSearchUrl(
|
|
|
|
|
$this->translate('Hostgroups'),
|
|
|
|
|
'icingadb/hostgroups?limit=10',
|
|
|
|
|
96
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (! array_key_exists('servicegroups', $routeDenylist)) {
|
|
|
|
|
$this->provideSearchUrl(
|
|
|
|
|
$this->translate('Servicegroups'),
|
|
|
|
|
'icingadb/servicegroups?limit=10',
|
|
|
|
|
95
|
|
|
|
|
);
|
|
|
|
|
}
|
2020-05-19 10:17:23 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Current Incidents
|
|
|
|
|
*/
|
|
|
|
|
$dashboard = $this->dashboard(N_('Current Incidents'), ['priority' => 50]);
|
|
|
|
|
$dashboard->add(
|
|
|
|
|
N_('Service Problems'),
|
|
|
|
|
'icingadb/services?service.state.is_problem=y'
|
|
|
|
|
. '&view=minimal&limit=32&sort=service.state.severity desc',
|
|
|
|
|
100
|
|
|
|
|
);
|
|
|
|
|
$dashboard->add(
|
|
|
|
|
N_('Recently Recovered Services'),
|
|
|
|
|
'icingadb/services?service.state.soft_state=0'
|
|
|
|
|
. '&view=minimal&limit=32&sort=service.state.last_state_change desc',
|
|
|
|
|
110
|
|
|
|
|
);
|
|
|
|
|
$dashboard->add(
|
|
|
|
|
N_('Host Problems'),
|
|
|
|
|
'icingadb/hosts?host.state.is_problem=y'
|
|
|
|
|
. '&view=minimal&limit=32&sort=host.state.severity desc',
|
|
|
|
|
120
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Overdue
|
|
|
|
|
*/
|
|
|
|
|
$dashboard = $this->dashboard(N_('Overdue'), ['priority' => 70]);
|
|
|
|
|
$dashboard->add(
|
|
|
|
|
N_('Late Host Check Results'),
|
|
|
|
|
'icingadb/hosts?host.state.is_overdue=y'
|
|
|
|
|
. '&view=minimal&limit=15&sort=host.state.severity desc',
|
|
|
|
|
100
|
|
|
|
|
);
|
|
|
|
|
$dashboard->add(
|
|
|
|
|
N_('Late Service Check Results'),
|
|
|
|
|
'icingadb/services?service.state.is_overdue=y'
|
|
|
|
|
. '&view=minimal&limit=15&sort=service.state.severity desc',
|
|
|
|
|
110
|
|
|
|
|
);
|
|
|
|
|
$dashboard->add(
|
|
|
|
|
N_('Acknowledgements Active For At Least Three Days'),
|
|
|
|
|
'icingadb/comments?comment.entry_type=ack&comment.entry_time<-3 days'
|
|
|
|
|
. '&view=minimal&limit=15&sort=comment.entry_time',
|
|
|
|
|
120
|
|
|
|
|
);
|
|
|
|
|
$dashboard->add(
|
|
|
|
|
N_('Downtimes Active For At Least Three Days'),
|
|
|
|
|
'icingadb/downtimes?downtime.is_in_effect=y&downtime.scheduled_start_time<-3 days'
|
|
|
|
|
. '&view=minimal&limit=15&sort=downtime.start_time',
|
|
|
|
|
130
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Muted
|
|
|
|
|
*/
|
|
|
|
|
$dashboard = $this->dashboard(N_('Muted'), ['priority' => 80]);
|
|
|
|
|
$dashboard->add(
|
|
|
|
|
N_('Disabled Service Notifications'),
|
|
|
|
|
'icingadb/services?service.notifications_enabled=n'
|
|
|
|
|
. '&view=minimal&limit=15&sort=service.state.severity desc',
|
|
|
|
|
100
|
|
|
|
|
);
|
|
|
|
|
$dashboard->add(
|
|
|
|
|
N_('Disabled Host Notifications'),
|
|
|
|
|
'icingadb/hosts?host.notifications_enabled=n'
|
|
|
|
|
. '&view=minimal&limit=15&sort=host.state.severity desc',
|
|
|
|
|
110
|
|
|
|
|
);
|
|
|
|
|
$dashboard->add(
|
|
|
|
|
N_('Disabled Service Checks'),
|
|
|
|
|
'icingadb/services?service.active_checks_enabled=n'
|
|
|
|
|
. '&view=minimal&limit=15&sort=service.state.last_state_change',
|
|
|
|
|
120
|
|
|
|
|
);
|
|
|
|
|
$dashboard->add(
|
|
|
|
|
N_('Disabled Host Checks'),
|
|
|
|
|
'icingadb/hosts?host.active_checks_enabled=n'
|
|
|
|
|
. '&view=minimal&limit=15&sort=host.state.last_state_change',
|
|
|
|
|
130
|
|
|
|
|
);
|
|
|
|
|
$dashboard->add(
|
|
|
|
|
N_('Acknowledged Problem Services'),
|
|
|
|
|
'icingadb/services?service.state.is_acknowledged!=n&service.state.is_problem=y'
|
|
|
|
|
. '&view=minimal&limit=15&sort=service.state.severity desc',
|
|
|
|
|
140
|
|
|
|
|
);
|
|
|
|
|
$dashboard->add(
|
|
|
|
|
N_('Acknowledged Problem Hosts'),
|
|
|
|
|
'icingadb/hosts?host.state.is_acknowledged!=n&host.state.is_problem=y'
|
|
|
|
|
. '&view=minimal&limit=15&sort=host.state.severity desc',
|
|
|
|
|
150
|
|
|
|
|
);
|
2021-10-12 12:35:07 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @var \Icinga\Application\Modules\Module $this
|
|
|
|
|
*
|
|
|
|
|
* Problems section in case monitoring is disabled
|
|
|
|
|
*/
|
|
|
|
|
$problemSection = $this->menuSection(N_('Problems'), [
|
|
|
|
|
'renderer' => array(
|
|
|
|
|
'TotalProblemsBadge',
|
|
|
|
|
'state' => 'critical'
|
|
|
|
|
),
|
|
|
|
|
'icon' => 'attention-circled',
|
|
|
|
|
'priority' => 20
|
|
|
|
|
]);
|
|
|
|
|
$problemSection->add(N_('Host Problems'), [
|
2021-11-08 09:13:33 -05:00
|
|
|
'renderer' => (new HostProblemsBadge())->disableLink(),
|
2021-10-12 12:35:07 -04:00
|
|
|
'icon' => 'server',
|
|
|
|
|
'description' => $this->translate('List current host problems'),
|
2021-11-08 09:13:33 -05:00
|
|
|
'url' => 'icingadb/hosts?host.state.is_problem=y'
|
2021-10-12 12:35:07 -04:00
|
|
|
. '&sort=host.state.severity desc',
|
2021-11-08 09:13:33 -05:00
|
|
|
'priority' => 50
|
2021-10-12 12:35:07 -04:00
|
|
|
]);
|
|
|
|
|
$problemSection->add(N_('Service Problems'), [
|
2021-11-08 09:13:33 -05:00
|
|
|
'renderer' => (new ServiceProblemsBadge())->disableLink(),
|
2021-10-12 12:35:07 -04:00
|
|
|
'icon' => 'cog',
|
|
|
|
|
'description' => $this->translate('List current service problems'),
|
2021-11-08 09:13:33 -05:00
|
|
|
'url' => 'icingadb/services?service.state.is_problem=y'
|
2021-10-12 12:35:07 -04:00
|
|
|
. '&sort=service.state.severity desc',
|
2021-11-08 09:13:33 -05:00
|
|
|
'priority' => 60
|
2021-10-12 12:35:07 -04:00
|
|
|
]);
|
|
|
|
|
$problemSection->add(N_('Service Grid'), [
|
|
|
|
|
'icon' => 'cogs',
|
|
|
|
|
'description' => $this->translate('Display service problems as grid'),
|
|
|
|
|
'url' => 'icingadb/services/grid?problems',
|
|
|
|
|
'priority' => 70
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
$problemSection->add(N_('Current Downtimes'), [
|
|
|
|
|
'description' => $this->translate('List current downtimes'),
|
2021-11-08 09:13:33 -05:00
|
|
|
'url' => 'icingadb/downtimes?downtime.is_in_effect=y',
|
|
|
|
|
'priority' => 80,
|
|
|
|
|
'icon' => 'plug'
|
2021-10-12 12:35:07 -04:00
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @var \Icinga\Application\Modules\Module $this
|
|
|
|
|
*
|
|
|
|
|
* Overview section in case monitoring is disabled
|
|
|
|
|
*/
|
|
|
|
|
$overviewSection = $this->menuSection('Overview', [
|
2021-11-08 09:13:33 -05:00
|
|
|
'icon' => 'binoculars',
|
|
|
|
|
'priority' => 30
|
2021-10-12 12:35:07 -04:00
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
$overviewSection->add(N_('Tactical Overview'), [
|
2021-11-08 09:13:33 -05:00
|
|
|
'url' => 'icingadb/tactical',
|
2021-10-12 12:35:07 -04:00
|
|
|
'description' => $this->translate('Open tactical overview'),
|
2021-11-08 09:13:33 -05:00
|
|
|
'priority' => 40,
|
|
|
|
|
'icon' => 'chart-pie'
|
2021-10-12 12:35:07 -04:00
|
|
|
]);
|
|
|
|
|
$overviewSection->add(N_('Hosts'), [
|
2021-11-08 09:13:33 -05:00
|
|
|
'priority' => 50,
|
2021-10-12 12:35:07 -04:00
|
|
|
'description' => $this->translate('List hosts'),
|
2021-11-08 09:13:33 -05:00
|
|
|
'url' => 'icingadb/hosts',
|
|
|
|
|
'icon' => 'server'
|
2021-10-12 12:35:07 -04:00
|
|
|
]);
|
|
|
|
|
$overviewSection->add(N_('Services'), [
|
2022-06-13 07:35:14 -04:00
|
|
|
'priority' => 60,
|
2021-10-12 12:35:07 -04:00
|
|
|
'description' => $this->translate('List services'),
|
2021-11-08 09:13:33 -05:00
|
|
|
'url' => 'icingadb/services',
|
|
|
|
|
'icon' => 'cog'
|
2021-10-12 12:35:07 -04:00
|
|
|
]);
|
|
|
|
|
|
2022-06-15 06:48:54 -04:00
|
|
|
if (! array_key_exists('hostgroups', $routeDenylist)) {
|
2022-06-13 07:35:14 -04:00
|
|
|
$overviewSection->add(N_('Host Groups'), [
|
|
|
|
|
'description' => $this->translate('List host groups'),
|
|
|
|
|
'url' => 'icingadb/hostgroups',
|
|
|
|
|
'priority' => 70,
|
|
|
|
|
'icon' => 'network-wired'
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-15 06:48:54 -04:00
|
|
|
if (! array_key_exists('servicegroups', $routeDenylist)) {
|
2021-10-12 12:35:07 -04:00
|
|
|
$overviewSection->add(N_('Service Groups'), [
|
|
|
|
|
'description' => $this->translate('List service groups'),
|
2021-11-08 09:13:33 -05:00
|
|
|
'url' => 'icingadb/servicegroups',
|
2022-06-13 07:35:14 -04:00
|
|
|
'priority' => 80,
|
2021-11-08 09:13:33 -05:00
|
|
|
'icon' => 'cogs'
|
2021-10-12 12:35:07 -04:00
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-14 08:41:05 -05:00
|
|
|
if (! array_key_exists('contactgroups', $routeDenylist)) {
|
2025-04-04 09:53:41 -04:00
|
|
|
$overviewSection->add(N_('Contact Groups'), [
|
|
|
|
|
'description' => $this->translate('List contact groups'),
|
|
|
|
|
'url' => 'icingadb/contactgroups',
|
2022-06-13 07:35:14 -04:00
|
|
|
'priority' => 90,
|
|
|
|
|
'icon' => 'users'
|
2021-10-12 12:35:07 -04:00
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-14 08:41:05 -05:00
|
|
|
if (! array_key_exists('contacts', $routeDenylist)) {
|
2025-04-04 09:09:32 -04:00
|
|
|
$overviewSection->add(N_('Contacts'), [
|
|
|
|
|
'description' => $this->translate('List contacts'),
|
|
|
|
|
'url' => 'icingadb/contacts',
|
2022-06-13 07:35:14 -04:00
|
|
|
'priority' => 100,
|
2021-11-08 09:13:33 -05:00
|
|
|
'icon' => 'user-friends'
|
2021-10-12 12:35:07 -04:00
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$overviewSection->add(N_('Comments'), [
|
2021-11-08 09:13:33 -05:00
|
|
|
'url' => 'icingadb/comments',
|
2021-10-12 12:35:07 -04:00
|
|
|
'description' => $this->translate('List comments'),
|
2022-06-13 07:35:14 -04:00
|
|
|
'priority' => 110,
|
2021-11-08 09:13:33 -05:00
|
|
|
'icon' => 'comments'
|
2021-10-12 12:35:07 -04:00
|
|
|
]);
|
|
|
|
|
$overviewSection->add(N_('Downtimes'), [
|
2021-11-08 09:13:33 -05:00
|
|
|
'url' => 'icingadb/downtimes',
|
2021-10-12 12:35:07 -04:00
|
|
|
'description' => $this->translate('List downtimes'),
|
2022-06-13 07:35:14 -04:00
|
|
|
'priority' => 120,
|
2021-11-08 09:13:33 -05:00
|
|
|
'icon' => 'plug'
|
2021-10-12 12:35:07 -04:00
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @var \Icinga\Application\Modules\Module $this
|
|
|
|
|
*
|
|
|
|
|
* History section in case monitoring is disabled
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
$section = $this->menuSection(N_('History'), array(
|
2021-11-08 09:13:33 -05:00
|
|
|
'icon' => 'history',
|
|
|
|
|
'priority' => 90
|
2021-10-12 12:35:07 -04:00
|
|
|
));
|
|
|
|
|
$section->add(N_('Notifications'), array(
|
|
|
|
|
'icon' => 'bell',
|
|
|
|
|
'description' => $this->translate('List notifications'),
|
2022-06-13 07:35:14 -04:00
|
|
|
'priority' => 20,
|
2021-10-12 12:35:07 -04:00
|
|
|
'url' => 'icingadb/notifications',
|
|
|
|
|
));
|
2022-06-13 07:35:14 -04:00
|
|
|
$section->add(N_('Event Overview'), array(
|
|
|
|
|
'icon' => 'history',
|
|
|
|
|
'description' => $this->translate('Open event overview'),
|
|
|
|
|
'priority' => 30,
|
|
|
|
|
'url' => 'icingadb/history'
|
|
|
|
|
));
|
2021-09-09 08:38:47 -04:00
|
|
|
} else {
|
|
|
|
|
/*
|
|
|
|
|
* Available navigation items
|
|
|
|
|
*/
|
|
|
|
|
$this->provideNavigationItem(
|
|
|
|
|
'icingadb-host-action',
|
|
|
|
|
$this->translate('Host Action') . ' (Icinga DB)'
|
|
|
|
|
);
|
|
|
|
|
$this->provideNavigationItem(
|
|
|
|
|
'icingadb-service-action',
|
|
|
|
|
$this->translate('Service Action') . ' (Icinga DB)'
|
|
|
|
|
);
|
2021-04-07 06:32:14 -04:00
|
|
|
|
2021-10-12 12:35:07 -04:00
|
|
|
/** @var \Icinga\Application\Modules\Module $this */
|
|
|
|
|
$section = $this->menuSection('Icinga DB', [
|
|
|
|
|
'icon' => 'database',
|
|
|
|
|
'priority' => 30
|
2019-12-10 04:46:10 -05:00
|
|
|
]);
|
2021-04-07 06:32:14 -04:00
|
|
|
|
2022-06-13 07:35:14 -04:00
|
|
|
$section->add(N_('Tactical Overview'), [
|
|
|
|
|
'url' => 'icingadb/tactical',
|
2021-11-09 07:31:08 -05:00
|
|
|
'priority' => 10,
|
2022-06-13 07:35:14 -04:00
|
|
|
'description' => $this->translate('Open tactical overview'),
|
|
|
|
|
'icon' => 'chart-pie'
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
$section->add(N_('Hosts'), [
|
|
|
|
|
'priority' => 20,
|
2021-11-09 07:31:08 -05:00
|
|
|
'description' => $this->translate('List hosts'),
|
|
|
|
|
'renderer' => 'HostProblemsBadge',
|
|
|
|
|
'url' => 'icingadb/hosts',
|
|
|
|
|
'icon' => 'server'
|
2019-12-10 04:46:10 -05:00
|
|
|
]);
|
2021-10-12 12:35:07 -04:00
|
|
|
$section->add(N_('Services'), [
|
2022-06-13 07:35:14 -04:00
|
|
|
'priority' => 30,
|
2021-11-09 07:31:08 -05:00
|
|
|
'description' => $this->translate('List services'),
|
|
|
|
|
'renderer' => 'ServiceProblemsBadge',
|
|
|
|
|
'url' => 'icingadb/services',
|
|
|
|
|
'icon' => 'cog'
|
2021-10-12 12:35:07 -04:00
|
|
|
]);
|
|
|
|
|
$section->add(N_('Service Grid'), [
|
|
|
|
|
'icon' => 'cog',
|
|
|
|
|
'description' => $this->translate('Display service problems as grid'),
|
|
|
|
|
'url' => 'icingadb/services/grid?problems',
|
2022-06-13 07:35:14 -04:00
|
|
|
'priority' => 40
|
2021-04-07 06:33:53 -04:00
|
|
|
]);
|
|
|
|
|
|
2022-06-15 06:48:54 -04:00
|
|
|
$routeDenylist = [];
|
2023-02-21 10:53:49 -05:00
|
|
|
if ($authenticated && ! $auth->getUser()->isUnrestricted()) {
|
2021-10-12 12:35:07 -04:00
|
|
|
// The empty array is for PHP pre 7.4, older versions require at least a single param for array_merge
|
2022-06-15 06:48:54 -04:00
|
|
|
$routeDenylist = array_flip(array_merge([], ...array_map(function ($restriction) {
|
2021-10-12 12:35:07 -04:00
|
|
|
return StringHelper::trimSplit($restriction);
|
2022-06-15 06:48:54 -04:00
|
|
|
}, $auth->getRestrictions('icingadb/denylist/routes'))));
|
2021-10-12 12:35:07 -04:00
|
|
|
}
|
|
|
|
|
|
2022-06-15 06:48:54 -04:00
|
|
|
if (! array_key_exists('hostgroups', $routeDenylist)) {
|
2022-06-13 07:35:14 -04:00
|
|
|
$section->add(N_('Host Groups'), [
|
|
|
|
|
'url' => 'icingadb/hostgroups',
|
|
|
|
|
'priority' => 50,
|
|
|
|
|
'description' => $this->translate('List host groups'),
|
|
|
|
|
'icon' => 'network-wired'
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-15 06:48:54 -04:00
|
|
|
if (! array_key_exists('servicegroups', $routeDenylist)) {
|
2022-06-13 07:35:14 -04:00
|
|
|
$section->add(N_('Service Groups'), [
|
|
|
|
|
'url' => 'icingadb/servicegroups',
|
2021-11-09 07:31:08 -05:00
|
|
|
'priority' => 60,
|
2022-06-13 07:35:14 -04:00
|
|
|
'description' => $this->translate('List service groups'),
|
|
|
|
|
'icon' => 'cogs'
|
2021-10-12 12:35:07 -04:00
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-14 08:41:05 -05:00
|
|
|
if (! array_key_exists('contactgroups', $routeDenylist)) {
|
2025-04-04 09:53:41 -04:00
|
|
|
$section->add(N_('Contact Groups'), [
|
|
|
|
|
'url' => 'icingadb/contactgroups',
|
2021-11-09 07:31:08 -05:00
|
|
|
'priority' => 70,
|
2025-04-04 09:53:41 -04:00
|
|
|
'description' => $this->translate('List contact groups'),
|
2021-11-09 07:31:08 -05:00
|
|
|
'icon' => 'users'
|
2021-10-12 12:35:07 -04:00
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-14 08:41:05 -05:00
|
|
|
if (! array_key_exists('contacts', $routeDenylist)) {
|
2025-04-04 09:09:32 -04:00
|
|
|
$section->add(N_('Contacts'), [
|
|
|
|
|
'url' => 'icingadb/contacts',
|
2021-11-09 07:31:08 -05:00
|
|
|
'priority' => 80,
|
2025-04-04 09:09:32 -04:00
|
|
|
'description' => $this->translate('List contacts'),
|
2022-06-13 07:35:14 -04:00
|
|
|
'icon' => 'user-friends'
|
2021-10-12 12:35:07 -04:00
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-13 07:35:14 -04:00
|
|
|
$section->add(N_('Comments'), [
|
|
|
|
|
'url' => 'icingadb/comments',
|
|
|
|
|
'priority' => 90,
|
|
|
|
|
'description' => $this->translate('List comments'),
|
|
|
|
|
'icon' => 'comments'
|
|
|
|
|
]);
|
|
|
|
|
$section->add(N_('Downtimes'), [
|
|
|
|
|
'url' => 'icingadb/downtimes',
|
|
|
|
|
'priority' => 100,
|
|
|
|
|
'description' => $this->translate('List downtimes'),
|
|
|
|
|
'icon' => 'plug'
|
|
|
|
|
]);
|
|
|
|
|
$section->add(N_('Notifications'), [
|
|
|
|
|
'url' => 'icingadb/notifications',
|
|
|
|
|
'priority' => 110,
|
|
|
|
|
'description' => $this->translate('List notifications'),
|
|
|
|
|
'icon' => 'bell'
|
|
|
|
|
]);
|
2021-10-12 12:35:07 -04:00
|
|
|
$section->add(N_('History'), [
|
2021-11-09 07:31:08 -05:00
|
|
|
'url' => 'icingadb/history',
|
2022-06-13 07:35:14 -04:00
|
|
|
'priority' => 120,
|
2021-11-09 07:31:08 -05:00
|
|
|
'description' => $this->translate('List history'),
|
|
|
|
|
'icon' => 'history'
|
2021-10-12 12:35:07 -04:00
|
|
|
]);
|
2021-04-07 06:34:09 -04:00
|
|
|
}
|
|
|
|
|
|
2019-12-04 04:17:26 -05:00
|
|
|
$this->provideConfigTab('database', [
|
2020-04-24 08:36:37 -04:00
|
|
|
'label' => t('Database'),
|
|
|
|
|
'title' => t('Configure the database backend'),
|
2019-12-04 04:17:26 -05:00
|
|
|
'url' => 'config/database'
|
|
|
|
|
]);
|
2019-12-05 04:06:54 -05:00
|
|
|
$this->provideConfigTab('redis', [
|
2020-04-24 08:36:37 -04:00
|
|
|
'label' => t('Redis'),
|
|
|
|
|
'title' => t('Configure the Redis connections'),
|
2019-12-05 04:06:54 -05:00
|
|
|
'url' => 'config/redis'
|
|
|
|
|
]);
|
2019-12-04 07:14:28 -05:00
|
|
|
$this->provideConfigTab('command-transports', [
|
2020-04-24 08:36:37 -04:00
|
|
|
'label' => t('Command Transports'),
|
|
|
|
|
'title' => t('Configure command transports'),
|
2021-02-08 08:21:57 -05:00
|
|
|
'url' => 'command-transport'
|
2019-12-04 07:14:28 -05:00
|
|
|
]);
|
2019-12-04 04:17:26 -05:00
|
|
|
|
2020-11-24 08:07:39 -05:00
|
|
|
$cssDirectory = $this->getCssDir();
|
|
|
|
|
$cssFiles = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(
|
|
|
|
|
$cssDirectory,
|
|
|
|
|
RecursiveDirectoryIterator::CURRENT_AS_PATHNAME | RecursiveDirectoryIterator::SKIP_DOTS
|
|
|
|
|
));
|
|
|
|
|
foreach ($cssFiles as $path) {
|
|
|
|
|
$this->provideCssFile(ltrim(substr($path, strlen($cssDirectory)), DIRECTORY_SEPARATOR));
|
|
|
|
|
}
|
2019-11-28 09:58:28 -05:00
|
|
|
|
2019-12-16 04:42:30 -05:00
|
|
|
$this->provideJsFile('action-list.js');
|
2019-12-13 10:15:58 -05:00
|
|
|
$this->provideJsFile('loadmore.js');
|
2023-06-21 08:46:21 -04:00
|
|
|
$this->provideJsFile('progress-bar.js');
|
2019-09-09 08:49:46 -04:00
|
|
|
}
|