Cacti / cacti

Cacti ™
http://www.cacti.net
GNU General Public License v2.0
1.62k stars 403 forks source link

Issue with aggregate graph creation when there are custom CDEFs in Graph Template #4055

Open kaf3773 opened 3 years ago

kaf3773 commented 3 years ago

Help on this will be very much appreciated.

I am aggregating the below two graphs. This use to work perfectly in 0.8.8c

The Red and Orange lines were placed on it using a custom CDEFs in the Graph template.

individual_graphs

Graph template items are below

image

The Red line is done with the below CDEF

image

The Orange line is done with the below CDEF

image

I create aggregate graph by Totaling all items. Below is my aggregate graph creation.

aggregate_graph_creation

But it is unable to create the aggregate graph Below is the error i am getting

/opt/rrdtool-1.7.2/bin/rrdtool graph - \ --imgformat=PNG \ --start='-86400' \ --end='-300' \ --pango-markup \ --title='Aggregate - Traffic - ' \ --vertical-label='bits per second' \ --slope-mode \ --base=1000 \ --height=200 \ --width=700 \ --rigid \ --alt-autoscale-max \ --lower-limit='0' \ COMMENT:"From 2021-01-12 17\:24\:11 To 2021-01-13 17\:19\:11\c" \ COMMENT:" \n" \ --color BACK#F3F3F3 \ --color CANVAS#FDFDFD \ --color SHADEA#CBCBCB \ --color SHADEB#999999 \ --color FONT#000000 \ --color AXIS#2C4D43 \ --color ARROW#2C4D43 \ --color FRAME#2C4D43 \ --border 1 --font TITLE:11:'Arial' \ --font AXIS:8:'Arial' \ --font LEGEND:8:'Courier' \ --font UNIT:8:'Arial' \ --font WATERMARK:6:'Arial' \ --slope-mode \ --watermark 'Generated by Cacti®' \ DEF:a='/var/www/html/cacti/rra/2439/3072.rrd':'traffic_in':AVERAGE \ DEF:b='/var/www/html/cacti/rra/2439/3072.rrd':'traffic_out':AVERAGE \ DEF:c='/var/www/html/cacti/rra/2439/3072.rrd':'traffic_out':MAX \ DEF:d='/var/www/html/cacti/rra/2453/3115.rrd':'traffic_in':AVERAGE \ DEF:e='/var/www/html/cacti/rra/2453/3115.rrd':'traffic_out':AVERAGE \ DEF:f='/var/www/html/cacti/rra/2453/3115.rrd':'traffic_out':MAX \ CDEF:cdefa='a,0,*' \ CDEF:cdefc='b,0,*' \ CDEF:cdefd='c,0,*' \ CDEF:cdefe='d,0,*' \ CDEF:cdefg='e,0,*' \ CDEF:cdefh='f,0,*' \ CDEF:cdefi=',8,*' \ CDEF:cdefbd='TIME,1610558351,GT,c,c,UN,0,c,IF,IF,TIME,1610558351,GT,f,f,UN,0,f,IF,IF,+,8,*' \ LINE1:cdefa#00CF00FF: \ AREA:cdefa#00CF007F: \ LINE1:cdefc#002A97FF: \ LINE1:cdefd#FF0000FF: \ LINE1:cdefe#00CF00FF: \ AREA:cdefe#00CF007F: \ LINE1:cdefg#002A97FF: \ LINE1:cdefh#FF0000FF: \ LINE1:cdefi#00CF00FF: \ AREA:cdefi#00CF007F:'Total' \ GPRINT:cdefi:LAST:'Current\:%8.2lf %s' \ GPRINT:cdefi:AVERAGE:'Average\:%8.2lf %s' \ GPRINT:cdefi:MAX:'Maximum\:%8.2lf %s\n' \ LINE1:cdefbd#002A97FF: \ GPRINT:cdefbd:AVERAGE:'Average\:%8.2lf %s' \ GPRINT:cdefbd:MAX:'Maximum\:%8.2lf %s\n' RRDtool Command lengths = 1854 charaters. RRDtool Says: ERROR: don't understand ',8,*'

When i skip the CDEF that creates the Orange line

aggregate_graph_creation_after_change

It creates the aggregate but it is missing the Red and Orange Lines as well as the traffic labels in on the graph.

aggregate_graph

netniV commented 3 years ago

It looks like the "i" is missing from the cdef for some reason ... would you agree @TheWitness ?

TheWitness commented 3 years ago

No, the issue is that there is no rollout for these custom data source types. It's a bug, likely want not supported in the earlier aggregate either, and should be handled post 1.2.17 as such.

