ALL_DATA_SOURCES_NODUPS incorrectly adds fields twice

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
cpitchford
Posts: 3
Joined: Fri Sep 21, 2007 12:45 pm

ALL_DATA_SOURCES_NODUPS incorrectly adds fields twice

Post by cpitchford »

I've been experimenting with the load average graph consisting of 1min, 5min and 15min averages.

It utilises the "Total All Data Sources" CDEF to create a black outline. This worked until I added *then removed* a new data input.

Imagine a 3 fields
item1 field1 AREA
item2 field2 STACK
item3 field3 STACK
item4 none Line1 Total All Data Sources

This works (this is the default load graph)

If I add a field:
item1 field1 AREA
item2 field2 STACK
item3 field3 STACK
item4 field4 STACK
item5 none Line1 Total All Data Sources

This still works with the added stacked area

If I remove field4 and item4 reverting to the orignal
item1 field1 AREA
item2 field2 STACK
item3 field3 STACK
item4 none Line1 Total All Data Sources

The black line is now raised above the stacked area.

Looking at the debug the CDEF for the total is wrong. It has added field3, twice!

Before the modification:
TIME,1190389369,GT,a,a,UN,0,a,IF,IF,TIME,1190389369,GT,b,b,UN,0,b,IF,IF,TIME,1190389369,GT,c,c,UN,0,c,IF,IF,+,+

After the modification:
TIME,1190389293,GT,a,a,UN,0,a,IF,IF,TIME,1190389293,GT,b,b,UN,0,b,IF,IF,TIME,1190389293,GT,c,c,UN,0,c,IF,IF,TIME,1190389293,GT,c,c,UN,0,c,IF,IF,+,+,+

Why is it adding the final DEF twice? I'm looking through lib/rdd.php and I imagine the bug is either in there, or it is due to a left over item in an array possibly?

I've seen this a few times on the forum from 2005 and 2006 but not yet seen a solution.

Does anyone have any ideas where to look?

Cheers

Chris
cpitchford
Posts: 3
Joined: Fri Sep 21, 2007 12:45 pm

Post by cpitchford »

Ok, I've found out why it renders the CDEF incorrectly, it isn't a bug in the part that renders the time.

Looking in lib/rrd.php:451 function rrdtool_function_graph..

At around line 965, I included a call to print_t to dump the $graph_items[$t].
It seems that an item is processed if it has a member:
$graph_items[$t]["data_template_rrd_id"] set.

Here's an object dump from a graph that works:
Array
(
[graph_templates_item_id] => 515
[cdef_id] => 15
[text_format] =>
[value] =>
[hard_return] =>
[consolidation_function_id] => 1
[graph_type_id] => 4
[gprint_text] => %8.2lf %s
[hex] => 000000
[data_template_rrd_id] =>
[local_data_id] =>
[rrd_minimum] =>
[rrd_maximum] =>
[data_source_name] =>
[local_data_template_rrd_id] =>
[cdef_cache] => ALL_DATA_SOURCES_NODUPS,1024,*
)

Note that data_template_rrd_id is NOT SET. In this case, the function does not include this in the CDEF line

Now, here's an object from a graph that is broken.

Array
(
[graph_templates_item_id] => 540
[cdef_id] => 12
[text_format] =>
[value] =>
[hard_return] =>
[consolidation_function_id] => 1
[graph_type_id] => 4
[gprint_text] => %8.2lf %s
[hex] => 000000
[data_template_rrd_id] => 87
[local_data_id] => 5
[rrd_minimum] => 0
[rrd_maximum] => 500
[data_source_name] => load_5min
[local_data_template_rrd_id] => 13
[cdef_cache] => ALL_DATA_SOURCES_NODUPS
)

Here we can see it refers to ALL_DATA_SOURCES_NODUPS, as does the first, but in this case the [data_template_rrd_id] is set to 87. It shouldn't since this object SHOULD NOT refer to a rrd source.

It seems that the broken object has fields that shouldn't be filled:

[local_data_id] => 5
[rrd_minimum] => 0
[rrd_maximum] => 500
[data_source_name] => load_5min
[local_data_template_rrd_id] => 13

These values have either not be zeroed or when the item was deleted/renumber or the graph template edited. I'm guessing this might indicate a potentially larger problem?

The problem for me is that I don't know how the data_template_rrd_id field is filled (done in an SQL call) but I imagine that when items are added/deleted something is not being updated.. This really suggests there's some data becoming stale/corrupted when items are added / deleted from a input field of a graph template. This cannot be good.

At lea
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

If you suspect a bug, please report as indicated by http://www.cacti.net/bugs.php
Reinhard
cpitchford
Posts: 3
Joined: Fri Sep 21, 2007 12:45 pm

Post by cpitchford »

Sorry, I forgot to mention that I had..

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

It's been picked up, but I don't think much has happened yet. I was caught up this weekend, else I'd have looked further into it myself
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests