Print this pagePrint this page

Single IP

Net Traffic for a particular IP

This modification is just an editing exercise of he existing net traffic modification. For this example I am jsut going to squeeze the traffic on 192.168.0.164 (ACER) into the existing  net traffic page.  It'll look like this:

acer

As stated in the introduction the information must be available already.  So in this case I am collecting the data as part of the extra graph modification.

 

  1. Edit the file /var/ipcop/net-traffic/net-traffic-lib.pl so that it looks like this:
    ## Net-Traffic variables ##
    my %allDays;
    my $allDaysBytes;
    my $tzoffset = 0;
    my $displayMode = "daily";
    my ($curMonth, $curYear);
    ${Traffic::blue_in} = 'incoming BLUE';
    ${Traffic::green_in} = 'incoming GREEN';
    ${Traffic::orange_in} = 'incoming ORANGE';
    ${Traffic::red_in} = 'incoming RED';
    ${Traffic::blue_out} = 'outgoing BLUE';
    ${Traffic::green_out} = 'outgoing GREEN';
    ${Traffic::orange_out} = 'outgoing ORANGE';
    ${Traffic::red_out} = 'outgoing RED';

    # EAK ->
    $Acer_in = 'incoming ACER';
    $Acer_out = 'outgoing ACER';
    # <- EAK


    sub calcTraffic{
        $allDaysBytes = shift;
        $starttime = shift;
        $endtime = shift;
        $displayMode = shift;
  2. and
    # initialize data variables for a new rule - if it is new
    sub init_filter_id {
        my($s, $ifile) = @_;

        if (!defined $allDaysBytes->{$s}) {
            if ($displayMode =~ /^daily/) {
                my $newDay = &makemydailytime($s);
                $newDay =~ /^\d\d\d\d-(\d\d)-\d\d$/;

                return 1 if ($1 > $curMonth && $displayMode ne "daily_multi");

                $allDaysBytes->{$s}{'Day'} = $newDay;
            }
            else {
                $allDaysBytes->{$s}{'Day'} = &makemymonthlytime($s);
            }
            $allDaysBytes->{$s}{${Traffic::blue_in}} = int(0);
            $allDaysBytes->{$s}{${Traffic::green_in}} = int(0);
            $allDaysBytes->{$s}{${Traffic::orange_in}} = int(0);
            $allDaysBytes->{$s}{${Traffic::red_in}} = int(0);
            $allDaysBytes->{$s}{${Traffic::blue_out}} = int(0);
            $allDaysBytes->{$s}{${Traffic::green_out}} = int(0);
            $allDaysBytes->{$s}{${Traffic::orange_out}} = int(0);
            $allDaysBytes->{$s}{${Traffic::red_out}} = int(0);
    # EAK - >
            $allDaysBytes->{$s}{$Acer_in} = int(0);
            $allDaysBytes->{$s}{$Acer_out} = int(0);
    # <- EAK

        }
        return 0;
    }

    # read data record from filehandle $1
    # number of records is $2
    # Return value: reference to array a of length n;
    #     n is the number of rules
    #     each field in a is an array aa with 3 fields
    #    the fields in arrays aa are: [0]=name of rule; [1]=byte count;
    #    [2]=packet count
  3. Next edit /home/httpd/cgi-bin/traffic.cgi like this:
    #!/usr/bin/perl
    #
    # SmoothWall CGIs
    #
    # This code is distributed under the terms of the GPL
    #
    # (c) The SmoothWall Team
    #
    # $Id: traffic.cgi,v 1.19.2.1 2007-06-16 13:04:26 dotzball Exp $
    #
    # traffic.cgi, v1.1.0 2003/10/18
    #    supports now:
    #        * IPCop v1.3.0
    #        * choosing year
    #
    # 18 June 2004 Achim Weber
    #    - added functionality to work with IPCop 1.4.0
    #    - use some functions from ipacsum

    use strict;

    # enable only the following on debugging purpose
    #use warnings;
    #use CGI::Carp 'fatalsToBrowser';

    require '/var/ipcop/general-functions.pl';
    require "${General::swroot}/lang.pl";
    require "${General::swroot}/header.pl";
    require "${General::swroot}/net-traffic/net-traffic-admin.pl";
    require "${General::swroot}/net-traffic/net-traffic-lib.pl";

    my @dummy = (@NETTRAFF::months, @NETTRAFF::longmonths, $NETTRAFF::colorOk, $NETTRAFF::colorWarn, $NETTRAFF::colorMax);
    undef(@dummy);

    my %cgiparams;
    my %pppsettings;
    my %netsettings;

    &General::readhash("${General::swroot}/ppp/settings", \%pppsettings);
    &General::readhash("${General::swroot}/ethernet/settings", \%netsettings);

    my @now = localtime(time);

    $now[5] = $now[5]+1900;

    $cgiparams{'STARTYEAR'} = $now[5];
    $cgiparams{'STARTMONTH'} = $now[4];

    my $startDay = '1';
    my $endDay = '1';

    if($NETTRAFF::settings{'MONTHLY_VOLUME_ON'} eq 'on')
    {
        $startDay = $NETTRAFF::settings{'STARTDAY'};
        $endDay = $NETTRAFF::settings{'STARTDAY'};
    }

    # this periode started last month
    if ($now[3] < $startDay)
    {
        # when current month is january we start in last year december
        if ($now[4] == 0) {
            $cgiparams{'STARTYEAR'} = $now[5]-1;
            $cgiparams{'STARTMONTH'} = 11;
        }
        else
        {
            $cgiparams{'STARTYEAR'} = $now[5];
            $cgiparams{'STARTMONTH'} = $now[4]-1;
        }
    }

    &Header::getcgihash(\%cgiparams);

    my $showAllTraff = 0;
    my $selectYearALL = "";
    if($cgiparams{'STARTYEAR'} eq '????') {
        $selectYearALL = 'selected=\'selected\'';
        $showAllTraff = 1;
    }

    my $selectMonthALL = "";
    if($cgiparams{'STARTMONTH'} eq '??') {
        $selectMonthALL = 'selected=\'selected\'';
        $showAllTraff = 1;
    }

    &Header::showhttpheaders();

    &Header::openpage($Lang::tr{'sstraffic'}, 1, '');

    &Header::openbigbox('100%', 'left');

    &NETTRAFF::showNetTrafficVersion();

    &Header::openbox('100%', 'left', "");

    my $firstDayTxt = '';

    if($NETTRAFF::settings{'MONTHLY_VOLUME_ON'} eq 'on')
    {
        $firstDayTxt = " ($Lang::tr{'monthly volume start day short'}: $NETTRAFF::settings{'STARTDAY'}.)";
    }

    print <<END;
        <table width='100%' align='center'>
        <tr>
            <td width='90%' align='left' nowrap='nowrap'>
                <form method='post' action='/cgi-bin/traffic.cgi'>
                    $Lang::tr{'selecttraffic'}$firstDayTxt:
                    <select name='STARTMONTH'>
    END

    foreach my $month (@NETTRAFF::months)
    {
        print "\t<option ";
        if ("$month" eq "$cgiparams{'STARTMONTH'}") {
            print 'selected=\'selected\' '; }
        print "value='$month'>$NETTRAFF::longmonths[$month]</option>\n";
    }

    print <<END;
                        <option $selectMonthALL value='??'>$Lang::tr{'allmsg'}</option>
                    </select>
                    <select name='STARTYEAR'>
    END

    for (my $index=0; $index<=$#NETTRAFF::years; $index++) {
        print "\t<option ";
        if ("$NETTRAFF::years[$index]" eq "$cgiparams{'STARTYEAR'}") {
            print 'selected=\'selected\' '; }
        print "value='$NETTRAFF::years[$index]'>$NETTRAFF::years[$index]</option>\n";
    }

    print <<END;
                        <option $selectYearALL value='????'>$Lang::tr{'allmsg'}</option>
                    </select>
                    <input type='submit' name='ACTION' value='$Lang::tr{'update'}' />
                </form>
            </td>
            <td width='5%' align='center'>
                <form method='post' action='/cgi-bin/trafficadm.cgi'>
                <input type='submit' name='ACTION' value='$Lang::tr{'net-traffic configuration'}' />
                </form>
            </td>
            <td width='5%' align='center'>
                <form method='post' action='/cgi-bin/traffics.cgi'>
                <input type='submit' name='ACTION' value=' > ' />
                </form>
            </td>
        </tr>
        </table>
    END

    &Header::closebox();

    &Header::openbox('100%', 'left', "$Lang::tr{'traffics'}:");

    my $dateWidth = '20%';
    my $netWidth = '34%';
    my $inOutWidth = '17%';
    my $monthlyWidth = '0%';

    # 4 networks
    if ($netsettings{'CONFIG_TYPE'} =~ /^(5|7)$/) {
        $dateWidth = '12%';
        $netWidth = '22%';
        $inOutWidth = '11%';
        if($showAllTraff && $NETTRAFF::settings{'MONTHLY_VOLUME_ON'} eq 'on')
        {
            $dateWidth = '11%';
            $netWidth = '20%';
            $inOutWidth = '10%';
            $monthlyWidth = '10%';
        }
    }
    # 3 networks
    elsif ($netsettings{'CONFIG_TYPE'} =~ /^(1|3|4|6)$/) {
        $dateWidth = '16%';
        $netWidth = '28%';
        $inOutWidth = '14%';
        if($showAllTraff && $NETTRAFF::settings{'MONTHLY_VOLUME_ON'} eq 'on')
        {
            $dateWidth = '14%';
            $netWidth = '24%';
            $inOutWidth = '12%';
            $monthlyWidth = '14%';
        }
    }
    elsif($showAllTraff && $NETTRAFF::settings{'MONTHLY_VOLUME_ON'} eq 'on')
    {
        # 2 networks but with show all
        $dateWidth = '18%';
        $netWidth = '32%';
        $inOutWidth = '16%';
        $monthlyWidth = '18%';
    }
    # EAK -> 
    # force 4 columns for now (red, green, orange and mine). 
    # This can and should be done a lot better, but this is a quick fix to demonstrate theoutput
      $dateWidth = '12%';
        $netWidth = '22%';
        $inOutWidth = '11%';
        if($showAllTraff && $NETTRAFF::settings{'MONTHLY_VOLUME_ON'} eq 'on')
        {
            $dateWidth = '11%';
            $netWidth = '20%';
            $inOutWidth = '10%';
            $monthlyWidth = '10%';
        }
    # <- EAK

    print <<END;
        <table width='100%'>
        <tr>
            <td width='$dateWidth' align='center' class='boldbase'></td>
            <td width='$netWidth' align='center' class='boldbase' ><b>$Lang::tr{'trafficgreen'}</b></td>
            <td width='$netWidth' align='center' class='boldbase' ><b>'Acer'</b></td>
    END

    if ($netsettings{'CONFIG_TYPE'} =~ /^(4|5|6|7)$/) {
        print "<td width='$netWidth' align='center' class='boldbase' ><b>$Lang::tr{'trafficblue'}</b></td>\n";
    }

    if ($netsettings{'CONFIG_TYPE'} =~ /^(1|3|5|7)$/) {
        print "<td width='$netWidth' align='center' class='boldbase' ><b>$Lang::tr{'trafficorange'}</b></td>\n";
    }

    print "<td width='$netWidth' align='center' class='boldbase'><b>$Lang::tr{'trafficred'}</b></td>\n";

    if($NETTRAFF::settings{'MONTHLY_VOLUME_ON'} eq 'on' && $showAllTraff==1) {
        print "<td width='$monthlyWidth' align='center' class='boldbase'><b>$Lang::tr{'monthly volume'} ($NETTRAFF::settings{'MONTHLY_VOLUME'} MB)</b></td>\n";
    }
    print <<END;
        </tr>
        </table>
        <table width='100%'>
        <tr>
            <td width='$dateWidth' align='center' class='boldbase'><b>$Lang::tr{'trafficdate'}</b></td>
            <td width='$inOutWidth' align='center' class='boldbase'><font color='#16A61D'><b>$Lang::tr{'trafficin'}</b></font></td>
            <td width='$inOutWidth' align='center' class='boldbase'><font color='#16A61D'><b>$Lang::tr{'trafficout'}</b></font></td>
            <td width='$inOutWidth' align='center' class='boldbase'><font color='#16A600'><b>$Lang::tr{'trafficin'}</b></font></td>
            <td width='$inOutWidth' align='center' class='boldbase'><font color='#16A600'><b>$Lang::tr{'trafficout'}</b></font></td>


    END

    if ($netsettings{'CONFIG_TYPE'} =~ /^(4|5|6|7)$/)
    {
        print "<td width='$inOutWidth' align='center' class='boldbase'><font color='${Header::colourblue}'><b>$Lang::tr{'trafficin'}</b></font></td>";
        print "<td width='$inOutWidth' align='center' class='boldbase'><font color='${Header::colourblue}'><b>$Lang::tr{'trafficout'}</b></font></td>";
    }

    if ($netsettings{'CONFIG_TYPE'} =~ /^(1|3|5|7)$/)
    {
        print "<td width='$inOutWidth' align='center' class='boldbase'><font color='#FF9933'><b>$Lang::tr{'trafficin'}</b></font></td>";
        print "<td width='$inOutWidth' align='center' class='boldbase'><font color='#FF9933'><b>$Lang::tr{'trafficout'}</b></font></td>";
    }
    print <<END;
            <td width='$inOutWidth' align='center' class='boldbase'><font color='#CE1B31'><b>$Lang::tr{'trafficin'}</b></font></td>
            <td width='$inOutWidth' align='center' class='boldbase'><font color='#CE1B31'><b>$Lang::tr{'trafficout'}</b></font></td>
    END

    if($NETTRAFF::settings{'MONTHLY_VOLUME_ON'} eq 'on' && $showAllTraff==1) {
        print "<td width='$monthlyWidth' align='center' class='boldbase'></td>\n";
    }

    print "</tr>\n";


    my $total_blue_in=0;
    my $total_blue_out=0;
    my $total_green_in=0;
    my $total_green_out=0;
    my $total_orange_in=0;
    my $total_orange_out=0;
    my $total_red_in=0;
    my $total_red_out=0;
    # EAK ->
    my $total_Acer_in=0;
    my $total_Acer_out=0;
    # <- EAK

    my $lines=0;



    my $startYear = $cgiparams{'STARTYEAR'};
    my $endYear = $cgiparams{'STARTYEAR'};
    my $startMonth = $cgiparams{'STARTMONTH'};
    my $endMonth = $cgiparams{'STARTMONTH'};
    my $displayMode = "daily_multi";
    $startDay = '1';
    $endDay = '1';
    my $selectedMonth = '0';

    if($NETTRAFF::settings{'MONTHLY_VOLUME_ON'} eq 'on')
    {
        $startDay = $NETTRAFF::settings{'STARTDAY'};
        $endDay = $NETTRAFF::settings{'STARTDAY'};
    }

    # "show All ?
    if ($cgiparams{'STARTYEAR'} eq '????')
    {
        # 'show all month' + 'show all years'
        # OR <selected Month> + 'show all years'

        # if we have a <selected Month>, we read all traffic but display only the selected month
        if($cgiparams{'STARTMONTH'} ne '??')
        {
            $selectedMonth = $cgiparams{'STARTMONTH'} + 1;
            $selectedMonth = $selectedMonth < 10 ? $selectedMonth = "0".$selectedMonth : $selectedMonth;
        }

        $displayMode = "monthly";
        # start with 1970-01-01
        $startYear = 1970;
        $startMonth = '1';
        $startDay = '1';
        # end with next year: 20xx-01-01
        $endYear = $now[5] + 1;
        $endMonth = '1';
        $endDay = '1';
    }
    elsif ($cgiparams{'STARTMONTH'} eq '??')
    {
        # 'show all month' + 200x
        $displayMode = "monthly";
        # start with 200x-01-01
        $startMonth = '1';
        $startDay = '1';
        # end with (200x+1)-01-01
        $endYear = $startYear + 1;
        $endMonth = '1';
        $endDay = '1';
    }
    else
    {
        # no "Show All"
        $startMonth++;
        $endMonth = $endMonth + 2;

        # this periode started last month
        if ($now[3] < $startDay)
        {
            # when current month is january we start in last year december
            if ($endMonth == 1) {
                $startYear--;
                $startMonth = 12;
            }
        }
        else
        {
            # when we are in december, this periode ends next year january
            if ($startMonth == 12) {
                $endYear++;
                $endMonth = 1;
            }
        }
    }



    $startMonth = $startMonth < 10 ? $startMonth = "0".$startMonth : $startMonth;
    $endMonth = $endMonth < 10 ? $endMonth = "0".$endMonth : $endMonth;
    $startDay = $startDay < 10 ? $startDay = "0".$startDay : $startDay;
    $endDay = $endDay < 10 ? $endDay = "0".$endDay : $endDay;

    my $start = "$startYear$startMonth$startDay";
    my $end = "$endYear$endMonth$endDay";

    my %allDaysBytes = ();
    my @allDays = &Traffic::calcTraffic(\%allDaysBytes,$start,$end, $displayMode);


    foreach (@allDays)
    {
        # special code for: <selected Month> + 'show all years'
        if($cgiparams{'STARTMONTH'} ne '??' && $cgiparams{'STARTYEAR'} eq '????')
        {
            # show only those traffic in the selected month
            if($allDaysBytes{$_}{'Day'} !~ /^\d\d\d\d-$selectedMonth$/)
            {
                next;
            }
        }

        $total_green_in += $allDaysBytes{$_}{${Traffic::green_in}};
        $total_green_out += $allDaysBytes{$_}{${Traffic::green_out}};
    # EAK ->
        $total_Acer_in += $allDaysBytes{$_}{$Traffic::Acer_in};
        $total_Acer_out += $allDaysBytes{$_}{$Traffic::Acer_out};
    # <- EAK

        if ($netsettings{'CONFIG_TYPE'} =~ /^(4|5|6|7)$/)
        {
            $total_blue_in += $allDaysBytes{$_}{${Traffic::blue_in}};
            $total_blue_out += $allDaysBytes{$_}{${Traffic::blue_out}};
        }

        if ($netsettings{'CONFIG_TYPE'} =~ /^(1|3|5|7)$/)
        {
            $total_orange_in += $allDaysBytes{$_}{${Traffic::orange_in}};
            $total_orange_out += $allDaysBytes{$_}{${Traffic::orange_out}};
        }

        $total_red_in += $allDaysBytes{$_}{${Traffic::red_in}};
        $total_red_out += $allDaysBytes{$_}{${Traffic::red_out}};

        if ($lines % 2) {
            print "<tr bgcolor='${Header::table1colour}'>"; }
        else {
            print "<tr bgcolor='${Header::table2colour}'>"; }

        printf "<td align='center' nowrap='nowrap'>%s</td>\n", $allDaysBytes{$_}{'Day'};
        printf "<td align='center' nowrap='nowrap'>%.3f</td>\n", ($allDaysBytes{$_}{${Traffic::green_in}}/1048576);
        printf "<td align='center' nowrap='nowrap'>%.3f</td>\n", ($allDaysBytes{$_}{${Traffic::green_out}}/1048576);
    # EAK ->
        printf "<td align='center' nowrap='nowrap'>%.3f</td>\n", ($allDaysBytes{$_}{$Traffic::Acer_in}/1048576);
        printf "<td align='center' nowrap='nowrap'>%.3f</td>\n", ($allDaysBytes{$_}{$Traffic::Acer_out}/1048576);
    # <- EAK


        if ($netsettings{'CONFIG_TYPE'} =~ /^(4|5|6|7)$/)
        {
            printf "<td align='center' nowrap='nowrap'>%.3f</td>\n", ($allDaysBytes{$_}{${Traffic::blue_in}}/1048576);
            printf "<td align='center' nowrap='nowrap'>%.3f</td>\n", ($allDaysBytes{$_}{${Traffic::blue_out}}/1048576);
        }
        if ($netsettings{'CONFIG_TYPE'} =~ /^(1|3|5|7)$/)
        {
            printf "<td align='center' nowrap='nowrap'>%.3f</td>\n", ($allDaysBytes{$_}{${Traffic::orange_in}}/1048576);
            printf "<td align='center' nowrap='nowrap'>%.3f</td>\n", ($allDaysBytes{$_}{${Traffic::orange_out}}/1048576);
        }

        printf "<td align='center' nowrap='nowrap'>%.3f</td>\n", ($allDaysBytes{$_}{${Traffic::red_in}}/1048576);
        printf "<td align='center' nowrap='nowrap'>%.3f</td>\n", ($allDaysBytes{$_}{${Traffic::red_out}}/1048576);

        if($showAllTraff && $NETTRAFF::settings{'MONTHLY_VOLUME_ON'} eq 'on')
        {
            my $total_red = ($allDaysBytes{$_}{${Traffic::red_in}} + $allDaysBytes{$_}{${Traffic::red_out}})/1048576;
            my $color = &getMonthlyVolumeColor($total_red);

            printf("<td align='center' nowrap='nowrap' bgcolor='$color'>%.2f</td>\n", $total_red);
        }
        print "</tr>\n";

        $lines++;
    }

    $total_green_in=sprintf("%.2f", ($total_green_in/1048576));
    $total_green_out=sprintf("%.2f", ($total_green_out/1048576));
    # EAK ->
    $total_Acer_in=sprintf("%.2f", ($total_Acer_in/1048576));
    $total_Acer_out=sprintf("%.2f", ($total_Acer_out/1048576));
    # <- EAK

    $total_blue_in=sprintf("%.2f", ($total_blue_in/1048576));
    $total_blue_out=sprintf("%.2f", ($total_blue_out/1048576));
    $total_orange_in=sprintf("%.2f", ($total_orange_in/1048576));
    $total_orange_out=sprintf("%.2f", ($total_orange_out/1048576));
    $total_red_in=sprintf("%.2f", ($total_red_in/1048576));
    $total_red_out=sprintf("%.2f", ($total_red_out/1048576));

    if ($lines % 2) {print "<tr bgcolor='${Header::table1colour}'>"; }
    else {print "<tr bgcolor='${Header::table2colour}'>"; }

    print <<END;
        <td align='center' class='boldbase' height='20' nowrap='nowrap'><b>$Lang::tr{'trafficsum'}</b></td>
        <td align='center' class='boldbase' nowrap='nowrap'><b>$total_green_in MB</b></td>
        <td align='center' class='boldbase' nowrap='nowrap'><b>$total_green_out MB</b></td>
        <td align='center' class='boldbase' nowrap='nowrap'><b>$total_Acer_in MB</b></td>
        <td align='center' class='boldbase' nowrap='nowrap'><b>$total_Acer_out MB</b></td>


    END

    my $orangeBlueColcount = 0;
    if ($netsettings{'CONFIG_TYPE'} =~ /^(4|5|6|7)$/)
    {
        $orangeBlueColcount += 2;
        print "<td align='center' class='boldbase' nowrap='nowrap'><b>$total_blue_in MB</b></td>";
        print "<td align='center' class='boldbase' nowrap='nowrap'><b>$total_blue_out MB</b></td>";
    }

    if ($netsettings{'CONFIG_TYPE'} =~ /^(1|3|5|7)$/)
    {
        $orangeBlueColcount += 2;
        print "<td align='center' class='boldbase' nowrap='nowrap'><b>$total_orange_in MB</b></td>";
        print "<td align='center' class='boldbase' nowrap='nowrap'><b>$total_orange_out MB</b></td>";
    }

    print <<END;
            <td align='center' class='boldbase' nowrap='nowrap'><b>$total_red_in MB</b></td>
            <td align='center' class='boldbase' nowrap='nowrap'><b>$total_red_out MB</b></td>
    END

    if($NETTRAFF::settings{'MONTHLY_VOLUME_ON'} eq 'on')
    {
        my $total_red_all = sprintf("%.2f", ($total_red_in + $total_red_out));

        if($showAllTraff==0)
        {
            my $colcount = 3 + $orangeBlueColcount;
            my $color = &getMonthlyVolumeColor($total_red_all);

            print <<END;
            </tr>
            <tr>
                <td align='left' class='boldbase' height='20' nowrap='nowrap' colspan='$colcount'><b>$Lang::tr{'monthly volume'} ($NETTRAFF::settings{'MONTHLY_VOLUME'} MB)</b></td>
                <td align='center' class='boldbase' nowrap='nowrap' bgcolor='$color' colspan='2'><b>$total_red_all MB</b></td>
            </tr>
    END
        }
        else
        {
            print <<END;
                <td align='center' class='boldbase' nowrap='nowrap' ><b>$total_red_all MB</b></td>
            </tr>
    END
        }
    }

    print <<END;
        </table>
    END

    &Header::closebox();

    &Header::closebigbox();

    &Header::closepage();



    sub getMonthlyVolumeColor
    {
        my $total_red = shift;
        my $color = $NETTRAFF::colorOk;
        my $warnTraff = ($NETTRAFF::settings{'MONTHLY_VOLUME'} * $NETTRAFF::settings{'WARN'} / 100);

        if($NETTRAFF::settings{'WARN_ON'} eq 'on'
            && $warnTraff < $total_red)
        {
            $color = $NETTRAFF::colorWarn;
        }
        if($NETTRAFF::settings{'MONTHLY_VOLUME'} < $total_red)
        {
            $color = $NETTRAFF::colorMax;
        }
        return $color;
    }


That's really it in its simplest form.  Depending on your requirements the file/s can be adjusted to suit. You will probably at least want to amend trafics.cgi as well to complement the above. I adopted the approach of copying the net traffic files in full, altering them to display my information (ie a range of IPs, range of subnets and/or range of ports) and then added them as seperate enties off the ipcop menu

This page has been viewed 707 times since Nov 2009.


Previous page: Introduction
Next page: Subnet/Seperate Page