TheWitness commented 3 years ago

Okay, I have a question for @kaf3773, there are a few things we have to figure out when we convert the normal graph template to an aggregate. There are these special data sources

ALL_DATA_SOURCES_NODUPS - Pretty strait forward, just sum all the data sources, which is kind of what aggregate does in one operating model, right just sum up? CURRENT_GRAPH_MAXIMUM_VALUE - How is this supposed to be interpreted in an Aggregate? Do we sum up all the MAX values?

Need clarification on those two things and then we can make an aggregate of this variety workable.

TheWitness commented 3 years ago

So, another thing, behind the scenes, there is a classic Cacti Graph, but they are hidden. Take note of the aggregate_id of the graph that you are working with, and in both cases, take the ID and then run the following query:

SELECT * FROM aggregate_graphs WHERE id = ?

Replacing ? with the ID. Then using the local_graph_id returned, hand edit the graph, and show the images, and the resulting Graph Item for the broken graphs. The URL will be something like:

https://yourhost.dns.name/cacti/graphs?action=edit&id=local_graph_id

So, couple of things:

  1. The graph edit items image
  2. Edit the Graph Items that represent each of the ORANGE and RED line, and show images of that.
kaf3773 commented 3 years ago

@TheWitness,

Concerning ALL_DATA_SOURCES_NODUPS and CURRENT_GRAPH_MAXIMUM_VALUE I do not think they need to be summed up but rather just kept as is. Because below is how they are used in the CDEF definition to graph the RED line

cdef=ALL_DATA_SOURCES_NODUPS,0,*,CURRENT_GRAPH_MAXIMUM_VALUE,+

image

We use the RED line as capacity line so this becomes a constant depending on what the CURRENT_GRAPH_MAXIMUM_VALUE is set to per graph as determined in the graph template. So I assume summing them up will result in doubling of the value.

We found how to draw the RED LINE this way from a post on the Cacti forums and below is the link to it. https://forums.cacti.net/viewtopic.php?p=161323#p161323

The ORANGE line is just doing a second CDEF and using the first CDEF that draws the RED line and calculating 70% of that. cdef=70,100,/,ALL_DATA_SOURCES_NODUPS,0,*,CURRENT_GRAPH_MAXIMUM_VALUE,+,*

image

With regard to the graph edit items

  1. Graph edit items image graph_edit_items

I think the link to get to this is http://yourhost.dns.name/cacti/graphs.php?action=graph_edit&id=local_graph_id just in case someone else is also trying to follow this process.

  1. Image after i edit the Graph Items that represent ORANGE and RED line aggregate_edit_items_no_template

Finally just in case it helps, adding an image of the graph edit items as we have it on Cacti version 0.8.8c with Aggregate 0.75 With same exact custom CDEFs. This works fine.

aggregate_0 8 8c

kaf3773 commented 3 years ago

@TheWitness,

Any chance of a resolution of this issue anytime soon? This is a key item stalling our upgrade to Cacti 1.

Appreciate your help on this.

Thanks

kaf3773 commented 1 year ago

@TheWitness,

Gentle reminder on this. Any chance of a resolution?

Appreciate your help.

Thanks

TheWitness commented 1 year ago

I'm not working on feature enhancements at the moment. 1.2.24 and then a load of plugin releases.

a-vasilishin commented 4 months ago

