Hey:
While i using zabbix python api to create host
i meet errors
Traceback (most recent call last):
File "test.py", line 57, in <module>
zapi.host.create({ 'name':'testname', 'host' : '192.168.1.1','ip' : '192.178.1.2','port' : 10050,'useip' : 0,'groups' : [{ "groupid":gid}],'templates' : [{ "templateid":tid}]})
File "/home/zhiguo/zabbix/zabbix_api.py", line 346, in method
return self.universal("%s.%s" % (self.data["prefix"], name), opts[0])
File "/home/zhiguo/zabbix/zabbix_api.py", line 80, in wrapper
return self.do_request(self.json_obj(method, opts))['result']
File "/home/zhiguo/zabbix/zabbix_api.py", line 353, in do_request
return self.parent.do_request(req)
File "/home/zhiguo/zabbix/zabbix_api.py", line 307, in do_request
raise ZabbixAPIException(msg, jobj['error']['code'])
zabbix_api.ZabbixAPIException: (u'Error -32602: Invalid params., No interfaces for host "192.168.1.1". while sending {"params": {"templates": [{"templateid": "10085"}], "name": "testname", "ip": "192.178.1.2", "useip": 0, "host": "192.168.1.1", "groups": [{"groupid": "6"}], "port": 10050}, "jsonrpc": "2.0", "method": "host.create", "auth": "7894f7d64a3f30e1754dd9d2eeb5a493", "id": 4}', -32602)
my python code is
zapi.host.create({ 'name':'testname', 'host' : '192.168.1.1','ip' : '192.178.1.2','port' : 10050,'useip' : 0,'groups' : [{ "groupid":gid}],'templates' : [{ "templateid":tid}]})
please help me to find my fault

Thanks
marsbuck
While i using zabbix python api to create host
i meet errors
Traceback (most recent call last):
File "test.py", line 57, in <module>
zapi.host.create({ 'name':'testname', 'host' : '192.168.1.1','ip' : '192.178.1.2','port' : 10050,'useip' : 0,'groups' : [{ "groupid":gid}],'templates' : [{ "templateid":tid}]})
File "/home/zhiguo/zabbix/zabbix_api.py", line 346, in method
return self.universal("%s.%s" % (self.data["prefix"], name), opts[0])
File "/home/zhiguo/zabbix/zabbix_api.py", line 80, in wrapper
return self.do_request(self.json_obj(method, opts))['result']
File "/home/zhiguo/zabbix/zabbix_api.py", line 353, in do_request
return self.parent.do_request(req)
File "/home/zhiguo/zabbix/zabbix_api.py", line 307, in do_request
raise ZabbixAPIException(msg, jobj['error']['code'])
zabbix_api.ZabbixAPIException: (u'Error -32602: Invalid params., No interfaces for host "192.168.1.1". while sending {"params": {"templates": [{"templateid": "10085"}], "name": "testname", "ip": "192.178.1.2", "useip": 0, "host": "192.168.1.1", "groups": [{"groupid": "6"}], "port": 10050}, "jsonrpc": "2.0", "method": "host.create", "auth": "7894f7d64a3f30e1754dd9d2eeb5a493", "id": 4}', -32602)
my python code is
zapi.host.create({ 'name':'testname', 'host' : '192.168.1.1','ip' : '192.178.1.2','port' : 10050,'useip' : 0,'groups' : [{ "groupid":gid}],'templates' : [{ "templateid":tid}]})
please help me to find my fault

Thanks
marsbuck
is the proble of zabbix api 2.x have changed
Comment