Lost Traffic_Out DEF while changing graph template

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

Moderators: Developers, Moderators

Post Reply
interweave
Posts: 5
Joined: Tue Dec 19, 2006 12:13 pm

Lost Traffic_Out DEF while changing graph template

Post by interweave »

I'm about to :cry: ! I was changing a graph template that supports over 100 devices and somehow I managed to lose the Traffic_Out DEF for anything that used that template. I have tried all that I can think of, but the only way I can get a functioning DEF is to create a new datasource and graph. All I need to do is add a DEF and a couple of CDEF's and it should work. Is there any way to do this without having to rebuild everything?

I have included a bad and good code sample as well as a picture of the bad.

Thanks

Interweave

**** GOOD *****

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="######- Traffic - 1" \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="bits per second" \
--slope-mode \
DEF:a="/var/www/localhost/htdocs/cacti/rra/######_traffic_in_630.rrd":traffic_in:AVERAGE \
DEF:b="/var/www/localhost/htdocs/cacti/rra/######_traffic_in_630.rrd":traffic_out:AVERAGE \
CDEF:cdefc=a,8,* \
CDEF:cdefd=a,8,* \
CDEF:cdefe=b,100000000,/,100,*,8,* \
CDEF:cdeff=b,8,* \
CDEF:cdefi=a,100000000,/,100,*,8,* \
CDEF:cdefbb=a,100000000,/,100,*,8,* \
CDEF:cdefbi=a,UN,INF,UNKN,IF \
COMMENT:" Description\: network_router\n" \
COMMENT:"\n" \
AREA:cdefc#00CF00:"In" \
GPRINT:cdefd:LAST:"Cur\:%8.2lf%s" \
GPRINT:cdefe:LAST:"(%3.2lf %%)" \
GPRINT:cdeff:AVERAGE:"Avg\:%8.2lf%s" \
GPRINT:cdefe:AVERAGE:"(%3.2lf %%)" \
GPRINT:cdeff:MAX:"Max\:%8.2lf%s" \
GPRINT:cdefi:MAX:"(%3.2lf %%)\n" \
LINE1:cdefd#002A97:"Out" \
GPRINT:cdefd:LAST:"Cur\:%8.2lf%s" \
GPRINT:cdefbb:LAST:"(%3.2lf %%)" \
GPRINT:cdefd:AVERAGE:"Avg\:%8.2lf%s" \
GPRINT:cdefbb:AVERAGE:"(%3.2lf %%)" \
GPRINT:cdefd:MAX:"Max\:%8.2lf%s" \
GPRINT:cdefbb:MAX:"(%3.2lf %%)\n" \
COMMENT:"Speed\: 100000000\n" \
COMMENT:"Graph Last Updated\: Tue 19 Dec 10\:15\:03 PST 2006" \
AREA:cdefbi#8F9286:"" \
COMMENT:"*** Dark grey background indicates graphing disabled or in error ***"


