[rrd-users] day of week print error on x-axis

nina wizardpoibe at gmail.com
Wed Aug 22 09:57:35 CEST 2007

I want to make weekly reporting graph.
I used command to create weekly graph as follow;

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

but as you can see this url:http://aqua.cnu.ac.kr/~nina/week3.png, x-axis
printing error is occur, I think.

and then I used perl as follow, but result is same(error).

daily, monthly, yearly graph's x-axis is printed collectly.
only when weekly graph is created, x-axis is not printed "mon,web....".

How I can disply x-axis collectly? plz help me.

# copyright Martin Pot 2003
# http://martybugs.net/linux/rrdtool/traffic.cgi
# rrd_traffic.pl

use RRDs;

# define location of rrdtool databases
my $rrd = '/home/nina/trafficMeasure/rrdDB';
# define location of images
my $img = '/home/nina/trafficMeasure';

# process data for each interface (add/delete as required)
&ProcessInterface("eth2", "OUT BOUND MIRRORING NIC");
#&ProcessInterface("eth1", "internet gateway");
#&ProcessInterface("eth2", "MartinMast wireless link");
#&ProcessInterface("eth3", "home wireless");

sub ProcessInterface
# process interface
# inputs: $_[0]: interface name (ie, eth0/eth1/eth2/ppp0)
#         $_[1]: interface description

        # get network interface info
        my $in = `/sbin/ifconfig $_[0] |grep bytes|cut -d":" -f2|cut -d" "
        my $out = `/sbin/ifconfig $_[0] |grep bytes|cut -d":" -f3|cut -d" "

        # remove eol chars

        print "$_[0] traffic in, out: $in, $out\n";

        # if rrdtool database doesn't exist, create it
        if (! -e "$rrd/$_[0].rrd")
                print "creating rrd database for $_[0] interface...\n";
                RRDs::create "$rrd/$_[0].rrd",
                        "-s 300",

        # insert values into rrd
        RRDs::update "$rrd/$_[0].rrd",
                "-t", "in:out",

        # create traffic graphs
        &CreateGraph($_[0], "day", $_[1]);
        &CreateGraph($_[0], "week", $_[1]);
        &CreateGraph($_[0], "month", $_[1]);

        &CreateGraph($_[0], "year", $_[1]);

sub CreateGraph
# creates graph
# inputs: $_[0]: interface name (ie, eth0/eth1/eth2/ppp0)
#         $_[1]: interval (ie, day, week, month, year)
#         $_[2]: interface description

        RRDs::graph "$img/$_[0]-$_[1].png",
                "-s -1$_[1]",
                "-t traffic on $_[0] :: $_[2]",
                "-h", "80", "-w", "600",
                "-l 0",
                "-a", "PNG",
                "-v bytes/sec",
                "GPRINT:in:MAX:  Max\\: %5.1lf %s",
                "GPRINT:in:AVERAGE: Avg\\: %5.1lf %S",
                "GPRINT:in:LAST: Current\\: %5.1lf %Sbytes/sec\\n",
                "GPRINT:out:MAX:  Max\\: %5.1lf %S",
                "GPRINT:out:AVERAGE: Avg\\: %5.1lf %S",
                "GPRINT:out:LAST: Current\\: %5.1lf %Sbytes/sec",
        if ($ERROR = RRDs::error) { print "$0: unable to generate $_[0]
$_[1] traffic graph: $ERROR\n"; }

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/rrd-users/attachments/20070822/f7b3594c/attachment.html 

More information about the rrd-users mailing list