Speed Tests Redux
I was content with my new method of monitoring internet connection speed tests except for one caveat. The process monitored either the ISP connection or the VPN connection. Not both. Conducting a speed test directly with the ISP connection from the same computer is impossible when connected to the VPN. The non continual ISP data gaps would not help my pretty graphs should the ISP connection deteriorate. I wanted continual ISP data.
I decided to use a virtual machine (VM) as a way to monitor both connections. I already had a working VM on the office desktop that needed only minor adjustments to become another workstation on the LAN.
I updated the respective cron jobs on both the office desktop and the VM.
On the host office desktop the cron job tests whether the VPN is being used. If not then the speedtest is against the ISP. When using the VPN the speedtest uses a random speed test server.
On the VM the cron job uses SSH to query the host office desktop which portal is in use. When the host system is using the VPN the VM tests the ISP connection. When the VPN is not being used by the host then the VM performs no speed test.
On the host office desktop the VPN speed tests are conducted at 10 minutes after the hour. When the VPN is not being used then the ISP speed test is run at 40 minutes after the hour.
Because the VM only tests the ISP connection, on the VM the cron job is only run at 40 minutes after the hour. This configuration ensures there always will be ISP data at 40 minutes after the hour.
Years ago I wrote a shell script to gracefully power down virtual machines when rebooting or halting a system. That script is sourced in the normal reboot/halt scripts. Thus I need not worry about the the VM being shut down gracefully.
Some nominal Conky configuration tweaks keeps me informed about the status of the VM.
Now I have full ISP data regardless of using a VPN.