Hurricane Electric's IPv6 Tunnel Broker Forums

General IPv6 Topics => IPv6 on Linux & BSD & Mac => Topic started by: kriteknetworks on March 08, 2008, 09:05:21 AM

Title: [SOLVED] graphing IPv6 only traffic via mrtg on linux
Post by: kriteknetworks on March 08, 2008, 09:05:21 AM
Hi folks...I've set up mrtg, and I'd like to graph IPv6 only traffic. snmpd supports ipv6, and loaded snmpd modules include IPV6-MIB, and IP-MIB/ipv6InterfaceTable.

Is anyone graphing IPv6 only traffic via mrtg, and if so, could you share that part of your configuration, thanks.
Title: Re: graphing IPv6 only traffic via mrtg on linux
Post by: kriteknetworks on March 09, 2008, 08:07:18 PM
Ok....after a couple/few days I've come up with this: on the tunnel box, the tunnel interface can be monitored via snmp. On the Lan boxes I have discovered that if the linux kernel module ip6_tables is loaded, it keeps a count of packets and bytes, which can be retrieved by parsing ip6tables -L chainname -n -v -x output with a cron'd script. I tested monitoring on a LAN box by listenoing to a v6 audio stream, and comparing that net usage against the same usage over v4, and they were the same (from same stream server).

If anyones interested, I can make the mrtg configuration and script available on request.
Title: Re: [SOLVED] graphing IPv6 only traffic via mrtg on linux
Post by: scott on July 14, 2008, 12:23:59 PM
Could you post the MRTG config here?
Title: Re: [SOLVED] graphing IPv6 only traffic via mrtg on linux
Post by: kriteknetworks on July 15, 2008, 11:12:43 PM
Target[rdb_ipv6]: .1.3.6.1.2.1.2.2.1.10.5&.1.3.6.1.2.1.2.2.1.16.5:public@rdb
MaxBytes[rdb_ipv6]: 1250000
Options[rdb_ipv6]: transparent
Background[rdb_ipv6]: #DAE3EB
Colours[rdb_ipv6]: In#00CED1,Out#4E7698,Max#00eb0c,Min#1000ff
Title[rdb_ipv6]: IPv6 Tunnel Traffic Analysis - rdb
PageTop[rdb_ipv6]: <H1>IPv6 Tunnel Traffic Analysis - rdb</H1>

this snmp var queries sit1

--------------------------------------------------------------------------------------------------

Target[daw1_ipv6]: `cat /somedir/counter-$host`
MaxBytes[daw1_ipv6]: 12500000
Options[daw1_ipv6]: transparent
Background[daw1_ipv6]: #DAE3EB
Colours[daw1_ipv6]: In#00CED1,Out#4E7698,Max#00eb0c,Min#1000ff
Title[daw1_ipv6]: IPv6 Traffic Analysis - daw1
PageTop[daw1_ipv6]: <H1>IPv6 Traffic Analysis - daw1</H1>

$host is replaced by the hostname used in the following perl script for cron that writes LAN v6 traffic to a file suitable for mrtg:

#!/usr/bin/perl
#
use strict;
use warnings;
#
my $host = `/bin/hostname`;
my $stats = "/somedir/counter-$host";
my $command = "/sbin/ip6tables -L -v -n -x | grep ^Chain";
#
my $output = `$command`;
#
my ($inbytes) = $output =~ /Chain INPUT.*?packets, ([0-9]+) bytes/;
my ($outbytes) = $output =~ /Chain OUTPUT.*?packets, ([0-9]+) bytes/;
#
my $uptime = `uptime | cut -d, -f1`;
#
open FILE,">$stats";
#print FILE "$inbytes\n$outbytes\n$uptime\n$host\n";
print FILE "$inbytes\n$outbytes\n$uptime$host";
close FILE;

--------------------------------------------------------------------------------------
Make sure the ip6_tables module is loaded at boot, voila
Title: Re: [SOLVED] graphing IPv6 only traffic via mrtg on linux
Post by: scott on July 16, 2008, 05:18:24 PM
Very cool.  I made a couple tweaks:

my $uptime = `uptime | cut -c,13-27`;

makes:  20:15:04 up 25 days, 10:10,  5 users,  load average: 0.00, 0.00, 0.00
into:  25 days, 10:10

and these options for mrtg config:

WorkDir: /var/www/mrtg
Target[true_ipv6]: `cat /root/counter-true`
MaxBytes[true_ipv6]: 1250000
Options[true_ipv6]: transparent,bits,growright,noborder,nopercent
XSize[true_ipv6]: 600
YSize[true_ipv6]: 300
Title[true_ipv6]: IPv6 Traffic Analysis - true
PageTop[true_ipv6]: <H1>IPv6 Traffic Analysis - true</H1>

works nice man, thanks.  ;D