Source
'url' => 'http://localhost:9090/api/v1/query?query=irate(node_network_transmit_bytes_total\{device!="lo",instance="192.168.150.101"}[1m])',
<?php
/*
** Copyright (C) 2001-2024 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__).'/../../include/CLegacyWebTest.php';
require_once dirname(__FILE__).'/../behaviors/CMessageBehavior.php';
use Facebook\WebDriver\WebDriverBy;
/**
* @onBefore prepareHTTPItemData
*
* @backup items
*/
class testFormItemHttpAgent extends CLegacyWebTest {
/**
* Attach MessageBehavior to the test.
*/
public function getBehaviors() {
return [CMessageBehavior::class];
}
protected static $hostid;
public function prepareHTTPItemData() {
$result = CDataHelper::createHosts([
[
'host' => 'Host with HTTP items',
'groups' => ['groupid' => 4], // Zabbix servers.
'items' => [
[
'name' => 'Http agent item form',
'key_' => 'http-item-form',
'type' => ITEM_TYPE_HTTPAGENT,
'value_type' => ITEM_VALUE_TYPE_FLOAT,
'url' => 'zabbix.com',
'query_fields' => [['name' => 'user', 'value' => 'admin']],
'headers' => [['name' => 'Content-Type', 'value' => 'text/plain']],
'delay' => 30,
'description' => '{$_} {$NONEXISTING}'
],
[
'name' => 'Http agent item for delete',
'key_' => 'http-item-delete',
'type' => ITEM_TYPE_HTTPAGENT,
'value_type' => ITEM_VALUE_TYPE_FLOAT,
'url' => 'zabbix.com',
'delay' => 30
],
[