
This file displays the number of bytes each interface has sent and received, the number of packets inbound and outbound, the number of errors seen, the number of packets dropped, and more.”įor our purpose, we are interested in the first column which contains the cumulative number of bytes received by the interface, and the 10th column, which contains the number of bytes sent. Per, /proc/net/dev "Lists the various network devices configured on the system, complete with transmit and receive statistics. The raw bandwidth data is read from /proc/net/dev. Here’s a little bit of info on how the script works. To start the script right away, spawn a process for it: /jffs/bandwidth-env.sh & Additional Info I have an automatic reboot scheduled at 4 AM, so I scheduled a custom script at 4:15 AM to run the bandwidth-env.sh script: To schedule your script, you can use the Scheduler (Administration/Schedule) in the router’s web admin UI. To test your script run it manually and confirm the data is showing in Splunk: /jffs/bandwidth-env.sh Schedule Your Script GetDLMbit=$(printf "%.2f\n" `calc $dlBytes*0.000008`) getULMbit=$(printf "%.2f\n" `calc $ulBytes*0.000008`)Ĭreate another shell script /jffs/bandwidth-env.sh with the following content: export SPLUNK_AUTH="YOUR_SPLUNK_AUTH_KEY"
#Bandwidth monitoring tool tomato full
For full code seeĬalc() # Calculate floating point arithmetic using AWK instead of BC If you are not able to SSH, make sure you have SSH Daemon enabled under Administration/Admin Access.įor more info on installing Splunk HTTP Event Collection, see my previous post. Update the splunkUrl variable with your Splunk HEC URL. SSH into your router and create a shell script at /jffs/bandwidth.sh with the content from here. Log into your router’s admin UI, choose Administration/JFFS, select Enabled and Save. Otherwise if you saved your script in /tmp, it’ll be gone after the next reboot. Step-by-step Instructions Enable JFFS Partition on Your RouterĮnable JFFS Partition on your router so that you have permanent storage for your script. I found a script by WaLL圓K that already had the bandwidth calculation logic and all I had to add was a little more code to send the data to Splunk. Luckily, Advanced Tomato runs a variant of Linux, so all I needed was a shell script to calculate bandwidth usage data and send to Splunk via the Splunk Http Event Collector. Advanced Tomato has a pretty click interface to monitor bandwidth, but I still want the data in my Splunk instance. Last week I upgraded my internet to Verizon Fios Gigabit and with that upgrade, the Actiontec router was replaced with another router: a Netgear R7000 running Advanced Tomato (open source Linux-based firmware for Broadcom based Wi-fi routers). To monitor our Internet bandwidth usage I wrote a Node.js program to scrape the data from the admin web UI for my Verizon Actiontec MI424WR router.
#Bandwidth monitoring tool tomato windows
In addition to SmartThings devices, I also pulled data from other data sources such as network routers, Windows event logs, weather data retrieval scripts, etc. A while back I wrote about sending data from SmartThings and other home devices data to Splunk so I can monitor what goes on in my home via Splunk Dashboards.
