smtc0097 / mysql-cacti-templates

Automatically exported from code.google.com/p/mysql-cacti-templates
GNU General Public License v2.0
0 stars 0 forks source link

"a8:0 a9:0" is matched by is_hexadecimal #197

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The value returned by ss_get_mysql_stats.php for mysql_locked_transactions.rrd 
is "a8:0 a9:0". This is matched by cacti's is_hexadecimal() function 
preg_match('/^[a-fA-F0-9: \t]*$/

The value is then parsed as a single value and converted to a double 
(9.34963664798E+35), instead of as a multi-value field and split up.

A solution would be to use z8 instead of a8 (or to make cacti remove : from the 
regexp, older versions did not have it).

Original issue reported on code.google.com by b.goris...@gmail.com on 2 Oct 2011 at 11:12

GoogleCodeExporter commented 8 years ago
Temporarily resolved this locally by prefixing all variables with 's' and 
increasing the expected length to 3. This is a terrible hack but I'm in a hurry 
at the moment and figured I would post this just to indicate that this is an 
issue, not only for mysql but for several of the ss_get_by_ssh items as well.

Original comment by kirk...@gmail.com on 9 Oct 2011 at 8:41

GoogleCodeExporter commented 8 years ago
I fixed it replacing aX with apacheX, and changing 
if ( in_array(substr($item, 0, 2), $wanted) ) {
to
if ( in_array(substr($item, 0, strpos($item, ':')), $wanted) ) {

Patch to script attached.
Remember to change 'data input methods' or XML file before import.

Original comment by dalew...@gmail.com on 11 Oct 2011 at 10:54

Attachments:

GoogleCodeExporter commented 8 years ago
What I understand from this is that Cacti has introduced a truly braindead 
change and we probably need to change all of the two-letter prefixes to avoid 
[0-f] characters. What version of Cacti does this happen in?

Original comment by baron.schwartz on 11 Oct 2011 at 2:01

GoogleCodeExporter commented 8 years ago
0.8.7h

Original comment by dalew...@gmail.com on 11 Oct 2011 at 2:03

GoogleCodeExporter commented 8 years ago
A fix has been made for this within Cacti Itself.

http://bugs.cacti.net/view.php?id=2063

Original comment by w...@gunty.net on 14 Oct 2011 at 10:42

GoogleCodeExporter commented 8 years ago
Issue 201 has been merged into this issue.

Original comment by baron.schwartz on 7 Nov 2011 at 7:21

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
The problem is, values like XX:XX, where X any charactrer a-f0-9 still 
recognized as hex. For Q&D solution I have added print " ,zzzz:U" to both 
ss_get_by_ssh.php and ss_get_mysql_stats.php after it output requested values. 
af long az zzzz is not a tyope for any request and z is not possible character 
for hex it works for most all templates. (in general it pissble top check 
output and add zzz obly in case we do n ot have non hex characters ago, but non 
checked doutput works too)

Original comment by ale...@kouznetsov.com on 24 Nov 2011 at 1:57

GoogleCodeExporter commented 8 years ago

Original comment by baron.schwartz on 4 Jan 2012 at 2:04

GoogleCodeExporter commented 8 years ago
This issue is fixed in a new project based on this one, which doesn't have to 
maintain backwards compatibility.

Original comment by baron.schwartz on 25 Jan 2012 at 2:54