<div>I want to make weekly reporting graph.</div>
<div>I used command to create weekly graph as follow;</div>
<div> </div>
<div>rrdtool graph week3.png -s -1week -t test --lazy -h 80 -w 600 -l 0 -a PNG DEF:in=test.rrd:in:AVERAGE AREA:in#32CD32:Incoming</div>
<div> </div>
<div>but as you can see this url:<a href="http://aqua.cnu.ac.kr/~nina/week3.png">http://aqua.cnu.ac.kr/~nina/week3.png</a>, x-axis printing error is occur, I think.</div>
<div> </div>
<div>and then I used perl as follow, but result is same(error).</div>
<div> </div>
<div>daily, monthly, yearly graph's x-axis is printed collectly.</div>
<div>only when weekly graph is created, x-axis is not printed "mon,web....".</div>
<div> </div>
<div>How I can disply x-axis collectly? plz help me.</div>
<div>------------</div>
<div>
<p>#!/usr/bin/perl<br>#<br># copyright Martin Pot 2003<br># <a href="http://martybugs.net/linux/rrdtool/traffic.cgi">http://martybugs.net/linux/rrdtool/traffic.cgi</a><br>#<br># rrd_traffic.pl</p>
<p>use RRDs;</p>
<p># define location of rrdtool databases<br>my $rrd = '/home/nina/trafficMeasure/rrdDB';<br># define location of images<br>my $img = '/home/nina/trafficMeasure';</p>
<p># process data for each interface (add/delete as required)<br>&ProcessInterface("eth2", "OUT BOUND MIRRORING NIC");<br>#&ProcessInterface("eth1", "internet gateway");<br>
#&ProcessInterface("eth2", "MartinMast wireless link");<br>#&ProcessInterface("eth3", "home wireless");</p>
<p>sub ProcessInterface<br>{<br># process interface<br># inputs: $_[0]: interface name (ie, eth0/eth1/eth2/ppp0)<br># $_[1]: interface description</p>
<p> # get network interface info<br> my $in = `/sbin/ifconfig $_[0] |grep bytes|cut -d":" -f2|cut -d" " -f1`;<br> my $out = `/sbin/ifconfig $_[0] |grep bytes|cut -d":" -f3|cut -d" " -f1`;
</p>
<p> # remove eol chars<br> chomp($in);<br> chomp($out);</p>
<p> print "$_[0] traffic in, out: $in, $out\n";</p>
<p> # if rrdtool database doesn't exist, create it<br> if (! -e "$rrd/$_[0].rrd")<br> {<br> print "creating rrd database for $_[0] interface...\n";<br> RRDs::create "$rrd/$_[0].rrd",
<br> "-s 300",<br> "DS:in:DERIVE:600:0:12500000",<br> "DS:out:DERIVE:600:0:12500000",<br> "RRA:AVERAGE:
0.5:1:576",<br> "RRA:AVERAGE:0.5:6:672",<br> "RRA:AVERAGE:0.5:24:732",<br> "RRA:AVERAGE:0.5:144:1460";<br> }</p>
<p> # insert values into rrd<br> RRDs::update "$rrd/$_[0].rrd",<br> "-t", "in:out",<br> "N:$in:$out";</p>
<p> # create traffic graphs<br> &CreateGraph($_[0], "day", $_[1]);<br> &CreateGraph($_[0], "week", $_[1]);<br> &CreateGraph($_[0], "month", $_[1]);</p>
<p> &CreateGraph($_[0], "year", $_[1]);<br>}</p>
<p>sub CreateGraph<br>{<br># creates graph<br># inputs: $_[0]: interface name (ie, eth0/eth1/eth2/ppp0)<br># $_[1]: interval (ie, day, week, month, year)<br># $_[2]: interface description</p>
<p> RRDs::graph "$img/$_[0]-$_[1].png",<br> "-s -1$_[1]",<br> "-t traffic on $_[0] :: $_[2]",<br> "--lazy",<br> "-h", "80", "-w", "600",
<br> "-l 0",<br> "-a", "PNG",<br> "-v bytes/sec",<br> "DEF:in=$rrd/$_[0].rrd:in:AVERAGE",<br> "DEF:out=$rrd/$_[0].rrd:out:AVERAGE",
<br> "CDEF:out_neg=out,-1,*",<br> "AREA:in#32CD32:Incoming",<br> "LINE1:in#336600",<br> "GPRINT:in:MAX: Max\\: %5.1lf %s",
<br> "GPRINT:in:AVERAGE: Avg\\: %5.1lf %S",<br> "GPRINT:in:LAST: Current\\: %5.1lf %Sbytes/sec\\n",<br> "AREA:out_neg#4169E1:Outgoing",<br> "LINE1:out_neg#0033CC",
<br> "GPRINT:out:MAX: Max\\: %5.1lf %S",<br> "GPRINT:out:AVERAGE: Avg\\: %5.1lf %S",<br> "GPRINT:out:LAST: Current\\: %5.1lf %Sbytes/sec",<br> "HRULE:0#000000";
<br> if ($ERROR = RRDs::error) { print "$0: unable to generate $_[0] $_[1] traffic graph: $ERROR\n"; }<br>}</p>
<p>or</p>
<p> <br></p>
<p> </p></div>