Source
['if' => ['field' => 'history', 'in' => implode(',', [ITEM_VALUE_TYPE_LOG])], 'type' => API_OUTPUT, 'in' => implode(',', ['itemid', 'clock', 'timestamp', 'source', 'severity', 'value', 'logeventid', 'ns'])],
<?php
/*
** Zabbix
** Copyright (C) 2001-2022 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** 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 General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
/**
* Class containing methods for operations with histories.
*/
class CHistory extends CApiService {
public const ACCESS_RULES = [
'get' => ['min_user_type' => USER_TYPE_ZABBIX_USER],
'clear' => ['min_user_type' => USER_TYPE_ZABBIX_ADMIN]
];
protected $tableName;
protected $tableAlias = 'h';
protected $sortColumns = ['itemid', 'clock'];
public function __construct() {
// considering the quirky nature of the history API,
// the parent::__construct() method should not be called.
}
/**
* Get history data.
*
* @param array $options
* @param int $options['history'] History object type to return.
* @param array $options['hostids'] Return only history from the given hosts.
* @param array $options['itemids'] Return only history from the given items.
* @param int $options['time_from'] Return only values that have been received after or at
* the given time.
* @param int $options['time_till'] Return only values that have been received before or at
* the given time.
* @param array $options['filter'] Return only those results that exactly match the given
* filter.
* @param int $options['filter']['itemid']
* @param int $options['filter']['clock']
* @param mixed $options['filter']['value']
* @param int $options['filter']['ns']
* @param array $options['search'] Return results that match the given wildcard search
* (case-insensitive).
* @param string $options['search']['value']
* @param bool $options['searchByAny'] If set to true return results that match any of the
* criteria given in the filter or search parameter instead
* of all of them.