Runs internet connection speed checks for a specified interval and logs the results.
Allow a user to
- Be confident that future functionality will not break current functionality (is fully tested)
- Access great documentation
- Easily extend the current project
- Run a single terminal command to setup the project
- Easily alter the default settings via command line options
- Automate the speed testing to run at their preferred interval
- Save results
- Log cron errors
- Log whether the speed test was done via a wireless or wired connection
- Log time at which each speedtest was conducted
- Log time when cron errors occurred
The below dependencies can be installed to the system ruby (if using a rapsberrypi) or can be installed via a gem manager such as rbenv. Speed Demon will just run a CLI call to instatiate the gem. So ensure that the global ruby version is the version that has the below gems installed!
This gem handles cron tasks beautifully, has a great test suite, is well documented/maintained and is used by a large number of people so I decided to integrate with it to draw on its functionality.
The below linux packages are used
Used to gather data on ping, download speed and upload speed
Used to determine whether the speed test was done via a wireless or wired connection. This package comes preinstalled as standard with many linux distributions
At least 1Ghz processor and 2Gb of RAM. (Overclocked Raspberrypi 1B) These figures are hand wavy. However, on a non overclocked Raspberrypi 1 B, any CPU speed below 1GHz detrimentally affects that calculated speed. i.e the calculated speed will be less than that actual speed.
(Will be pushed to ruby gems shortly <2018-11-10 Sat 07:46>)
- git clone this project to a desired location
- install the dependencies listed
- simply install to current directory with all defaults
speed_demon --setup-default
This will setup the project with the following defaults:
- output directory at ~/.local/share/speed_demon
- config directory at ~/.config/speed_demon
- cron log directory at ~/.speed_demon
- speedtest check frequency of 15 minutes
- git clone this project to a desired location
- install the dependencies listed
- simply install to current directory with all defaults
speed_demon --custom-output /tmp/speed_demon/output --custom-log /tmp/speed_demon/log --custom-frequency '2.minutes'
This will setup the project with the following defaults:
- output directory at /tmp/speed_demon/output
- config directory at ~/.config/speed_demon (this cannot be changed)
- cron log directory at /tmp/speed_demon/log
- speedtest check frequency of 2 minutes
Note: The most updated custom options are in the code & tests
Can be called with the following:
- ‘2.minutes’ (not recommended to run any more frequent that this)
- ‘hour’
- ‘3.hours’
- ‘1.day’
- ‘1.day, at: [‘4:30 am’, ‘6:00 pm’]’ (TODO: test, but i think this already works)
For more options check out the whenever gem
speed_demon [options]
Short flag | –options [INPUT] | Result |
---|---|---|
-h | –help | prints all options to CLI |
-s | –setup-default | setup using defaults |
-o | –custom-output [PATH] | specify custom path for output directory |
-l | –custom-log [PATH] | specify custom path for log directory |
-f | –custom-frequency [TIME] | specify custom speed measuring frequency |
-m | –measure-speed | manually run a speed check |
For now all output is in CSV format. The output is intended to be used for graphing and analysis.
eg. options[:custom][:base_Dir] in setup.rb should be options[:base_dir] @custom[:base_dir] = ARGV[0] || Dir.pwd # If it exists, ARGV remains is user’s chosen setup path setup = SpeedTest::Setup.new(SpeedTest::CLI.parse(ARGV)) setup.directories setup.cron_createWith: SpeedTest::Setup.execute(custom: SpeedTest::CLI.parse(ARGV)) This will create all the directories, create the cron task and start the cron task
~/.config is correct proviso: only do this if a –setup-default flag is passed or a custom flag is passed- [X] SpeedTest to SpeedDemon
- [X] speed_test to speed_demon
- [X] speedtest_init to speed_demon
- [X] Rename file names
- [X] Ensure speedtest –simple linux command line call is not renamed
- [ ] Write error handling for the case a user does not have access to linux package ‘ip’ & ‘ip link’ does not provide required output
1.day, at: [‘4:30 am’, ‘6:00 pm’] :sunday, at: ‘12pm’ ‘0 0 27-31 * *’ :day, at: ‘12:20am’, roles: [:app]