Problems with CDEFS when importing existing template.

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

Moderators: Developers, Moderators

Post Reply
rvt
Posts: 10
Joined: Wed Feb 08, 2012 12:30 am

Problems with CDEFS when importing existing template.

Post by rvt »

Hi,

I'm in the process of migrating our current cacti server to a new, more powerful machine so I've exported our Templates and have been importing them into the new installation and they have all worked so far except for this one that graphs some Apache stats.

When turning on Graph debugging on the OLD server I see:

Code: Select all

/usr/local/rrdtool-1.2.19/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-60 \
--title="server1 - Apache Statistics - Bytes / Request" \
--base=1024 \
--height=120 \
--width=640 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="bytes / hit" \
--slope-mode \
--font TITLE:8: \
--font AXIS:8: \
--font LEGEND:8: \
--font UNIT:8: \
DEF:a="/var/www/html/rra/server1_threadr_176.rrd":apache_total_kbytes:AVERAGE \
DEF:b="/var/www/html/rra/server1_threadr_176.rrd":apache_total_kbytes:LAST \
DEF:c="/var/www/html/rra/server1_threadr_176.rrd":apache_total_kbytes:MAX \
DEF:d="/var/www/html/rra/server1_threadr_176.rrd":apache_total_hits:AVERAGE \
DEF:e="/var/www/html/rra/server1_threadr_176.rrd":apache_total_hits:LAST \
DEF:f="/var/www/html/rra/server1_threadr_176.rrd":apache_total_hits:MAX \
CDEF:cdefa=a,UN,0,a,100000,GT,0,a,IF,IF \
CDEF:cdefb=d,UN,0,d,100000,GT,0,d,IF,IF \
CDEF:cdefc=cdefb,0,EQ,0,cdefa,1024,*,cdefb,/,IF,0,1000000,LIMIT \
 \
 \
AREA:cdefc#4123A1FF:"Bytes / Request"  \
GPRINT:cdefc:LAST:"Current\:%8.2lf %s"  \
GPRINT:cdefc:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:cdefc:MAX:"Maximum\:%8.2lf %s\n"  \
LINE2:a#FF0000FF:"kBytes"  \
GPRINT:b:LAST:"         Current\:%8.2lf %s"  \
GPRINT:a:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:c:MAX:"Maximum\:%8.2lf %s\n"  \
LINE2:d#00FF00FF:"Hits"  \
GPRINT:e:LAST:"           Current\:%8.2lf %s"  \
GPRINT:d:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:f:MAX:"Maximum\:%8.2lf %s\n" 
While on the NEW server I see something that's fairly different:

Code: Select all

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=0 \
--end=0 \
--title='server1 - test - Apache Statistics - Bytes / Request' \
--base=1024 \
--height=120 \
--width=640 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label='bytes / hit' \
--slope-mode \
--font TITLE:10: \
--font AXIS:7: \
--font LEGEND:8: \
--font UNIT:7: \
DEF:a="/opt/cacti-0.8.7i/rra/server1_-_test_apache_busy_workers_206.rrd":apache_total_kbytes:AVERAGE \
DEF:b="/opt/cacti-0.8.7i/rra/server1_-_test_apache_busy_workers_206.rrd":apache_total_hits:AVERAGE \
CDEF:cdefa=a,UN,0,a,100000,GT,0,a,IF,IF \
CDEF:cdefb=d,UN,0,d,100000,GT,0,d,IF,IF \
CDEF:cdefc=cdefb,0,EQ,0,cdefa,1024,*,cdefb,/,IF,0,1000000,LIMIT \
 \
 \
AREA:cdefc#4123A1FF:"Bytes / Request"  \
GPRINT:cdefc:LAST:"Current\:%8.2lf %s"  \
GPRINT:cdefc:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:cdefc:MAX:"Maximum\:%8.2lf %s\n"  \
LINE2:a#FF0000FF:"kBytes"  \
GPRINT:a:LAST:"         Current\:%8.2lf %s"  \
GPRINT:a:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:a:MAX:"Maximum\:%8.2lf %s\n"  \
LINE2:b#00FF00FF:"Hits"  \
GPRINT:b:LAST:"           Current\:%8.2lf %s"  \
GPRINT:b:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:b:MAX:"Maximum\:%8.2lf %s\n" 

