-
Problem report
-
Resolution: Unresolved
-
Trivial
-
None
-
4.2.1
-
None
Steps to reproduce:
- Create host in 4.0.5 with default JMX and Agent interfaces
- Use the API to hostinterface.get and note that the JMX interface main = 0
- Upgrade to 4.2.1
- Use the API to hostinterface.update the Agent interface only
- Use the API to hostinterface.get for the host and confirm main = 0
- Create a new host with default JMX and Agent interfaces
- Use the API to hostinterface.get and note that the JMX interface main = 0
Result:
Seems that previous versions of Zabbix did not correctly set the JMX interface as a default in the DB when creating it.
It appears the overall result is minimal until you try to do a hostinterface.update, and the API complains that there is no default JMX interface (though the GUI shows the check mark next to the interface, the 4.0.5 API does not).
Workaround seems to be to change set main = 1 for the JMX interface on the host to satisfy that requirement and allow the original hostinterface.update to proceed.
Query the API for an existing host with a JMX interface under 4.0.5:
20: Sending: {"params": {"output": "extend", "hostids": [10107]}, "jsonrpc": "2.0", "method": "hostinterface.get", "auth": "47203e88d431af39eaaa4415cf5ba91b", "id": 1} 10: Sending headers: {'Content-Type': 'application/json-rpc', 'User-Agent': 'python/zabbix_api'} 20: Response Code: 200 10: Response Body: {u'jsonrpc': u'2.0', u'result': [{u'interfaceid': u'3', u'hostid': u'10107', u'ip': u'10.61.3.28', u'useip': u'0', u'bulk': u'1', u'dns': u'gamesite01-rh.g-tr2.oanda.com', u'main': u'1', u'type': u'1', u'port': u'10050'}, {u'interfaceid': u'211', u'hostid': u'10107', u'ip': u'', u'useip': u'0', u'bulk': u'1', u'dns': u'gamesite01-rh.g-tr2.oanda.com', u'main': u'0', u'type': u'4', u'port': u'9011'}], u'id': 1} [{u'bulk': u'1', u'dns': u'gamesite01-rh.g-tr2.oanda.com', u'hostid': u'10107', u'interfaceid': u'3', u'ip': u'10.61.3.28', u'main': u'1', u'port': u'10050', u'type': u'1', u'useip': u'0'}, {u'bulk': u'1', u'dns': u'gamesite01-rh.g-tr2.oanda.com', u'hostid': u'10107', u'interfaceid': u'211', u'ip': u'', u'main': u'0', u'port': u'9011', u'type': u'4', u'useip': u'0'}]
Query the API for an existing host with a JMX interface after upgrading from 4.0.5 to 4.2.1:
20: Sending: {"params": {"output": "extend", "hostids": [11272]}, "jsonrpc": "2.0", "method": "hostinterface.get", "auth": "e401ad1f7b115b93a225e31d86617d99", "id": 1} 10: Sending headers: {'Content-Type': 'application/json-rpc', 'User-Agent': 'python/zabbix_api'} 20: Response Code: 200 10: Response Body: {u'jsonrpc': u'2.0', u'result': [{u'interfaceid': u'413', u'hostid': u'11272', u'ip': u'172.20.11.51', u'useip': u'0', u'bulk': u'1', u'dns': u'zookeeper01-uat.ri.oanda.com', u'main': u'1', u'type': u'1', u'port': u'10050'}, {u'interfaceid': u'416', u'hostid': u'11272', u'ip': u'', u'useip': u'0', u'bulk': u'1', u'dns': u'zookeeper01-uat.ri.oanda.com', u'main': u'0', u'type': u'4', u'port': u'9011'}], u'id': 1} [{u'bulk': u'1', u'dns': u'zookeeper01-uat.ri.oanda.com', u'hostid': u'11272', u'interfaceid': u'413', u'ip': u'172.20.11.51', u'main': u'1', u'port': u'10050', u'type': u'1', u'useip': u'0'}, {u'bulk': u'1', u'dns': u'zookeeper01-uat.ri.oanda.com', u'hostid': u'11272', u'interfaceid': u'416', u'ip': u'', u'main': u'0', u'port': u'9011', u'type': u'4', u'useip': u'0'}]
Attempt to query then update the existing host under 4.2.1:
20: Sending: {"params": {"output": "extend", "hostids": [11272]}, "jsonrpc": "2.0", "method": "hostinterface.get", "auth": "07671e2890129aebe5d1df2dd2ae6211", "id": 1} 10: Sending headers: {'Content-Type': 'application/json-rpc', 'User-Agent': 'python/zabbix_api'} 20: Response Code: 200 10: Response Body: {u'jsonrpc': u'2.0', u'result': [{u'interfaceid': u'413', u'hostid': u'11272', u'ip': u'172.20.11.51', u'useip': u'0', u'bulk': u'1', u'dns': u'zookeeper01-uat.ri.oanda.com', u'main': u'1', u'type': u'1', u'port': u'10050'}, {u'interfaceid': u'416', u'hostid': u'11272', u'ip': u'', u'useip': u'0', u'bulk': u'1', u'dns': u'zookeeper01-uat.ri.oanda.com', u'main': u'0', u'type': u'4', u'port': u'9011'}], u'id': 1} [{u'bulk': u'1', u'dns': u'zookeeper01-uat.ri.oanda.com', u'hostid': u'11272', u'interfaceid': u'413', u'ip': u'172.20.11.51', u'main': u'1', u'port': u'10050', u'type': u'1', u'useip': u'0'}, {u'bulk': u'1', u'dns': u'zookeeper01-uat.ri.oanda.com', u'hostid': u'11272', u'interfaceid': u'416', u'ip': u'', u'main': u'0', u'port': u'9011', u'type': u'4', u'useip': u'0'}] 10: json_obj: {'params': {'interfaceid': '413', 'dns': 'zookeeper01-uat.ri.oanda.com'}, 'jsonrpc': '2.0', 'method': 'hostinterface.update', 'auth': u'07671e2890129aebe5d1df2dd2ae6211', 'id': 2} 20: Sending: {"params": {"interfaceid": "413", "dns": "zookeeper01-uat.ri.oanda.com"}, "jsonrpc": "2.0", "method": "hostinterface.update", "auth": "07671e2890129aebe5d1df2dd2ae6211", "id": 2} 10: Sending headers: {'Content-Type': 'application/json-rpc', 'User-Agent': 'python/zabbix_api'} 20: Response Code: 200 10: Response Body: {u'jsonrpc': u'2.0', u'id': 2, u'error': {u'message': u'Invalid params.', u'code': -32602, u'data': u'No default interface for "JMX" type on "zookeeper01-uat.ri.oanda.com".'}} Traceback (most recent call last): File "./zabbix-interface-update.py", line 24, in <module> "dns": "zookeeper01-uat.ri.oanda.com", File "/home/dangelovich/pythons/zabbix-api/lib/python2.7/site-packages/zabbix_api.py", line 314, in method return self.universal("%s.%s" % (self.data["prefix"], name), opts[0]) File "/home/dangelovich/pythons/zabbix-api/lib/python2.7/site-packages/zabbix_api.py", line 71, in wrapper return self.do_request(self.json_obj(method, opts))['result'] File "/home/dangelovich/pythons/zabbix-api/lib/python2.7/site-packages/zabbix_api.py", line 321, in do_request return self.parent.do_request(req) File "/home/dangelovich/pythons/zabbix-api/lib/python2.7/site-packages/zabbix_api.py", line 272, in do_request raise ZabbixAPIException(msg, jobj['error']['code']) zabbix_api.ZabbixAPIException: (u'Error -32602: Invalid params., No default interface for "JMX" type on "zookeeper01-uat.ri.oanda.com". while sending {"params": {"interfaceid": "413", "dns": "zookeeper01-uat.ri.oanda.com"}, "jsonrpc": "2.0", "method": "hostinterface.update", "auth": "07671e2890129aebe5d1df2dd2ae6211", "id": 2}', -32602)
Query of a new host created under 4.2.1:
20: Sending: {"params": {"output": "extend", "hostids": [11357]}, "jsonrpc": "2.0", "method": "hostinterface.get", "auth": "ab6e237f64ff5ff18a343023d1a77fa0", "id": 1} 10: Sending headers: {'Content-Type': 'application/json-rpc', 'User-Agent': 'python/zabbix_api'} 20: Response Code: 200 10: Response Body: {u'jsonrpc': u'2.0', u'result': [{u'interfaceid': u'469', u'hostid': u'11357', u'ip': u'127.0.0.1', u'useip': u'1', u'bulk': u'1', u'dns': u'', u'main': u'1', u'type': u'1', u'port': u'10050'}, {u'interfaceid': u'470', u'hostid': u'11357', u'ip': u'127.0.0.1', u'useip': u'1', u'bulk': u'1', u'dns': u'', u'main': u'1', u'type': u'4', u'port': u'12345'}], u'id': 1} [{u'bulk': u'1', u'dns': u'', u'hostid': u'11357', u'interfaceid': u'469', u'ip': u'127.0.0.1', u'main': u'1', u'port': u'10050', u'type': u'1', u'useip': u'1'}, {u'bulk': u'1', u'dns': u'', u'hostid': u'11357', u'interfaceid': u'470', u'ip': u'127.0.0.1', u'main': u'1', u'port': u'12345', u'type': u'4', u'useip': u'1'}]
See screenshot...
See log file...
See memory dump...
Expected:
See screenshot....
See attached patch file...