Source
* Creates a list of problematic hosts and unacknowledged problematic hosts for each host group.
<?php declare(strict_types = 0);
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
namespace Widgets\ProblemHosts\Actions;
use API,
CArrayHelper,
CControllerDashboardWidgetView,
CControllerResponseData,
CRoleHelper;
class WidgetView extends CControllerDashboardWidgetView {
protected function doAction(): void {
$data = [
'name' => $this->getInput('name', $this->widget->getDefaultName()),
'error' => null,
'user' => [
'debug_mode' => $this->getDebugMode()
],
'allowed_ui_problems' => $this->checkAccess(CRoleHelper::UI_MONITORING_PROBLEMS)
];
// Editing template dashboard?
if ($this->isTemplateDashboard() && !$this->fields_values['override_hostid']) {
$data['error'] = _('No data.');
}
else {
$filter_groupids = !$this->isTemplateDashboard() && $this->fields_values['groupids']
? getSubGroups($this->fields_values['groupids'])
: null;
if ($this->isTemplateDashboard()) {
$filter_hostids = $this->fields_values['override_hostid'];
}
else {
$filter_hostids = $this->fields_values['hostids'] ?: null;
}
$filter_problem = $this->fields_values['problem'] !== '' ? $this->fields_values['problem'] : null;
$filter_severities = $this->fields_values['severities'] ?: range(TRIGGER_SEVERITY_NOT_CLASSIFIED,
TRIGGER_SEVERITY_COUNT - 1
);
$filter_show_suppressed = $this->fields_values['show_suppressed'];
$filter_ext_ack = $this->fields_values['ext_ack'];
if (!$this->isTemplateDashboard() && $this->fields_values['exclude_groupids']) {
$exclude_groupids = getSubGroups($this->fields_values['exclude_groupids']);
if ($filter_hostids === null) {