Hello! I have the same problem on Version 1.2.26. When I changed Prefix from |host_name| to |host_description| on my existing aggregate, I get an error: ` Command RRDtool:

/usr/bin/rrdtool graph - \ --imgformat=PNG \ --start='-86400' \ --end='-300' \ --pango-markup \ --title='FDC aggregate' \ --vertical-label='bits per second' \ --slope-mode \ --base=1000 \ --height=300 \ --width=700 \ --tabwidth '30' \ --rigid \ --alt-autoscale-max \ --lower-limit='0' \ COMMENT:"From 2024/04/20 11\:30\:22 To 2024/04/21 11\:25\:22\c" \ COMMENT:" \n" \ --border 1 \ --slope-mode \ --watermark 'highload.biz' \ DEF:a='/usr/share/cacti/site/rra/91/4228.rrd':'traffic_in':AVERAGE \ DEF:b='/usr/share/cacti/site/rra/91/4228.rrd':'traffic_in':MAX \ DEF:c='/usr/share/cacti/site/rra/91/4228.rrd':'traffic_out':AVERAGE \ DEF:d='/usr/share/cacti/site/rra/199/5364.rrd':'traffic_in':AVERAGE \ DEF:e='/usr/share/cacti/site/rra/199/5364.rrd':'traffic_in':MAX \ DEF:f='/usr/share/cacti/site/rra/199/5364.rrd':'traffic_out':AVERAGE \ DEF:g='/usr/share/cacti/site/rra/229/6050.rrd':'traffic_in':AVERAGE \ DEF:h='/usr/share/cacti/site/rra/229/6050.rrd':'traffic_in':MAX \ DEF:i='/usr/share/cacti/site/rra/229/6050.rrd':'traffic_out':AVERAGE \ CDEF:cdefa='a,8,' \ CDEF:cdefd='b,8,' \ CDEF:cdefe='c,8,' \ CDEF:cdefj='d,8,' \ CDEF:cdefbc='e,8,' \ CDEF:cdefbd='f,8,' \ CDEF:cdefbi='g,8,' \ CDEF:cdefcb='h,8,' \ CDEF:cdefcc='i,8,' \ CDEF:cdefci=',8,' \ CDEF:cdefdc=',8,*' \ CDEF:cdefdf= \ CDEF:cdefdg= \ GPRINT:cdefa:LAST:'Current\:%8.2lf %s' \ GPRINT:cdefa:MIN:'Minimum\:%8.2lf %s' \ GPRINT:cdefa:AVERAGE:'Average\:%8.2lf %s' \ GPRINT:cdefd:MAX:'Maximum\:%8.2lf %s\n' \ GPRINT:cdefe:LAST:'Current\:%8.2lf %s' \ GPRINT:cdefe:MIN:'Minimum\:%8.2lf %s' \ GPRINT:cdefe:AVERAGE:'Average\:%8.2lf %s\n' \ COMMENT:'Total In\: 1,54 TB\n' \ COMMENT:'Total Out\: 110,46 TB\n' \ GPRINT:cdefj:LAST:'Current\:%8.2lf %s' \ GPRINT:cdefj:MIN:'Minimum\:%8.2lf %s' \ GPRINT:cdefj:AVERAGE:'Average\:%8.2lf %s' \ GPRINT:cdefbc:MAX:'Maximum\:%8.2lf %s\n' \ GPRINT:cdefbd:LAST:'Current\:%8.2lf %s' \ GPRINT:cdefbd:MIN:'Minimum\:%8.2lf %s' \ GPRINT:cdefbd:AVERAGE:'Average\:%8.2lf %s\n' \ COMMENT:'Total In\: 1,68 TB\n' \ COMMENT:'Total Out\: 110,98 TB\n' \ GPRINT:cdefbi:LAST:'Current\:%8.2lf %s' \ GPRINT:cdefbi:MIN:'Minimum\:%8.2lf %s' \ GPRINT:cdefbi:AVERAGE:'Average\:%8.2lf %s' \ GPRINT:cdefcb:MAX:'Maximum\:%8.2lf %s\n' \ GPRINT:cdefcc:LAST:'Current\:%8.2lf %s' \ GPRINT:cdefcc:MIN:'Minimum\:%8.2lf %s' \ GPRINT:cdefcc:AVERAGE:'Average\:%8.2lf %s\n' \ COMMENT:'Total In\: 2,96 TB\n' \ COMMENT:'Total Out\: 183,75 TB\n' \ COMMENT:' \n' \ GPRINT:cdefci:LAST:'Current\:%8.2lf %s' \ GPRINT:cdefci:MIN:'Minimum\:%8.2lf %s' \ GPRINT:cdefci:AVERAGE:'Average\:%8.2lf %s' \ GPRINT:cdefci:MAX:'Maximum\:%8.2lf %s\n' \ GPRINT:cdefdc:LAST:'Current\:%8.2lf %s' \ GPRINT:cdefdc:MIN:'Minimum\:%8.2lf %s' \ GPRINT:cdefdc:AVERAGE:'Average\:%8.2lf %s\n' \ COMMENT:'Total In\: 0 B\n' \ COMMENT:'Total Out\: 0 B\n' \ COMMENT:' \n' \ HRULE:0#FF0000FF:'95th Percentile' \ COMMENT:'(0 mbit in+out)\n'

RRDtool Command lengths = 2856 characters. RRDtool каже:

ERROR: don't understand ',8,*'

`

TheWitness commented 4 months ago

Hmm, re-save your aggregate. It looks like maybe you deleted a graph and that possibly the aggregate portion of the removal was interrupted. If resaving does not work, just recreate it.

a-vasilishin commented 4 months ago

New aggregate ends with the same error. No error if I skip Total In and Total out зображення