, ,

version 1.5 update:

root@bgpstat:/home/fakrul# apt-get install librrds-perl

root@bgpstat:/home/fakrul# apt-get install librrd-dev

Run asstatd. You need to disable sFlow with parameter -P 0

root@bgpstat:/home/fakrul# nohup /usr/bin/asstatd.pl -P 0 -p 9000 -r /opt/as-stats/rrd -k /opt/as-stats/conf/knownlinks &


as-stats is a simple tool to generate per-AS traffic graphs from NetFlow/sFlow records. It stores data in RRD files. Web interface included to see the report per ASN.

1. Download as-stats from https://neon1.net/as-stats/

2. Please make sure that you have follwoing module installed

  • Perl 5.8
  • RRDtool (apt-get install rrdtool)
  • Perl Module (IO::Socket, RRDs, Getopt::Std. Try running netflow-asstatd.pl manually and check whether it gives any perl module related error.)

3. Extract the file and copy files to related folders.

root@bgpstat:/home/fakrul# cp as-stats-v1.41.tar.gz /opt/
root@bgpstat:/home/fakrul# mv /opt/as-stats-v1.41 /opt/as-stats
root@bgpstat:/home/fakrul# cd /opt/as-stats
root@bgpstat:/home/fakrul# cp bin/* /usr/bin/

4. Get the SNMP interface index.

CORE-ROUTER#show snmp mib ifmib ifindex

GigabitEthernet0/1/0: Ifindex = 12
GigabitEthernet0/1/2: Ifindex = 14
GigabitEthernet0/1/3: Ifindex = 15

5. Configure the knownlinks accordingly.

root@bgpstat:/opt/as-stats# vi conf/knownlinks 12 UPSTREAM1 UPSTREAM1 D41C0E  1 14 UPSTREAM2 UPSTREAM2 E45605  1 15 UPSTREAM3 UPSTREAM3 FECF12  1

Please make sure that fields are separated by TAB. IP address is the source of netflow define in export destination parameter.

6. Create a directory to hold per-AS RRD files.

root@bgpstat:/opt/as-stats# mkdir rrd

7. Start netflow-asstatd.pl in the background.

root@bgpstat:/opt/as-stats# nohup /usr/bin/netflow-asstatd.pl -p 9000 -r /opt/as-stats/rrd -k /opt/as-stats/conf/knownlinks &

8. Export flow from router (NetFlow).

config t
ip flow-cache timeout active 5
interface GigabitEthernet0/1/0
ip flow ingress
interface GigabitEthernet0/1/2
ip flow ingress
interface GigabitEthernet0/1/3
ip flow ingress
ip flow-export source loopback0
ip flow-export version 5 origin-as
ip flow-aggregation cache as
cache timeout active 5
cache entries 16384
export destination 9000

9. Wait for few minutes. Now check /opt/as-stats/rrd folder and check whether you are receiving any rrd files. If not check netflow-asstatd.pl process is running or not. Try with tcpdump (tcpdump ip proto udp) and check whether you are receiving any flow from your router.

10. Copy www folder to your web root

root@bgpstat:/opt/as-stats# mv www /var/www/as-stats/

11. Change the config.inc accordingly.

root@bgpstat:/var/www/as-stats# vi config.inc
$rrdpath = “/opt/as-stats/rrd/”;
$daystatsfile = “/var/www/as-stats/asstats_day.txt”;
$rrdtool = “/usr/bin/rrdtool”;

$asinfofile = “asinfo.txt”;
$knownlinksfile = “/opt/as-stats/conf/knownlinks”;

12. Point your browser to check the link.

13. To generate report use the following cron.

root@bgpstat:/var/www/as-stats# vi /etc/cron.d/as-stats
00 */1 * * * root rrd-extractstats.pl /opt/as-stats/rrd/ /opt/as-stats/conf/knownlinks /var/www/as-stats/asstats_day.txt

If everything goes well, that how graphs look like.