Hi,
We just upgraded from zabbix 3.2 to 3.4.11. We are using the same code to import images from a XML file. I only changed the version number in the XML file to be 3.4:
<version>3.4</version>
I put lots of messages to print request, dump, response. Here is the request (python):
with open('/etc/images.xml','r') as myfile:
data = myfile.read().replace('\n',' ').replace('\r',' ')
req = {"jsonrpc":"2.0","method":"configuration.import "," id":1,"auth":auth,"params":{"format":"xml","rule s" :{"images":{"createMissing":True,"updateExisting ": True}},"source":data}}
dump = json.dumps(req)
--- When I print the value of dump I see my XML into the "dump" string, all in 1 line but with 8 <image> nodes; it is supposed to create 8 images in the "images" table.
request = urllib2.Request('http://localhost/zabbix/api_jsonrpc.php',dump,{'Content-Type': 'application/json'})
response = urllib2.urlopen(request)
res = json.load(response)
--- when I print the value of res I get: {u'jsonrpc': u'2.0', u'result': True, u'id':1}
Both the req and res look correct to me according to https://www.zabbix.com/documentation...uration/import
However, the zabbix images table stays empty. If I manually add data to this table, then run the code above again, the images table gets truncated, no data.
Any ideas why? Please I've been dealing with this issue since last week and I do not know how to solve it.
I used the same code with Zabbix API 3.2 and it worked perfectly.
Also note that I am able to create/load these images into the "images" table using psql: \copy images FROM '/etc/images.csv' delimiter ',' csv
where I created the csv file from the zabbix 3.2 website when exporting a map.
Your help with this issue will be very appreciated!
We just upgraded from zabbix 3.2 to 3.4.11. We are using the same code to import images from a XML file. I only changed the version number in the XML file to be 3.4:
<version>3.4</version>
I put lots of messages to print request, dump, response. Here is the request (python):
with open('/etc/images.xml','r') as myfile:
data = myfile.read().replace('\n',' ').replace('\r',' ')
req = {"jsonrpc":"2.0","method":"configuration.import "," id":1,"auth":auth,"params":{"format":"xml","rule s" :{"images":{"createMissing":True,"updateExisting ": True}},"source":data}}
dump = json.dumps(req)
--- When I print the value of dump I see my XML into the "dump" string, all in 1 line but with 8 <image> nodes; it is supposed to create 8 images in the "images" table.
request = urllib2.Request('http://localhost/zabbix/api_jsonrpc.php',dump,{'Content-Type': 'application/json'})
response = urllib2.urlopen(request)
res = json.load(response)
--- when I print the value of res I get: {u'jsonrpc': u'2.0', u'result': True, u'id':1}
Both the req and res look correct to me according to https://www.zabbix.com/documentation...uration/import
However, the zabbix images table stays empty. If I manually add data to this table, then run the code above again, the images table gets truncated, no data.
Any ideas why? Please I've been dealing with this issue since last week and I do not know how to solve it.
I used the same code with Zabbix API 3.2 and it worked perfectly.
Also note that I am able to create/load these images into the "images" table using psql: \copy images FROM '/etc/images.csv' delimiter ',' csv
where I created the csv file from the zabbix 3.2 website when exporting a map.
Your help with this issue will be very appreciated!
Comment