i use the RRD-tool for Networkanalysis.
I measure the traffic of the Interface etho.
then i graph it with the rrdtool graph funktion.
then i calculate the maximum traffic within the timespan.
I have a 2Mbs Interface.
Now i will calculate the percentage of the maximum traffic to this 2Mbps.
Example: my maximum traffic rate is 1Mbps .this is 50% of 2Mbps.
In sourcecode i try to do this with the VDEF:
Code: Select all
RRDs::graph("/space/mrtg/test/load.png",
"--vertical-label= traffic in bps",
"--title=Network Interface $Interface",
"--width=600",
"--height=200",
"--start=$begin",
"--end= $end",
"DEF:eth0r=$DB:ds1:MAX",
"CDEF:eth0rb=eth0r,8,*",
"CDEF:eth0tb=eth0t,8,*",
"VDEF:ethomax=100,2000000,/eth0r,MAXIMUM,*",
'HRULE:2000000#FF0000:100% bandwidth (2 Mbps)\n',
'COMMENT: Average Maximum Current\n',
"AREA:eth0rb#778899:Receive ",
'GPRINT:eth0rb:AVERAGE:%12.2lf %sbps',
'GPRINT:eth0rb:MAX:%12.2lf %sbps',
'GPRINT:eth0rb:LAST:%12.2lf %sbps\n',) or
die "graph failed ($RRDs::error)"
an idea????
thanks