RRDTool Says:

ERROR: invalid rpn expression in: d,UN,0,d,100000,GT,0,d,IF,IF
It's having errors because the CDEF expects there to be more DEF's than are appearing but I'm not sure why there is a difference between the old server and the new. All the Templates look the same (Graph, Data, etc).

In the Graph Template I have AVERAGE, LAST, MAX for each of the DS's being used, not sure why only AVERAGE is appearing on the new server.

To move the Templates over I simply exported from the old server and imported into the new. All the other graphs are working fine (so far).

Any ideas? Thanks.
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: Problems with CDEFS when importing existing template.

Post by noname »

rvt wrote: It's having errors because the CDEF expects there to be more DEF's than are appearing but I'm not sure why there is a difference between the old server and the new. All the Templates look the same (Graph, Data, etc).

In the Graph Template I have AVERAGE, LAST, MAX for each of the DS's being used, not sure why only AVERAGE is appearing on the new server.
What version did you upgrade from? Probably it seems to be caused by old bug.
CHANGELOG:
0.8.7a
-bug#0001052: Graph template - GRINT creates CF function DEF
On the old server, DEF b/c/e/f are only used for GPRINT. It's not related to CDEF definitions (cdefa/cdefb/cdefc).

Currently Cacti doesn't create extra DEF on each GPRINT.
So I think you should modify relevant CDEF on the new server, like this:
CDEF:cdefb=b,UN,0,b,100000,GT,0,b,IF,IF
rvt
Posts: 10
Joined: Wed Feb 08, 2012 12:30 am

Re: Problems with CDEFS when importing existing template.

Post by rvt »

Thanks mate, that got it! :)

I'm upgrading from 0.8.7b to the latest, 0.8.7i
rvt
Posts: 10
Joined: Wed Feb 08, 2012 12:30 am

Re: Problems with CDEFS when importing existing template.

Post by rvt »

Hrmmm I'm also getting a problem now where ALL_DATA_SOURCES_NODUPS seems to be generating a blank CDEF line :(

Code: Select all


	RRDTool Command:

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=0 \
--end=0 \
--title='server1 - Stats' \
--base=1000 \
--height=140 \
--width=800 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label='# queries / s' \
--slope-mode \
--font TITLE:10: \
--font AXIS:7: \
--font LEGEND:8: \
--font UNIT:7: \
DEF:a="/opt/cacti-0.8.7i/rra/server1_-_test_204.rrd":nimServerSuccess:AVERAGE \
DEF:b="/opt/cacti-0.8.7i/rra/server1_-_test_203.rrd":nimServerFailure:AVERAGE \
CDEF:cdefi= \
LINE1:a#6DC8FEFF:"Successful Queries\:"  \
GPRINT:a:LAST:"  Current\:%8.2lf %s"  \
GPRINT:a:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:a:MAX:"Maximum\:%8.2lf %s\n"  \
LINE1:b#FFFF00FF:"Unsuccessful Queries\:"  \
GPRINT:b:LAST:"Current\:%8.2lf %s"  \
GPRINT:b:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:b:MAX:"Maximum\:%8.2lf %s\n"  \
LINE1:cdefi#FF4105FF:"Total Queries\:"  \
GPRINT:cdefi:LAST:"       Current\:%8.2lf %s"  \
GPRINT:cdefi:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:cdefi:MAX:"Maximum\:%8.2lf %s\n" 

RRDTool Says:

ERROR: String ends after the = sign on 'CDEF:cdefi='
The above is with the graph item CF set to LAST, it seems to work if I set it to AVERAGE. Has this behaviour changed also?

Thanks.


Update: I put it back to AVERAGE and now it's working for some reason...
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: Problems with CDEFS when importing existing template.

Post by noname »

rvt wrote: The above is with the graph item CF set to LAST, it seems to work if I set it to AVERAGE. Has this behaviour changed also?

Update: I put it back to AVERAGE and now it's working for some reason...
It might be this.. (though it's the case for "MAX" CF)
- http://bugs.cacti.net/view.php?id=909

I'm not sure in detail, but upgrading Cacti can't sometimes fix the problems for existing items (e.g. in the database) ?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest