Open oetiker opened 12 years ago
[oetiker] the duplication is a side effect from using the alternative scaling options --alt*
the segfault comes from using a second formatting string in the axis format which is not supported ... I guess I would have to pre-parse the string to make sure people don't do this ...
cheers tobi
[oetiker] r2123 fixes the segfault ...
[human] Thank you for the response however I think there are still some problems. I tried removing all the "--alt" options, but I still get a problem with the graph. It now looks like the attached file "jc3.png". I've pasted the script I used below. Without the --alt-y-grid option I am still getting duplicates. In fact the problem seems to be worse, I know get 5 "1M".
Regarding the second problem the segfault I thought that --right-axis-format used the same syntax as PRINT and GPRINT where the same format string (%3.2lf%S) has been used without any problem.
So does that mean there is no way to get the right axis to use the same format but using the same units as in the print? As the same code is used for different links some of which report speeds in GB and others in KB, for example and the %S option works well here. It is a shame if it's not possible to use the same units on the right axis. If it is the case you can't use the same units on the right-axis perhaps you could consider it an enhancement request.
rrdtool graph '/var/tmp/jc3.png'\ --font TITLE:8:/rtnc/backend/lib/perl/includes/mrtg_graphs/routines/Arial.ttf\ --title 'Link Utilisation Link1WAN'\ --vertical-label 'Percent %'\ --right-axis 19840:0\ --right-axis-label 'Usage (bps)'\ --units-exponent 0\ --end 1282575378\ --start 1282488978\ --step 300\ --width 550\ --height 200\ --color BACK#ffffff\ --color SHADEA#ffffff\ --color SHADEB#ffffff\ --slope-mode\ --interlaced\ 'DEF:in=/var/tmp/jc.rrd:ds0:AVERAGE'\ 'DEF:out=/var/tmp/jc.rrd:ds1:AVERAGE'\ 'CDEF:inbits=in,8,'\ 'CDEF:outbits=out,8,'\ 'CDEF:ingraph=in,8,,1984000,/,100,'\ 'CDEF:outgraph=out,8,,1984000,/,100,_'\ 'CDEF:totval=ingraph,outgraph,+'\ 'VDEF:inmaxg=ingraph,MAXIMUM'\ 'VDEF:inming=ingraph,MINIMUM'\ 'VDEF:outmaxg=outgraph,MAXIMUM'\ 'VDEF:outming=outgraph,MINIMUM'\ 'VDEF:inaveg=ingraph,AVERAGE'\ 'VDEF:outaveg=outgraph,AVERAGE'\ 'VDEF:inmax=inbits,MAXIMUM'\ 'VDEF:outmax=outbits,MAXIMUM'\ 'VDEF:inmin=inbits,MINIMUM'\ 'VDEF:outmin=outbits,MINIMUM'\ 'VDEF:inave=inbits,AVERAGE'\ 'VDEF:outave=outbits,AVERAGE'\ 'COMMENT:(1984000 bps)\s'\ 'COMMENT:\s'\ 'LINE0.3:inmaxg#FF0000'\ 'LINE0.3:outmaxg#0000FF'\ 'LINE1:inaveg#660000'\ 'LINE1:outaveg#000066'\ 'LINE1:ingraph#FF0000:Inbound Traffic '\ 'GPRINT:inmax:(Max:%3.2lf%Sbps)'\ 'GPRINT:inmin:(Min:%3.2lf%Sbps)'\ 'GPRINT:inave:(Avg:%3.2lf%Sbps)'\ 'COMMENT:\s'\ 'COMMENT:\s'\ 'LINE1:outgraph#0000FF:Outbound Traffic'\ 'GPRINT:outmax:(Max:%3.2lf%Sbps)'\ 'GPRINT:outmin:(Min:%3.2lf%Sbps)'\ 'GPRINT:outave:(Avg:%3.2lf%Sbps)\s'
[oetiker] at the moment there is no magic scaling for the units of the right axis if you specify your own format ...
have a look at the code ... I'll be glad to integrate your patches if they work in a reasonable manner ...
I'll change this to an enhancement request and leave it open ...
cheers tobi
Hello I am using rrdtool to draw various graphs in a system one of which is utilisation of a network link.
First I use the following command to generate the graph.
!/bin/bash
rrdtool graph '/var/tmp/jc.png'\ --font TITLE:8:/rtnc/backend/lib/perl/includes/mrtg_graphs/routines/Arial.ttf\ --title 'Link Utilisation Link1WAN'\ --vertical-label 'Percent %'\ --right-axis 19840:0\ --right-axis-label 'Usage (bps)'\ --units-exponent 0\ --alt-y-grid\ --end 1282575378\ --start 1282488978\ --step 300\ --width 550\ --height 200\ --color BACK#ffffff\ --color SHADEA#ffffff\ --color SHADEB#ffffff\ --slope-mode\ --interlaced\ 'DEF:in=/var/tmp/jc.rrd:ds0:AVERAGE'\ 'DEF:out=/var/tmp/jc.rrd:ds1:AVERAGE'\ 'CDEF:inbits=in,8,'\ 'CDEF:outbits=out,8,'\ 'CDEF:ingraph=in,8,,1984000,/,100,'\ 'CDEF:outgraph=out,8,,1984000,/,100,_'\ 'CDEF:totval=ingraph,outgraph,+'\ 'VDEF:inmaxg=ingraph,MAXIMUM'\ 'VDEF:inming=ingraph,MINIMUM'\ 'VDEF:outmaxg=outgraph,MAXIMUM'\ 'VDEF:outming=outgraph,MINIMUM'\ 'VDEF:inaveg=ingraph,AVERAGE'\ 'VDEF:outaveg=outgraph,AVERAGE'\ 'VDEF:inmax=inbits,MAXIMUM'\ 'VDEF:outmax=outbits,MAXIMUM'\ 'VDEF:inmin=inbits,MINIMUM'\ 'VDEF:outmin=outbits,MINIMUM'\ 'VDEF:inave=inbits,AVERAGE'\ 'VDEF:outave=outbits,AVERAGE'\ 'COMMENT:(1984000 bps)\s'\ 'COMMENT:\s'\ 'LINE0.3:inmaxg#FF0000'\ 'LINE0.3:outmaxg#0000FF'\ 'LINE1:inaveg#660000'\ 'LINE1:outaveg#000066'\ 'LINE1:ingraph#FF0000:Inbound Traffic '\ 'GPRINT:inmax:(Max:%3.2lf%Sbps)'\ 'GPRINT:inmin:(Min:%3.2lf%Sbps)'\ 'GPRINT:inave:(Avg:%3.2lf%Sbps)'\ 'COMMENT:\s'\ 'COMMENT:\s'\ 'LINE1:outgraph#0000FF:Outbound Traffic'\ 'GPRINT:outmax:(Max:%3.2lf%Sbps)'\ 'GPRINT:outmin:(Min:%3.2lf%Sbps)'\ 'GPRINT:outave:(Avg:%3.2lf%Sbps)\s'
However the user viewing the graph has complained that the right axis is wrong (see attachment jc.png), as it shows 0M,1M,1M,2M,2M (some of the values are repeated). I assume this is rounding and not sure if this is a bug or not.
To resolve it, I tried adding the --right-axis-format value so the script now looks like this (the addition of --right-axis-format is the only change).
!/bin/bash
rrdtool graph '/var/tmp/jc1.png'\ --font TITLE:8:/rtnc/backend/lib/perl/includes/mrtg_graphs/routines/Arial.ttf\ --title 'Link Utilisation Link1WAN'\ --vertical-label 'Percent %'\ --right-axis 19840:0\ --right-axis-label 'Usage (bps)'\ --right-axis-format %3.2lf\ --units-exponent 0\ --alt-y-grid\ --end 1282575378\ --start 1282488978\ --step 300\ --width 550\ --height 200\ --color BACK#ffffff\ --color SHADEA#ffffff\ --color SHADEB#ffffff\ --slope-mode\ --interlaced\ 'DEF:in=/var/tmp/jc.rrd:ds0:AVERAGE'\ 'DEF:out=/var/tmp/jc.rrd:ds1:AVERAGE'\ 'CDEF:inbits=in,8,'\ 'CDEF:outbits=out,8,'\ 'CDEF:ingraph=in,8,,1984000,/,100,'\ 'CDEF:outgraph=out,8,,1984000,/,100,_'\ 'CDEF:totval=ingraph,outgraph,+'\ 'VDEF:inmaxg=ingraph,MAXIMUM'\ 'VDEF:inming=ingraph,MINIMUM'\ 'VDEF:outmaxg=outgraph,MAXIMUM'\ 'VDEF:outming=outgraph,MINIMUM'\ 'VDEF:inaveg=ingraph,AVERAGE'\ 'VDEF:outaveg=outgraph,AVERAGE'\ 'VDEF:inmax=inbits,MAXIMUM'\ 'VDEF:outmax=outbits,MAXIMUM'\ 'VDEF:inmin=inbits,MINIMUM'\ 'VDEF:outmin=outbits,MINIMUM'\ 'VDEF:inave=inbits,AVERAGE'\ 'VDEF:outave=outbits,AVERAGE'\ 'COMMENT:(1984000 bps)\s'\ 'COMMENT:\s'\ 'LINE0.3:inmaxg#FF0000'\ 'LINE0.3:outmaxg#0000FF'\ 'LINE1:inaveg#660000'\ 'LINE1:outaveg#000066'\ 'LINE1:ingraph#FF0000:Inbound Traffic '\ 'GPRINT:inmax:(Max:%3.2lf%Sbps)'\ 'GPRINT:inmin:(Min:%3.2lf%Sbps)'\ 'GPRINT:inave:(Avg:%3.2lf%Sbps)'\ 'COMMENT:\s'\ 'COMMENT:\s'\ 'LINE1:outgraph#0000FF:Outbound Traffic'\ 'GPRINT:outmax:(Max:%3.2lf%Sbps)'\ 'GPRINT:outmin:(Min:%3.2lf%Sbps)'\ 'GPRINT:outave:(Avg:%3.2lf%Sbps)\s'
This outputs the correct values (see jc1.png) but the values are so long that they over-write the key to the right-axis which looks ugly. So I tried to add %S on the end to use the suffixes as used later for the GPRINT statements in the same script. The documentation says you can use the same format string as you use for PRINT and GPRINT in the --right-axis-format. So I set the script to the following:-
!/bin/bash
rrdtool graph '/var/tmp/jc2.png'\ --font TITLE:8:/rtnc/backend/lib/perl/includes/mrtg_graphs/routines/Arial.ttf\ --title 'Link Utilisation Link1WAN'\ --vertical-label 'Percent %'\ --right-axis 19840:0\ --right-axis-label 'Usage (bps)'\ --right-axis-format %3.2lf%S\ --units-exponent 0\ --alt-y-grid\ --end 1282575378\ --start 1282488978\ --step 300\ --width 550\ --height 200\ --color BACK#ffffff\ --color SHADEA#ffffff\ --color SHADEB#ffffff\ --slope-mode\ --interlaced\ 'DEF:in=/var/tmp/jc.rrd:ds0:AVERAGE'\ 'DEF:out=/var/tmp/jc.rrd:ds1:AVERAGE'\ 'CDEF:inbits=in,8,'\ 'CDEF:outbits=out,8,'\ 'CDEF:ingraph=in,8,,1984000,/,100,'\ 'CDEF:outgraph=out,8,,1984000,/,100,_'\ 'CDEF:totval=ingraph,outgraph,+'\ 'VDEF:inmaxg=ingraph,MAXIMUM'\ 'VDEF:inming=ingraph,MINIMUM'\ 'VDEF:outmaxg=outgraph,MAXIMUM'\ 'VDEF:outming=outgraph,MINIMUM'\ 'VDEF:inaveg=ingraph,AVERAGE'\ 'VDEF:outaveg=outgraph,AVERAGE'\ 'VDEF:inmax=inbits,MAXIMUM'\ 'VDEF:outmax=outbits,MAXIMUM'\ 'VDEF:inmin=inbits,MINIMUM'\ 'VDEF:outmin=outbits,MINIMUM'\ 'VDEF:inave=inbits,AVERAGE'\ 'VDEF:outave=outbits,AVERAGE'\ 'COMMENT:(1984000 bps)\s'\ 'COMMENT:\s'\ 'LINE0.3:inmaxg#FF0000'\ 'LINE0.3:outmaxg#0000FF'\ 'LINE1:inaveg#660000'\ 'LINE1:outaveg#000066'\ 'LINE1:ingraph#FF0000:Inbound Traffic '\ 'GPRINT:inmax:(Max:%3.2lf%Sbps)'\ 'GPRINT:inmin:(Min:%3.2lf%Sbps)'\ 'GPRINT:inave:(Avg:%3.2lf%Sbps)'\ 'COMMENT:\s'\ 'COMMENT:\s'\ 'LINE1:outgraph#0000FF:Outbound Traffic'\ 'GPRINT:outmax:(Max:%3.2lf%Sbps)'\ 'GPRINT:outmin:(Min:%3.2lf%Sbps)'\ 'GPRINT:outave:(Avg:%3.2lf%Sbps)\s'
However this causes a crash:-
line 56: 11753 Segmentation fault
This looks like a bug to me. I would also appreciate your feedback on whether the scaling so the right-hand axis has duplicate values is also a bug?
I attached the RRD file in question. I am using v1.4.2 on CentOS 5.4 (Linux version 2.6.18-164.el5PAE)