puppet-speedtest
Table of Contents
- Overview
- Module Description - What the module does and why it is useful
- Setup - The basics of getting started with speedtest
- Usage - Configuration options and additional functionality
- Reference - An under-the-hood peek at what the module is doing and how
- Limitations - OS compatibility, etc.
- Development - Guide for contributing to the module
Overview
puppet module to install and manage
speedtest-cli. It allows to run as a cronjob and save the result into an output file.
Module Description
This module will install speedtest-cli (script based on python) that can be used to test internet bandwidth using speedtest.net servers.
This module provides the ability to run a cronjob, capture the
output and using ::file_upload will transfer the output to a central
location
Setup
What speedtest affects
- installs and manages speedtest-cli
- If enabled, creates a cronjob that will use
::file_uploadto secure copy the output to a central location
Setup requirements
- Python > 2.7
- file_upload
Beginning with speedtest
Install the module
class {'::speedtest':
ensure => present
}
In hiera
speedtest::ensure: present
Usage
Basic config
Set the output directory and format
class {'::speedtest':
output_dir => '/var/tmp',
output_file => 'speedtest-out',
output_format => 'csv'
}
Transferring files
If want to enable upload, set that up with
class {'::speedtest':
enabled_upload => true,
upload_dir => '/opt/upload',
upload_host => 'example.org',
upload_key_source => <ssh_key_user>,
upload_user => 'user',
}
Reference
Public classes
ensure(, Default: present): To activate or not the module so the file structure and scripts can be created speedtest_run(Stdlib:Absolutepath, Default: '/usr/local/bin/speedtest-run.sh'): Location and name for the script that will run the cronjobuser(String, Default: 'root'): user that owns the directory where output is savedgroup(String, Default: 'root'): group that owns the directory where output is savedoutput_dir(Stdlib:Absolutepath, Default: /var/tmp/speedtest): where to store the reportoutput_file_name(String, Default: speedtest-$::fqdn): the file name of the reportpackage(String, Default: speedtest-cli): the pip package to installlocation(Optional|String, Default: undef): Closest city to test the bandwidth against to.no_tests(Interger, Default: 1): the number of tests to preformno_test_servers(Interger, Default: 1): If location is present the number of servers to test from that locationupload_test(Boolean, Default: true): weather or not to preform an upload testdownload_test(Boolean, Default: true): weather or not to preform an download testoutput_format(, Default: 'csv'): Output format after run the test enable_upload(Boolean, Default: false): Enable the use of::file_uploadupload_dir(Optional|Stdlib:Absolutepath,, Default: undef): Location of remote host to upload outputupload_host(Optional|Tea::Host, Default: undef): Hostname or IP of the remote host to upload the outputupload_key_source(Optional|Tea:Puppetsource, Default: undef): puppet resource that defines where the ssh key is located to conect to the remote host (Note: the public/private key pair must be created before using this module and configured on the other host as well)upload_user(String, Default: 'speedtest'): username of the remote user host to upload the output
Private classes
Class speedtest::params
Set specific parameters about the package and where to locate outputs
Limitations
This module has been tested on:
- Ubuntu 16.04
Development
Pull requests welcome but please also update documentation and tests.