* sFlow: fix creation of new RRDs when multiple entries with the same tag are present in the known links file

* Add startup scripts for FreeBSD
This commit is contained in:
Manuel Kasper 2013-03-17 15:15:08 +00:00
parent 1c78eedb01
commit d86c667ef3
6 changed files with 118 additions and 5 deletions

58
README
View File

@ -1,13 +1,20 @@
AS-Stats v1.40 (2013-01-22)
AS-Stats v1.41 (2013-03-17)
a simple tool to generate per-AS traffic graphs from NetFlow/sFlow records
by Manuel Kasper, Monzoon Networks AG <mkasper@monzoon.net>
--------------------------------------------------------------------
Changes
-------
v1.xx Generate v6 RRD DS in contrib/sync_ds.pl too
v1.41 Generate v6 RRD DS in contrib/sync_ds.pl too
(spotted by Peter Hansen)
sFlow: fix creation of new RRDs when multiple entries with the same
tag are present in the known links file
(spotted by Michal Buchtik)
Add startup scripts for FreeBSD (contrib/freebsd)
(contributed by Michal Buchtik)
Add support for setting the sampling rate per link in the
knownlinks file.
@ -156,6 +163,7 @@ Prerequisites
- Perl 5.8
- RRDtool 1.2 (with Perl "RRDs" library)
- if using sFlow: the Net::sFlow module (CPAN)
- web server with PHP 5
- one or more routers than can generate NetFlow v8/v9 AS aggregation records
or sFlow samples
@ -176,7 +184,7 @@ sFlow data.
- IP address of router (= source IP of NetFlow datagrams)
- SNMP interface index of interface (use "show snmp mib ifmib ifindex"
to find out)
- a short "tag" (15 chars max., alphanumerics only) that will be used
- a short "tag" (12 chars max., alphanumerics only) that will be used
internally (e.g. for RRD DS names)
- a human-readable description (will appear in the generated graphs)
- a color code for the graphs (HTML style, 6 hex digits)
@ -242,6 +250,50 @@ sFlow data.
mls aging long 128
mls aging normal 64
mls flow ip interface-full
For IOS XR, the configuration looks as follows:
flow exporter-map FEM
version v9
!
transport udp 9000
source <source interface>
destination <IP address of server running AS stats> vrf default
flow monitor-map IPV4-FMM
record ipv4
exporter FEM
cache entries 16384
cache timeout active 5
!
flow monitor-map IPV6-FMM
record ipv6
exporter FEM
cache entries 16384
cache timeout active 5
!
sampler-map SM
random 1 out-of 10000
router bgp 100
address-family ipv4 unicast
bgp attribute-download
address-family ipv6 unicast
bgp attribute-download
For JunOS, the configuration looks as follows:
family inet {
output {
flow-server x.x.x.x {
port 9000;
autonomous-system-type origin;
aggregation {
autonomous-system;
}
version 8;
}
- sFlow only:
Have your router(s) send sFlow samples to your machine. Your routers

View File

@ -300,8 +300,10 @@ sub getrrdfile {
if (! -r $rrdfile) {
#print "$$: creating RRD file for AS $as\n";
my %links = map { $_, 1 } values %knownlinks;
my @args;
while (my ($key, $alias) = each(%knownlinks)) {
foreach my $alias (keys %links) {
push(@args, "DS:${alias}_in:ABSOLUTE:300:U:U");
push(@args, "DS:${alias}_out:ABSOLUTE:300:U:U");
push(@args, "DS:${alias}_v6_in:ABSOLUTE:300:U:U");

View File

@ -1,5 +1,6 @@
# Router IP SNMP ifindex tag description color samplingrate (optional)
# note: tabs must be used to separate fields (not spaces)
# max. length for tag is 12 characters
192.0.2.1 15 uplink1 Uplink 1 D41C0E
192.0.2.1 23 uplink2 Uplink 2 E45605
192.0.2.2 4 uplink3 Uplink 3 FECF12

29
contrib/freebsd/netflow-asstatd Executable file
View File

@ -0,0 +1,29 @@
#!/bin/sh
#
# PROVIDE: netflow-asstatd
# REQUIRE: DAEMON
# Add the following line to /etc/rc.conf to enable netflow-asstatd:
# netflow_asstatd_enable="YES"
# netflow_asstatd_flags="<set as needed>"
. /etc/rc.subr
name="netflow_asstatd"
rcvar=`set_rcvar`
command="/usr/local/bin/netflow-asstatd.pl"
command_interpreter="/usr/bin/perl"
load_rc_config $name
# Set defaults
: ${netflow_asstatd_enable="NO"}
: ${netflow_asstatd_pidfile="/var/run/netflow-asstatd.pid"}
: ${netflow_asstatd_port="6343"}
: ${netflow_asstatd_user="root"}
start_cmd="/usr/sbin/daemon -f -u ${netflow_asstatd_user} -p ${netflow_asstatd_pidfile} ${command} -p ${netflow_asstatd_port} ${netflow_asstatd_flags}"
start_postcmd="echo Starting ${name}."
pidfile=${netflow_asstatd_pidfile}
run_rc_command "$1"

29
contrib/freebsd/sflow-asstatd Executable file
View File

@ -0,0 +1,29 @@
#!/bin/sh
#
# PROVIDE: sflow-asstatd
# REQUIRE: DAEMON
# Add the following line to /etc/rc.conf to enable sflow-asstatd:
# sflow_asstatd_enable="YES"
# sflow_asstatd_flags="<set as needed>"
. /etc/rc.subr
name="sflow_asstatd"
rcvar=`set_rcvar`
command="/usr/local/bin/sflow-asstatd.pl"
command_interpreter="/usr/bin/perl"
load_rc_config $name
# Set defaults
: ${sflow_asstatd_enable="NO"}
: ${sflow_asstatd_pidfile="/var/run/sflow-asstatd.pid"}
: ${sflow_asstatd_port="6343"}
: ${sflow_asstatd_user="root"}
start_cmd="/usr/sbin/daemon -f -u ${sflow_asstatd_user} -p ${sflow_asstatd_pidfile} ${command} -p ${sflow_asstatd_port} ${sflow_asstatd_flags}"
start_postcmd="echo Starting ${name}."
pidfile=${sflow_asstatd_pidfile}
run_rc_command "$1"

View File

@ -1,5 +1,5 @@
<div id="footer">
AS-Stats v1.40 written by Manuel Kasper, Monzoon Networks AG.<br/>
AS-Stats v1.41 written by Manuel Kasper, Monzoon Networks AG.<br/>
<?php if ($outispositive): ?>
Outbound traffic: positive / Inbound traffic: negative
<?php else: ?>