Package: cacti Version: 0.8.7g Severity: important While some tries, i found that cacti is not full UTF-8. It do not set the utf8 chraset in database connection and have problem with non ASCII chars in graphs.
Some problems i solved (see attachments) patching cacti source, by these patches the cecti now saves data to DB in UTF-8 encoding an do proper "Auto padding" calculation for non ASCII chars in graph descriptions. cacti still skips non ASCII chars in grap's titles, but this is server's locale depended (setting apache's LANG variable to UTF-8 encoding solve this). regards slavko -- System Information: Debian Release: squeeze/sid APT prefers testing APT policy: (500, 'testing') Architecture: amd64 (x86_64) Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores) Locale: LANG=sk_SK.UTF-8, LC_CTYPE=sk_SK.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages cacti depends on: ii apache2-mpm-prefork [httpd] 2.2.16-4 Apache HTTP Server - traditional n ii dbconfig-common 1.8.46 common framework for packaging dat ii debconf [debconf-2.0] 1.5.36 Debian configuration management sy ii libapache2-mod-php5 5.3.3-3 server-side, HTML-embedded scripti pn libphp-adodb <none> (no description available) ii mysql-client-5.1 [virtual-m 5.1.49-2 MySQL database client binaries ii php5 5.3.3-3 server-side, HTML-embedded scripti ii php5-cli 5.3.3-3 command-line interpreter for the p ii php5-mysql 5.3.3-3 MySQL module for php5 ii php5-snmp 5.3.3-3 SNMP module for php5 ii rrdtool 1.4.3-1 time-series data storage and displ ii snmp 5.4.3~dfsg-1 SNMP (Simple Network Management Pr ii ucf 3.0025+nmu1 Update Configuration File: preserv Versions of packages cacti recommends: ii iputils-ping 3:20100418-3 Tools to test the reachability of ii logrotate 3.7.8-6 Log rotation utility ii mysql-server 5.1.49-2 MySQL database server (metapackage ii mysql-server-5.1 [mysql-ser 5.1.49-2 MySQL database server binaries and Versions of packages cacti suggests: pn php5-ldap <none> (no description available)
#! /bin/sh /usr/share/dpatch/dpatch-run ## database-utf8.dpatch by Slavko <[email protected]> ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: No description. @DPATCH@ diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' cacti-0.8.7g~/lib/database.php cacti-0.8.7g/lib/database.php --- cacti-0.8.7g~/lib/database.php 2010-07-10 00:33:46.000000000 +0200 +++ cacti-0.8.7g/lib/database.php 2010-11-21 18:20:05.000000000 +0100 @@ -46,6 +46,7 @@ while ($i <= $retries) { if ($cnn->PConnect($hostport,$user,$pass,$db_name)) { + $cnn->EXECUTE("set names 'utf8'"); return($cnn); }
#! /bin/sh /usr/share/dpatch/dpatch-run ## rrd-autopadding-utf8.dpatch by Slavko <[email protected]> ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: No description. @DPATCH@ diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' cacti-0.8.7g~/lib/rrd.php cacti-0.8.7g/lib/rrd.php --- cacti-0.8.7g~/lib/rrd.php 2010-07-10 00:33:46.000000000 +0200 +++ cacti-0.8.7g/lib/rrd.php 2010-11-21 18:21:23.000000000 +0100 @@ -1000,7 +1000,7 @@ if ($graph["auto_padding"] == "on") { /* only applies to AREA, STACK and LINEs */ if (ereg("(AREA|STACK|LINE[123])", $graph_item_types{$graph_item["graph_type_id"]})) { - $text_format_length = strlen($graph_variables["text_format"][$graph_item_id]); + $text_format_length = mb_strlen($graph_variables["text_format"][$graph_item_id], 'UTF-8'); if ($text_format_length > $greatest_text_format) { $greatest_text_format = $text_format_length; @@ -1243,7 +1243,7 @@ if ((!isset($graph_data_array["graph_nolegend"])) && ($graph["auto_padding"] == "on")) { /* only applies to AREA, STACK and LINEs */ if (ereg("(AREA|STACK|LINE[123])", $graph_item_types{$graph_item["graph_type_id"]})) { - $text_format_length = strlen($graph_variables["text_format"][$graph_item_id]); + $text_format_length = mb_strlen($graph_variables["text_format"][$graph_item_id], 'UTF-8'); /* we are basing how much to pad on area and stack text format, not gprint. but of course the padding has to be displayed in gprint,

