Previous page: Extra Traffic Graphs
Next page: Ports

Single IPs or Ranges of IPs

I wanted extra traffic graphs to monitor traffic for individual madhines and subnets.   So I wrote the modification below.   However there is a far more elegant solution now and it can be found at - I have tested this on 1.4.21 and it is a very good solution - it even includes the option for an alternative graph style. However if you want to do it the hard way, this page records my earlier mod.

Tested on 1.4.18

Ok, so you want extra traffic graphs?   I did to, I wanted to see the traffic on individual PC's on my LAN.   This is workable for a small number of machines or subnets. This example produces a graph for a green machine on ip and displays it off a seperate menu



  1. Add to /etc/rc.d/helper/ in the region of the existing incoming GREEN:
    # " name " "table" "interface" "proto" "src" "dest"
    print FILE "incoming ACER ($settings{'GREEN_DEV'})|ipac~o|$settings{'GREEN_DEV'}|all|||\n";
    print FILE "outgoing ACER ($settings{'GREEN_DEV'})|ipac~i|$settings{'GREEN_DEV'}|all|||\n";
    print FILE "forwarded incoming ACER ($settings{'GREEN_DEV'})|ipac~fi|$settings{'GREEN_DEV'}|all|||\n";
    print FILE "forwarded outgoing ACER ($settings{'GREEN_DEV'})|ipac~fo|$settings{'GREEN_DEV'}|all|||\n";  

    Note: For a range of ip's or subnet, use the syntax etc in place of the single ip.
  2. Run /etc/rc.d/helper/ to action the change.
  3. In the file /usr/local/bin/makegraphs under
    if (@ipacsum) {
    updateifdata   ("GREEN");


    updateifdata ("ACER");
  4. and near the end of the file add:
    if ( -e "$rrdlog/ACER.rrd") {
    updateifgraph ("ACER", "day");
    updateifgraph ("ACER", "week");
    updateifgraph ("ACER", "month");
    updateifgraph ("ACER", "year");
  5. Then in /home/httpd/cgi-bin/graphs.cgi we need to make a few changes:
    Find these lines and ammend them to read

    if ($cgigraphs[1] =~ /(network|GREEN|BLUE|ORANGE|RED|ACER)/) {
    if ($cgigraphs[1] =~ /(GREEN|BLUE|ORANGE|RED|ACER|cpu|memory|swap|disk)/) {
    if ($cgigraphs[1] =~ /(GREEN|BLUE|ORANGE|RED|ACER)/) {
  6. Amend:
    } elsif ($cgigraphs[1] =~ /network/) {
    push (@graphs, ('GREEN'));      
    if ($netsettings{'BLUE_DEV'}) {
    push (@graphs, ('BLUE')); }
    if ($netsettings{'ORANGE_DEV'}) {
    push (@graphs, ('ORANGE'));}
    push (@graphs, ("RED"));

    to read:

    # EAK ->
    } elsif ($cgigraphs[1] =~ /network/ || $cgigraphs[1] =~ /internal/) {
    #       Break down of the seperate graph menus
    if ($cgigraphs[1] =~ /internal/){
    push (@graphs, ('ACER'));
    if ($cgigraphs[1] =~ /network/){      
    push (@graphs, ('GREEN'));
    if ($netsettings{'BLUE_DEV'}) {
    push (@graphs, ('BLUE')); }
    if ($netsettings{'ORANGE_DEV'}) {
    push (@graphs, ('ORANGE')); }
    push (@graphs, ("RED"));
    # <- EAK

  7. Run /usr/sbin/fetchipac -Sv
  8. Add the following line to your language file (ie /var/ipcop/addon-lang/
    'internal graphs' => 'Internal Traffic',
  9. Run the command line command to update the language files
  10. Alter /var/ipcop/ to add the extra menu option:
    'contents' =>   $Lang::tr{'status'},
    'uri' => '',
    'statusText' => "IPCop $Lang::tr{'status information'}",
    'subMenu' =>     [[ $Lang::tr{'sssystem status'} , '/cgi-bin/status.cgi', "IPCop $Lang::tr{'system status information'}" ],
    [ $Lang::tr{'ssnetwork status'} , '/cgi-bin/netstatus.cgi', "IPCop $Lang::tr{'network status information'}" ],
    [ $Lang::tr{'system graphs'} , '/cgi-bin/graphs.cgi', "IPCop $Lang::tr{'system graphs'}" ],
    [ $Lang::tr{'sstraffic graphs'} , '/cgi-bin/graphs.cgi?graph=network', "IPCop $Lang::tr{'network traffic graphs'}" ],
    [ $Lang::tr{'internal graphs'}   , '/cgi-bin/graphs.cgi?graph=internal', "IPCop $Lang::tr{'internal graphs'}" ],
    [ $Lang::tr{'ssproxy graphs'} , '/cgi-bin/proxygraphs.cgi', "IPCop $Lang::tr{'proxy access graphs'}" ],
    [ $Lang::tr{'connections'} , '/cgi-bin/connections.cgi', "IPCop $Lang::tr{'connections'}" ]]         );

    and further down, alter (bold)


    if ( ! -e "${General::swroot}/proxy/enable" && ! -e "${General::swroot}/proxy/enable_blue" ) {
    splice (@{$menu{'2.status'}{'subMenu'}}, 5, 1);   # was 4
    splice (@{$menu{'7.mainlogs'}{'subMenu'}}, 2, 1);


    and even further down, alter (bold)

    my @cgigraphs = split(/graph=/,$ENV{'QUERY_STRING'});
    if (defined ($cgigraphs[1])){
    if ($cgigraphs[1] =~ /(GREEN|BLUE|ORANGE|RED|network|internal)/) {
    $location = $Lang::tr{'status'};
    $sublocation = $Lang::tr{'sstraffic graphs'};
    if ($cgigraphs[1] =~ /(cpu|memory|swap|disk)/) {
    $location = $Lang::tr{'status'};
    $sublocation = $Lang::tr{'system graphs'};

That's it

Previous page: Extra Traffic Graphs
Next page: Ports