Ad Widget
Collapse
can't create image in 1.8
Collapse
X
-
Looks like problem is somewhere in database, server's log is full of messages like:
Recreating database solves the problem with images, but I'm unable to import old xml with hosts and templatesCode:zabbix:/var/log/zabbix-server# tail zabbix_server.log 20712:20091211:120130.376 [Z3005] Query failed: [1146] Table 'zabbix.hosts' doesn't exist [select distinct i.itemid,i.key_,h.host,h.port,i.delay,i.description,i.type,h.useip,h.ip,i.history,i.lastvalue,i.prevvalue,i.hostid,i.value_type,i.delta,i.prevorgvalue,i.lastclock,i.units,i.multiplier,i.formula,i.status,i.valuemapid,h.dns,i.trends,i.lastlogsize,i.data_type,i.mtime from hosts h,items i, functions f where h.hostid=i.hostid and h.status=0 and i.status=0 and f.function in ('nodata','date','dayofweek','time','now') and i.itemid=f.itemid and (h.maintenance_status=0 or h.maintenance_type=0) and h.hostid between 000000000000000 and 099999999999999]
Comment
-
Looks like problem is somewhere in database, server's log is full of messages like:
Recreating database solves the problem with images, but I'm unable to import old xml with hosts and templatesCode:zabbix:/var/log/zabbix-server# tail zabbix_server.log 20712:20091211:120130.376 [Z3005] Query failed: [1146] Table 'zabbix.hosts' doesn't exist [select distinct i.itemid,i.key_,h.host,h.port,i.delay,i.description,i.type,h.useip,h.ip,i.history,i.lastvalue,i.prevvalue,i.hostid,i.value_type,i.delta,i.prevorgvalue,i.lastclock,i.units,i.multiplier,i.formula,i.status,i.valuemapid,h.dns,i.trends,i.lastlogsize,i.data_type,i.mtime from hosts h,items i, functions f where h.hostid=i.hostid and h.status=0 and i.status=0 and f.function in ('nodata','date','dayofweek','time','now') and i.itemid=f.itemid and (h.maintenance_status=0 or h.maintenance_type=0) and h.hostid between 000000000000000 and 099999999999999]
I have no such errors in my logs.Comment
-
No change for me. Always the same problem.Comment
-
Hi,
This zabbix version is handsome!!! My MySQL Database load down much with this new version!! Congratulations for all!!
I have this same problem. I upgrade from 1.6.6 for 1.8 with instructions from de zabbix manual ( backup, drop indexes... ) but a can't upload any image.
Thank'sComment
-
Solution also didn't work for me.Comment
-
change line 102 in include/images.inc.php to:
' VALUES ('.$imageid.','.zbx_dbstr($name).','.$imagetype.', 0x'.bin2hex($image).')');
Change line 163 to:
$sql='UPDATE images SET name='.zbx_dbstr($name).',imagetype='.zbx_dbstr($i magetype).',image='.'0x'.bin2hex($image).Comment
-
We are having the same issue where images are not getting saved to the BLOB field in the images table. The hack below works but sometimes causes issues with some PNG icon images where they do not show up when you have a background image. If we import the same png icon in older versions of Zabbix and then use the 1.8 GUI everything works fine.
Is bin2hex a supported solution?
https://support.zabbix.com/browse/ZBX-1494
change line 102 in include/images.inc.php to:
' VALUES ('.$imageid.','.zbx_dbstr($name).','.$imagetype.', 0x'.bin2hex($image).')');
Change line 163 to:
$sql='UPDATE images SET name='.zbx_dbstr($name).',imagetype='.zbx_dbstr($i magetype).',image='.'0x'.bin2hex($image).Comment
-
Comment
-
Using bin2hex causes some png images not to display correctly when you have a background image. The png images are getting placed behind the background.Comment
-
this is indeed an important problem, but there are some issues with it.
1. developers can't reproduce it;
2. according to the debugging output posted on the issue, zabbix frontend is sending a correct request to the db to store the image... and receiving incorrect data back later.
maybe somebody is interested enough to find exact revision where it started to have problems for them ?Comment
-
Problem Solved
Problem Solved
In Summary:
This problem of storing images is not a Zabbix code problem, but how the database default character set is setup on the Zabbix database and the image table.
This fixed my issue:
How Resolution was determined:Code:USE zabbix; ALTER DATABASE zabbix charset=utf8; ALTER TABLE images charset=utf8;
After looking at HEX dumps on the blob column of the images, I was able to figure out what was going on between the previous versions of Zabbix and the current version.
Current version of Zabbix sets the characters sets for SQL queries to UTF8
Time:0.000779 SQL: SET NAMES utf8
Time:0.000552 SQL: SET CHARACTER SET utf8
while older versions did not. Which makes sense since 1.8 is utf8 aware now.
If UTF8 default character set is not set for the database and the image table, hex 3F is stored because of an invalid translation between the client and the SQL server. Comparing a good image save and a bad one, I could see a lot of 3F hex codes when viewing the blob field.
In the Zabbix documentation it tells us to create the database so it supports UTF8. I think the issue is that people running previous versions did not change the default character set of the database to UTF8. I found that changing the table "images" to UTF8 character set alone was not good enough but you also have to change the default character set of the database itself. Maybe a MySQL UTF8 check can be done on the config screen where the php version, GD version, etc is checked? Just a thought. :-)Code:Determine the hexadecimal value of the character or characters that are not being displayed correctly. You can obtain this information for a column column_name in the table table_name using the following query: SELECT HEX(column_name) FROM table_name; 3F is the encoding for the ? character; this means that ? is the character actually stored in the column. This most often happens because of a problem converting a particular character from your client character set to the target character set.
This MySQL setup will have problems storing images correctly into MySQL:
This setup will work and will store images correctly into MySQL:Code:[FONT=Courier New]mysql> SHOW VARIABLES LIKE 'char%'; +--------------------------+--------------------------------+ | Variable_name | Value | +--------------------------+--------------------------------+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | latin1 | | character_set_filesystem | binary | | character_set_results | utf8 | | character_set_server | latin1 | | character_set_system | utf8 | | character_sets_dir | /var/lib/mysql/mysql/charsets/ | +--------------------------+--------------------------------+[/FONT] 8 rows in set
Curious if this fixed anyone else having the same issue.Code:[FONT=Courier New]mysql> SHOW VARIABLES LIKE 'char%'; +--------------------------+--------------------------------+ | Variable_name | Value | +--------------------------+--------------------------------+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | utf8 | | character_set_filesystem | binary | | character_set_results | utf8 | | character_set_server | latin1 | | character_set_system | utf8 | | character_sets_dir | /var/lib/mysql/mysql/charsets/ | +--------------------------+--------------------------------+ 8 rows in set[/FONT]
Last edited by Palmertree; 24-01-2010, 04:15.Comment
Comment