****BAD*****

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="##############" \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="bits per second" \
--slope-mode \
DEF:a="/var/www/localhost/htdocs/cacti/rra/######_traffic_in_525.rrd":traffic_in:AVERAGE \
CDEF:cdefc=a,8,* \
CDEF:cdefe=a,1536000,/,100,*,8,* \
CDEF:cdefbb=a,1536000,/,100,*,8,* \
CDEF:cdefbc=a,8,* \
CDEF:cdefbi=a,UN,INF,UNKN,IF \
COMMENT:" Description\: ###############\n" \
COMMENT:"\n" \
AREA:cdefc#00CF00:"In" \
GPRINT:cdefc:LAST:"Cur\:%8.2lf%s" \
GPRINT:cdefe:LAST:"(%3.2lf %%)" \
GPRINT:cdefc:AVERAGE:"Avg\:%8.2lf%s" \
GPRINT:cdefe:AVERAGE:"(%3.2lf %%)" \
GPRINT:cdefc:MAX:"Max\:%8.2lf%s" \
GPRINT:cdefe:MAX:"(%3.2lf %%)\n" \
LINE1:cdefc#002A97:"Out" \
GPRINT:cdefc:LAST:"Cur\:%8.2lf%s" \
GPRINT:cdefbb:LAST:"(%3.2lf %%)" \
GPRINT:cdefbc:AVERAGE:"Avg\:%8.2lf%s" \
GPRINT:cdefbb:AVERAGE:"(%3.2lf %%)" \
GPRINT:cdefbc:MAX:"Max\:%8.2lf%s" \
GPRINT:cdefbb:MAX:"(%3.2lf %%)\n" \
COMMENT:"Speed\: 1536000\n" \
COMMENT:"Graph Last Updated\: Tue 19 Dec 10\:16\:02 PST 2006" \
AREA:cdefbi#8F9286:"" \
COMMENT:"*** Dark grey background indicates graphing disabled or in error ***"
Attachments
This is the bad graph. As you can see, In and Out are identical because the traffic-out DEF is missing.
This is the bad graph. As you can see, In and Out are identical because the traffic-out DEF is missing.
Bad-Graph Example.PNG (36.64 KiB) Viewed 1670 times
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Select the "LINE1" graph item and change the data source referenced from INBOUND to OUTBOUND. That should cure it
Reinhard
interweave
Posts: 5
Joined: Tue Dec 19, 2006 12:13 pm

No suck luck

Post by interweave »

Tried changing the data source, but it did nothing. Had to rebuild all my data sources and graphs. :(

On the good side, I have now decided I am testing my changes on a dummy device/data source/graph template before I make any changes to the live versions. :D

Is there any consideration on allowing direct manipulation of the RRDTool Command? Like being able to add a DEF directly?

Thanks,

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

Post by gandalf »

Currently not
Reinhard
interweave
Posts: 5
Joined: Tue Dec 19, 2006 12:13 pm

Possible issue found

Post by interweave »

I think I found a fix for this problem. Unfortunately it took the event happening yet again, only hours after I fixed it the first time, before I realised it.

I think the issue is using the same "current_data_source" oriented CDEF (like "Turn Bytes into Bits") on multiple data sources in the same graph template, and then making changes to that template after it's been applied.

Example:
Say I use the same CDEF (CURRENT_DATA_SOURCE,8,*) to display the current utilization for the incoming and outgoing data sources.
When I make changes to that graph template (after it's been applied to many devices) that has an impact on that CDEF (say I change one of the gprints from outgoing to incoming) I will see that all of the instances of that CDEF have been recalculated to apply to the recently changed data source.** When this happens my graph will of course show the same data for both incoming and outgoing because it is the same data. I still have both DEF's, even though one of them is not being referenced. However, once I save the graph template (not just the change I made to the grpint) it appears Cacti does another recalculation and realises that one of the DEF's is not being used, and decides to get rid of it.** At this point, I have only one DEF and all CDEF's are, of course, pointed to it as their data source. The only way to get the second DEF back at this point is to blow away the current graph and all data sources associated with it, and rebuild the darn thing.

I think I may have fixed this issue by creating CDEF's that point only to my desired DEF. Since it's a utilization graph, I know that there will be both a and b DEF's created for the incoming and outgoing data. I just replaced the "current_data_source" element in the offending CDEF's with a or b and everything works great. Now I can make any changes I want, because the CDEF's can't be recalculated for the wrong data source, thus triggering a recalc of the DEF's.

Anyone else find this to be the case?

Scott


Here's an example of the "Turn Bytes into Bits" CDEF:

cdef=CURRENT_DATA_SOURCE,8,*

And here's the newly restructured "Inbound Bytes to Bits" CDEF:

cdef=a,8,*


** caveat: I'm not sure of this happening every time. I haven't tested it fully. Could just have been the few times I experimented.**
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest