duminică, 2 aprilie 2017

d3js network weathermap

I've always wanted something like this.

We use grafana and telegram for snmp statistics and the only "legacy" part was Cacti and that because of the weathermap plugin. Don't get me wrong , i really like that plugin it's just that well i had some free time in the recent weeks so here it goes.

This is based on this. : The javascript does couple of api calls to a web server that in turn queries influxdb for snmp counters for each router/interface.Really simple web-api server build with flask.

I will put the scripts on github soon (https://github.com/cpmarvin/flask_api_influxdb). So high level diagram :


Features:
  •  draw links btw nodes and color them according to %util, static refBW ( ...for now ) 
  • show util graph for last 24 hours on link click 
  • based on past 1 to 24 hours recolor links based on util at that point 
  • refresh in 5 minutes 

 Initial view: 


Look in the past: 


Show graph for last 24h: 


Code for the webpage on github : here.

PS: 


I'm not a programmer so this can be written better. 
Next step is integrate this in grafana with a custom plugin. Help needed!!

joi, 16 martie 2017

Network Diagram D3js based on ISIS Database


Let's build one based on ISIS database.

https://github.com/cpmarvin/isis_db_parser

First you need something to get the isis database from a device( ie: junos) so lets use py-ez

clone rep from github:
root@lab:/usr/local/src# git clone https://github.com/cpmarvin/isis_db_parser.git
cd /usr/local/src/
python isis_get.py

This will log to the router , get the db and provide a dic for links with some information about metric and local/remote ip and local/remote interface index ( Junos specific). In my lab this is what i get ( this ( use print df1 )

     source        target metric          l_ip l_int          r_ip r_int
0  vrr1.pgt      bdr1.lab    500  81.91.194.52   335  81.91.194.53   345
1  vrr1.pgt      bdr1.lab    500  81.91.194.50   333  81.91.194.51   437
4  bdr1.lab  AGG1.INX.LAB     10  192.168.1.29   393  192.168.1.30   333

and the dict:
[{'r_ip': '81.91.194.53', 'l_int': '335', 'target': 'bdr1.lab', 'metric': '500', 'source': 'vrr1.pgt', 'r_int': '345', 'l_ip': '81.91.194.52'}, {'r_ip': '81.91.194.51', 'l_int': '333', 'target': 'bdr1.lab', 'metric': '500', 'source': 'vrr1.pgt', 'r_int': '437', 'l_ip': '81.91.194.50'}, {'r_ip': '192.168.1.30', 'l_int': '393', 'target': 'AGG1.INX.LAB', 'metric': '10', 'source': 'bdr1.lab', 'r_int': '333', 'l_ip': '192.168.1.29'}]


Once you have this you can use the d3js script ( https://github.com/cpmarvin/d3js )  , and build the diagram :

Features:
- zoom
- neighbour highlight
- filtering based on regexp node name
- show all link label
Small network diagram :
Neighbours highlight:



miercuri, 24 august 2016

Open Source - NetFlow Analysis Tool






So ... how do you get network visibility using opensource. Easy ... well sort of





Tools and versions used :

- pmacctd 1.6.1-git (20160823-00)
- kafka 0.10.0.1
- influxdb 0.13
- grafana 3.1
- kafka-influxdb ( git )
- custom plugin for pmacct

Fastnemon is work in progress.

The results :

- Overview : Network Total/Transit/Peers





- Transit breakdown by router/interface/transit_peer_as/source_as


 - Total by router/interface/peer_as




- Total by dst_net/interface/peer_as

















This are the main ones i use everyday, the pmacct aggregation below

-src_as,dst_as,peer_src_as,peer_dst_as,peer_src_ip,as_path,dst_net,src_net,dst_mask,src_mask,in_iface,std_comm,med,proto,src_as_path

And a nice overview dashboard for  managment to look at