Source
xxxxxxxxxx
$this->waitForLogLineToBePresent(self::COMPONENT_SERVER, 'sending configuration data to proxy "Proxy"', true, 90, 1);
<?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__).'/../include/CIntegrationTest.php';
/**
* Test suite for action notifications
*
* @required-components server
* @configurationDataProvider defaultConfigurationProvider
* @backup items,hosts,proxy,history_text
* @hosts test_actions
*/
class testItemTimeouts extends CIntegrationTest {
const HOSTNAME_AGENT = "agent_host_timeouts";
const HOSTNAME_AGENT2 = "agent2_host_timeouts";
const HOSTNAME_SNMP = "snmp_host_timeouts";
const HOSTNAME_SSH = "ssh_host_timeouts";
const HOSTNAME_SIMPLE = "simple_host_timeouts";
private static $hostids;
private static $itemids;
/**
* @inheritdoc
*/
public function prepareData() {
// Create host "test_host"
$response = $this->call('host.create', [
[
'host' => self::HOSTNAME_AGENT,
'interfaces' => [
'type' => 1,
'main' => 1,
'useip' => 1,
'ip' => '127.0.0.1',
'dns' => '',
'port' => $this->getConfigurationValue(self::COMPONENT_AGENT, 'ListenPort')
],
'groups' => [['groupid' => 4]],
'status' => HOST_STATUS_MONITORED
],
[
'host' => self::HOSTNAME_AGENT2,
'interfaces' => [
'type' => 1,
'main' => 1,
'useip' => 1,
'ip' => '127.0.0.1',
'dns' => '',
'port' => $this->getConfigurationValue(self::COMPONENT_AGENT2, 'ListenPort')
],
'groups' => [['groupid' => 4]],
'status' => HOST_STATUS_MONITORED
]
]);
$this->assertArrayHasKey('hostids', $response['result']);
$this->assertArrayHasKey(0, $response['result']['hostids']);
self::$hostids[self::HOSTNAME_AGENT] = $response['result']['hostids'][0];
self::$hostids[self::HOSTNAME_AGENT2] = $response['result']['hostids'][1];
// Get host interface ids.
$response = $this->call('host.get', [
'output' => ['host'],
'hostids' => [
self::$hostids[self::HOSTNAME_AGENT],
self::$hostids[self::HOSTNAME_AGENT2]
],
'selectInterfaces' => ['interfaceid'],
'sortfield' => 'hostid'
]);
$this->assertArrayHasKey(0, $response['result']);
$this->assertArrayHasKey('interfaces', $response['result'][0]);
$this->assertTrue(count($response['result']) == 2);
$agent_interfaceid = $response['result'][0]['interfaces'][0]['interfaceid'];
$agent2_interfaceid = $response['result'][1]['interfaces'][0]['interfaceid'];