Previous page: tidier text
Next page: Flow wrt Red

Alternate Graph Style

Tested on: 1.4.21

I wanted to see my incoming and outgoing traffic more clearly than than the standard graphs.   This is what I wanted:

new graph

  1. Edit /usr/local/bin/makegraphs for this change. Replace the updateifgraph procedure to read:
    sub updateifgraph {
    my $interface = $_[0];
    my $period    = $_[1];

    RRDs::graph ("$graphs/$interface-$period.png",
    "--start", "-1$period", "-aPNG", "-i", "-z",
    "--alt-y-grid", "-w 600", "-h 100",
    "--color", "SHADEA#EAE9EE",
    "--color", "SHADEB#EAE9EE",
    "--color", "BACK#EAE9EE",
    "-t $tr{'traffic on'} $interface ($tr{'graph per'} $tr{$period})",
    "-v$tr{'bytes per second'}",
    "DEF:incoming=$rrdlog/$interface.rrd:incoming:AVERAGE",
    "DEF:outgoing=$rrdlog/$interface.rrd:outgoing:AVERAGE",
    # EAK <=
    "CDEF:out_neg=outgoing,-1,*",
    "AREA:incoming#33cc33:$tr{'incoming traffic in bytes per second'}\\j",
    "LINE1:incoming#006600",
    "AREA:out_neg#ff3333:$tr{'outgoing traffic in bytes per second'}\\j",
    "LINE1:out_neg#990000",
    #"AREA:incoming#00FF00:$tr{'incoming traffic in bytes per second'}\\j",
    #"LINE1:outgoing#0000FF:$tr{'outgoing traffic in bytes per second'}\\j",
    # => EAK
    "GPRINT:incoming:MAX:$tr{'maximal'} $tr{'in'}\\:%8.3lf %sBps",
    "GPRINT:incoming:AVERAGE:$tr{'average'} $tr{'in'}\\:%8.3lf %sBps",
    "GPRINT:incoming:LAST:$tr{'current'} $tr{'in'}\\:%8.3lf %sBps\\j",
    "GPRINT:outgoing:MAX:$tr{'maximal'} $tr{'out'}\\:%8.3lf %sBps",
    "GPRINT:outgoing:AVERAGE:$tr{'average'} $tr{'out'}\\:%8.3lf %sBps",
    "GPRINT:outgoing:LAST:$tr{'current'} $tr{'out'}\\:%8.3lf %sBps\\j");
    $ERROR = RRDs::error;
    print "Error in RRD::graph for $interface: $ERROR\n" if $ERROR;
    }

Job Done.