Getting Bandwidth Data into Home Monitor App version 4.4.2
Super Bowl 50 is in the books and so I decided to update the Home Monitor app to include average bandwidth for your home network. I got the idea after reading the post about the Comcast customer that was tweeting their complaints each time their bandwidth fell below certain rate. I decided to add this feature to the app to help show users their average Download, Upload and Ping rates.
First, I downloaded the scripts necessary to get the speedtest data, found here : https://github.com/sivel/speedtest-cli
Next, I tweaked the python script so that it displayed everything as a Name = Value pair, making it easy to Splunk :
Download=85 Mbps
Upload=60 Mbps
Ping=8ms
speedtest_cli.py
Changed Download: to Download=, Upload: to Upload= and Ping: to Ping=
Once that was done, I created the inputs for both Windows and Linux :
# Bandwidth Input for Linux Machines
[script://$SPLUNK_HOME/etc/apps/homemonitor/bin/speedtest.sh]
disabled = true
interval = 1800.0
sourcetype = bandwidth_test
# Bandwidth Input for Windows Machines
[script://$SPLUNK_HOME\etc\apps\homemonitor\bin\speedtest_cli.py --simple]
disabled = false
interval = 1800.00
source = bandwidth_test
sourcetype = bandwidth_test
Now, all you have to do is go into Settings -> Data Inputs -> Scripts and enable the proper script for your OS. I would keep it to 15 minutes (1,800 seconds) since you don't want to be running a speedtest on a high frequency which could degrade your networks performance.
Thanks and enjoy,
Kam
First, I downloaded the scripts necessary to get the speedtest data, found here : https://github.com/sivel/speedtest-cli
Next, I tweaked the python script so that it displayed everything as a Name = Value pair, making it easy to Splunk :
Download=85 Mbps
Upload=60 Mbps
Ping=8ms
speedtest_cli.py
Changed Download: to Download=, Upload: to Upload= and Ping: to Ping=
Once that was done, I created the inputs for both Windows and Linux :
# Bandwidth Input for Linux Machines
[script://$SPLUNK_HOME/etc/apps/homemonitor/bin/speedtest.sh]
disabled = true
interval = 1800.0
sourcetype = bandwidth_test
# Bandwidth Input for Windows Machines
[script://$SPLUNK_HOME\etc\apps\homemonitor\bin\speedtest_cli.py --simple]
disabled = false
interval = 1800.00
source = bandwidth_test
sourcetype = bandwidth_test
Now, all you have to do is go into Settings -> Data Inputs -> Scripts and enable the proper script for your OS. I would keep it to 15 minutes (1,800 seconds) since you don't want to be running a speedtest on a high frequency which could degrade your networks performance.
Thanks and enjoy,
Kam
I used what you did here and morphed it a little bit into a Twitter alert. I took the serverlist xml file and redid it some to only show hosts that I knew had good bandwidth numbers for me in the past to ensure I was getting the best numbers that I could. Then I rehosted it and pointed the script to that file instead of the default SpeedTest server list. Then I set an alert to let me know when my speed fell below 150mbps (half of what I pay for) and set a Twitter alert action to tag me and my ISP when the speed fell below the threshold. Thank you for the inspiration to do this!
ReplyDeleteI love this idea and have some ideas for some good dashboards for it if I can get it working :(
ReplyDeleteWhen you say 'Now, all you have to do is go into Settings -> Data Inputs -> Scripts and enable the proper script for your OS. ' I assume that means that i do NOT have to get or edit scripts or python scripts because you've already done it and all we have to do is Enable the Data Input for my OS - which is on a Mac El Capitan, so I'm enabling the Linux machine Bandwidth input. unfortunately this isn't populating the dashboard.....not sure whats wrong here....thanks again for your help. great dashboard
In order to get this working on OSX 10.10.5 I had to edit the speedtest.sh shell file to use the correct path to the speedtest_cli.py python script.
ReplyDelete#!/bin/sh
python /Applications/splunk/etc/apps/homemonitor/bin/speedtest_cli.py --simple
1800 seconds is 30 minutes, not 15. :-)
ReplyDeleteI cannot get the bandwidth numbers to populate. The boxes are enabled and showing 0. I have tried several different things and cannot get them to populate. Splunk is on Windows Server 2012. Using a Quantum router. I changed the inputs.conf as it says in the wiki. What should I try next?
ReplyDeleteI may have found the reason bandwidth numbers are not populating on the Network Overview page. My setup is pulling the speedtest data into splunk just fine. A search for sourcetype=bandwidth_test pulls up the tests and their output with the expected data. I have a quantum router and the Splunk server is a rhel VM. If you view the source code behind the Network Overview page, Splunk highlights 27 errors that are all due to deprecated functions such as "linkview", "linkfields", and "afterlabel". I wanted to bring this to your attention so you can address it in a future release hopefully. If I get it working, I will post the fix. Great app Kam, Thanks!
ReplyDelete