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 :

  •  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.


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