[ZBX-3551] image export to xml broken with postgresql Created: 2011 Feb 21  Updated: 2017 May 30  Resolved: 2011 Nov 03

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 1.8.8, 1.9.1 (alpha), 1.9.6 (beta)
Fix Version/s: 2.0.0

Type: Incident report Priority: Blocker
Reporter: Sergey Syreskin Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: maps, xml
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Centos 5.5 + PostgreSQL 8.4


Attachments: XML File zbx_maps_export.xml     XML File zbx_maps_export.xml    

 Description   

Error while trying to import a network map in 1.9.2 that was previously exported from Zabbix 1.8.5. Frontend error output:

  1. pg_query() [<a href='function.pg-query'>function.pg-query</a>]: Query failed: ??????: ??????? ??? ?????????? ? ??????? "sysmaps_links" ???????? ??????????? ???????? ????? "c_sysmaps_links_2" ????????: ???? (selementid1)=(50) ??????????? ? ??????? "sysmaps_elements".[/usr/share/zabbix/include/db.inc.php:519]
  2. Error in query [INSERT INTO sysmaps_links (linkid,sysmapid,label,selementid1,selementid2,drawtype,color) VALUES (2,5,'',50,10,0,'0000CC')] [??????: ??????? ??? ?????????? ? ??????? "sysmaps_links" ???????? ??????????? ???????? ????? "c_sysmaps_links_2" ????????: ???? (selementid1)=(50) ??????????? ? ??????? "sysmaps_elements".]
    #
  3. pg_query() [<a href='function.pg-query'>function.pg-query</a>]: Query failed: ??????: ??????? ?????????? ????????, ??????? ?? ????? ????? ?????????? ????????????[/usr/share/zabbix/include/db.inc.php:441]
  4. Error in query [SELECT u.userid, u.autologout FROM sessions s, users u WHERE s.sessionid='dff570ea735a5d90a6617870a90665e1' AND s.status=0 AND s.userid=u.userid AND ((s.lastaccess+u.autologout>1298292471) OR (u.autologout=0)) AND ((u.userid BETWEEN 000000000000000 AND 099999999999999))] [??????: ??????? ?????????? ????????, ??????? ?? ????? ????? ?????????? ????????????]
  5. pg_fetch_assoc() expects parameter 1 to be resource, boolean given[/usr/share/zabbix/include/db.inc.php:594]
  6. pg_free_result(): supplied argument is not a valid PostgreSQL result resource[/usr/share/zabbix/include/db.inc.php:596]
  7. pg_query() [<a href='function.pg-query'>function.pg-query</a>]: Query failed: ??????: ??????? ?????????? ????????, ??????? ?? ????? ????? ?????????? ????????????[/usr/share/zabbix/include/db.inc.php:519]
  8. Error in query [INSERT INTO sysmaps_links (linkid,sysmapid,label,selementid1,selementid2,drawtype,color) VALUES (0,5,'',51,10,0,'0000CC')] [??????: ??????? ?????????? ????????, ??????? ?? ????? ????? ?????????? ????????????]


 Comments   
Comment by Alexey Fukalov [ 2011 Oct 03 ]

Could you please try to reproduce this error in latest trunk. If it still there, please add more description about map which is imported.

Comment by Alexey Fukalov [ 2011 Oct 11 ]

If error is reproduced again, please reopen this issue.

Comment by Sergey Syreskin [ 2011 Oct 13 ]

I have exported a map from 1.8.9rc1.x-22144 and then imported it to 1.9.7.x-22144. When I try to open the imported map, I get JavaScript message window with an error "Map image update failed". I think the problem is in incorrect importing of map icons.

Now for how I created the map: Configuration->Network Maps->Create->enter name "Test map">Save>open "Test map" for editing->press "+" icon->Save, that's all.

Comment by richlv [ 2011 Oct 13 ]

can you attach the map xml for testing ?

Comment by Sergey Syreskin [ 2011 Oct 13 ]

Added map xml.

Comment by Sergey Syreskin [ 2011 Oct 13 ]

I have just noticed that map exported from 1.8.9 is incorrectly imported on the same version 1.8.9.

Comment by richlv [ 2011 Oct 17 ]

this is caused by the image in the xml. the thing in there isn't a proper png for some reason (both imported & base64-decoded versions fail to load)

Comment by richlv [ 2011 Oct 17 ]

ok, so looks like image export with pgsql is broken (works fine with mysql).

with mysql we get proper binary data, with pgsql - "\211PNG\015\012\032\012\000\000\000" ...

Comment by Sergey Syreskin [ 2011 Oct 18 ]

It certainly worked earlier, in 1.8.3 or something.

Comment by richlv [ 2011 Oct 18 ]

hmm. would it be possible for you to set up 1.8.3 frontend in parallel against the same database and try exporting then ? for me, unless i messed up, export is still broken....

Comment by Sergey Syreskin [ 2011 Oct 18 ]

1.8.3 but another database setup.

Comment by Sergey Syreskin [ 2011 Oct 18 ]

I have just noticed, that in 1.8.3 in the import form all checkboxes are unchecked by default, while in 1.8.9 all of them are checked. When I check all checkboxes in "Add missing" column, map export-import goes all right, but when I also check all checkboxes in "Update existing" column, map icons get corrupted after import.

Comment by richlv [ 2011 Oct 18 ]

ok, so it is broken for you with 1.8.3 as well, you just didn't notice because you did not import new images or override old ones before

Comment by Sergey Syreskin [ 2011 Oct 18 ]

The same is true for 1.8.9. To sum up, map icons become corrupt only when the "Icon" checkbox in the first ("Update existing") column is checked in the map import form.

Comment by Sergey Syreskin [ 2011 Oct 18 ]

Yes, it is broken in 1.8.3 as well.

Comment by Pavels Jelisejevs (Inactive) [ 2011 Nov 02 ]

RESOLVED.

Comment by Sergey Syreskin [ 2011 Nov 02 ]

Thanks, guys!

Comment by Alexey Fukalov [ 2011 Nov 03 ]

(1) [GUI]
When try to import map with image got error:
pg_query(): Query failed: ERROR: invalid byte sequence for encoding "UTF8": 0x89 HINT: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding". [include/db.inc.php:525]
Error in query [INSERT INTO images (imageid, name, imagetype, image) VALUES (1, 'bnm', 1, '�PNG  ')] [ERROR: invalid byte sequence for encoding "UTF8": 0x89 HINT: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding".]
DBerror
Cannot add image

Fixed map export in 1.8. RESOLVED.

<Vedmak> i moved unescape to api review please

Comment by Igor Danoshaites (Inactive) [ 2011 Nov 10 ]

<igor> When using this ZBX-3551 dev branch with 1.8 PG DB:

(2) Can not add elements to the map, after clicking on the "+" icon element selection form does not appear and map disappear from the screen

(3) After importing map with background image inside it, appears the following error:

Undefined index: images [include\export.inc.php:573]
Invalid argument supplied for foreach() [include\export.inc.php:576]
Map [ZBX_PGDB_18] added

But appropriate map with background image inside it has been created.

<igor> Yes, you are right, image "Hub" was broken. Now all is fine. CLOSED.

Comment by Pavels Jelisejevs (Inactive) [ 2011 Nov 11 ]

Merged to /branches/1.8 revision 23115. CLOSED.

Generated at Wed Apr 24 17:48:17 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.