[ZBX-6362] Confusing interfaces parameter for proxy.create and proxy.update Created: 2013 Mar 07  Updated: 2017 May 30  Resolved: 2013 Oct 21

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: API (A)
Affects Version/s: 2.1.0
Fix Version/s: 2.1.0, 2.1.8

Type: Incident report Priority: Minor
Reporter: Pavels Jelisejevs (Inactive) Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: api, proxy
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

The fact that the parameter name is plural and it accepts an array of objects may trick someone into believing that a proxy can have multiple interfaces. The parameter should be called "interface" and it should accept a single interface object. Keep in mind, that the "interfaces" parameter must still be supported for backward compatibility.

Proxy create must look like:
{
"host": "bbb",
"status": 6,
"hosts": {},
"interface":

{ "hostid": 10164, "ip": "127.0.0.10", "dns": "localhost", "useip": 1, "port": "10051" }

}

Proxy update must look like:
{
"host": "aaa",
"status": 6,
"hosts": {},
"interface":

{ "interfaceid": 56, "hostid": 10164, "ip": "127.0.0.10", "dns": "localhost", "useip": 1, "port": "10051" }

,
"proxyid": 10164
}



 Comments   
Comment by Eduards Samersovs (Inactive) [ 2013 Jun 27 ]

Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-6362

Comment by Toms (Inactive) [ 2013 Jun 28 ]

(1) CProxy.php from line:577

mapOne() should be used instead of mapMany() and extra loop unnecessary.

Eduards RESOLVED r.36603

oleg.egorov CLOSED

Comment by Toms (Inactive) [ 2013 Jun 28 ]

(2) CProxy.php should be singular:
line:318 $interfaces and $interfaceIds

$interfaces = API::HostInterface()->get(array(
	'output' => API_OUTPUT_REFER,
	'hostids' => $proxy['hostid']
));
$interfaceIds = zbx_objectValues($interfaces, 'interfaceid');

if ($interfaceIds) {
	API::HostInterface()->delete($interfaceIds);
}

Eduards RESOLVED r.36603

oleg.egorov CLOSED

Comment by Toms (Inactive) [ 2013 Jun 28 ]

(3) administration.proxy.edit.php should be singular
line: 52

$interfaceTable = new CTable(_('No interfaces defined.'), 'formElementTable');

Eduards RESOLVED r.36603

oleg.egorov CLOSED

Comment by Toms (Inactive) [ 2013 Jun 28 ]

(4) When creating proxy with interface missing port:
"Warning. Incorrect value for field "interface": cannot be empty."
is shown, should be:
"Port cannot be empty for host interface."

Eduards RESOLVED r.36603 Valid error message is "IP and DNS cannot be empty for host interface." which come from CHostInterface.php:345 API

oleg.egorov CLOSED

Comment by Toms (Inactive) [ 2013 Jun 28 ]

(5) unable to change proxy mode to "Active"
'No interface for proxy "asd".' error shown

Eduards RESOLVED r.36631

oleg.egorov CLOSED

Comment by Toms (Inactive) [ 2013 Jun 28 ]

(6)? backward compatibility not implemented. Should be discussed if it is necessary as the API call output format changes anyway so breaking any usage of this API.

Eduards RESOLVED r.36643

oleg.egorov CLOSED

Comment by Toms (Inactive) [ 2013 Jun 28 ]

(7) unable to update proxy with given proxy update call.
response:'{"jsonrpc":"2.0","error":

{"code":-32602,"message":"Invalid params.","data":"No permissions to referred object or it does not exist!"}

,"id":12}'

looks like Interface API call do not find stored interface.

Eduards RESOLVED r.36631

oleg.egorov CLOSED

Comment by Oleg Egorov (Inactive) [ 2013 Jul 03 ]

(8) proxies.php:166-169

elseif ($_REQUEST['go'] == 'delete' && isset($_REQUEST['hosts'])) {
	DBstart();

	$goResult = API::Proxy()->delete(get_request('hosts', array()));

isset($_REQUEST['hosts']) and get_request('hosts', array());

array() - will be never executed

Eduards RESOLVED r.36700

oleg.egorov CLOSED

Comment by Oleg Egorov (Inactive) [ 2013 Jul 03 ]

(9) Error msg: Incorrect IP for passive proxy "".
Miss "Interface"

Eduards RESOLVED r.36700

oleg.egorov CLOSED

Comment by Oleg Egorov (Inactive) [ 2013 Jul 03 ]

(10) Impossible remove hosts from "Proxy hosts"

Eduards RESOLVED r.36700

oleg.egorov CLOSED

Comment by Oleg Egorov (Inactive) [ 2013 Jul 04 ]

TESTED

Comment by Eduards Samersovs (Inactive) [ 2013 Jul 04 ]

Fixed in versions pre-2.1.0 (beta) r.36718

Comment by Pavels Jelisejevs (Inactive) [ 2013 Oct 16 ]

(11) There's a problem I've missed. The selectInterfaces parameter must work as it did before: return the result as an array under the "interfaces" property, not "interface".

Eduards RESOLVED in svn://svn.zabbix.com/branches/dev/ZBX-6362

jelisejev There's an undefined index on the proxy configuration page.

Eduards RESOLVED r.39439

jelisejev CLOSED.

Comment by Pavels Jelisejevs (Inactive) [ 2013 Oct 16 ]

(12) Also this change was not described in the API docs. I've added it to:

Eduards CLOSED

Comment by Eduards Samersovs (Inactive) [ 2013 Oct 18 ]

Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-6362

Comment by Pavels Jelisejevs (Inactive) [ 2013 Oct 21 ]

TESTED.

Comment by Eduards Samersovs (Inactive) [ 2013 Oct 21 ]

Fixed in versions pre-2.1.8 (trunk) r.39446

Generated at Wed Jul 16 11:06:03 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.