Source
<?php
/*
** 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/>.
**/
require_once dirname(__FILE__).'/graphs.inc.php';
require_once dirname(__FILE__).'/maps.inc.php';
require_once dirname(__FILE__).'/users.inc.php';
/**
* @param array $filter
* @param array $filter['groupids'] (optional)
* @param array $filter['exclude_groupids'] (optional)
* @param array $filter['hostids'] (optional)
* @param string $filter['problem'] (optional)
* @param array $filter['severities'] (optional)
* @param int $filter['show_suppressed'] (optional)
* @param int $filter['hide_empty_groups'] (optional)
* @param int $filter['ext_ack'] (optional)
* @param int $filter['show_opdata'] (optional)
*
* @return array
*/
function getSystemStatusData(array $filter) {
$filter_groupids = (array_key_exists('groupids', $filter) && $filter['groupids']) ? $filter['groupids'] : null;
$filter_hostids = (array_key_exists('hostids', $filter) && $filter['hostids']) ? $filter['hostids'] : null;
$filter_severities = (array_key_exists('severities', $filter) && $filter['severities'])
? $filter['severities']
: range(TRIGGER_SEVERITY_NOT_CLASSIFIED, TRIGGER_SEVERITY_COUNT - 1);
$filter_ext_ack = array_key_exists('ext_ack', $filter)
? $filter['ext_ack']
: EXTACK_OPTION_ALL;
$filter_evaltype = array_key_exists('evaltype', $filter) ? $filter['evaltype'] : TAG_EVAL_TYPE_AND_OR;
$filter_tags = array_key_exists('tags', $filter) && $filter['tags'] ? $filter['tags'] : null;
$show_opdata = array_key_exists('show_opdata', $filter) && $filter['show_opdata'] != OPERATIONAL_DATA_SHOW_NONE;
if (array_key_exists('exclude_groupids', $filter) && $filter['exclude_groupids']) {
if ($filter_hostids === null) {
// Get all groups if no selected groups defined.
if ($filter_groupids === null) {
$filter_groupids = array_keys(API::HostGroup()->get([
'output' => [],
'with_hosts' => true,
'preservekeys' => true
]));
}
$filter_groupids = array_diff($filter_groupids, $filter['exclude_groupids']);
// Get available hosts.
$filter_hostids = array_keys(API::Host()->get([
'output' => [],