How Speed Test works
We already have the script installed, now we are going to see how it works to understand and learn more about how Pandora FMS works. When you run the installer, the /root/bin folder is created (in case it does not exist), inside this folder we will find several scripts:
The pandora_agent.conf file (it is the initial version created by the script when installing), regarding the operation of the Speed Test tool, the client in Python is used which is the speedtest-cli file, so that the metrics can be taken, a scheduled task is created that executes the script /bin/speedtest.sh which is executed once every half hour, you can validate it with the command
crontab -l
It generates a file speedtest.log, where the PandoraFMS agent takes the metrics
The scripts speedtest_upload.sh and speedtest_download.sh are the ones that take the values to be able to add them in Pandora FMS:
To finish the lines corresponding to the internet speed tests in our configuration file pandora_agent.conf are the following:
# SpeedTest Download
module_begin
module_name SpeedTestDownload
module_type generic_data
module_description Speedtest Download
module_exec /root/bin/speedtest_download.sh
module_group Networking
module_end
# Ping SpeedTest Upload
module_begin
module_name SpeedTestUpload
module_type generic_data
module_description Speedtest Upload
module_exec /root/bin/speedtest_upload.sh
module_group Networking
module_end