Credit : Matt Martz
Profile : https://github.com/sivel
มาเริ่มกันเลยครับ Secure Shell เข้า Server  ของคุณจากนั้นสั่งตามนี้ครับ
[cc lang=”c”]git clone https://github.com/sivel/speedtest-cli.git
cp speedtest-cli/speedtest.py /usr/bin/speedtest-cli
chmod a+x /usr/bin/speedtest-cli
[/cc]
เสร็จขั้นตอนการติดตั้ง Script ครับ
ต่อมาคือวิธีใช้ครับ สั่ง
[cc lang=”c”]speedtest-cli -h
usage: speedtest-cli [-h] [–no-download] [–no-upload] [–bytes] [–share]
                     [–simple] [–csv] [–csv-delimiter CSV_DELIMITER]
                     [–csv-header] [–json] [–list] [–server SERVER]
                     [–mini MINI] [–source SOURCE] [–timeout TIMEOUT]
                     [–secure] [–no-pre-allocate] [–version]
Command line interface for testing internet bandwidth using speedtest.net.
————————————————————————–
https://github.com/sivel/speedtest-cli
optional arguments:
  -h, –help            show this help message and exit
  –no-download         Do not perform download test
  –no-upload           Do not perform upload test
  –bytes               Display values in bytes instead of bits. Does not
                        affect the image generated by –share, nor output from
                        –json or –csv
  –share               Generate and provide a URL to the speedtest.net share
                        results image, not displayed with –csv
  –simple              Suppress verbose output, only show basic information
  –csv                 Suppress verbose output, only show basic information
                        in CSV format. Speeds listed in bit/s and not affected
                        by –bytes
  –csv-delimiter CSV_DELIMITER
                        Single character delimiter to use in CSV output.
                        Default “,”
  –csv-header          Print CSV headers
  –json                Suppress verbose output, only show basic information
                        in JSON format. Speeds listed in bit/s and not
                        affected by –bytes
  –list                Display a list of speedtest.net servers sorted by
                        distance
  –server SERVER       Specify a server ID to test against
  –mini MINI           URL of the Speedtest Mini server
  –source SOURCE       Source IP address to bind to
  –timeout TIMEOUT     HTTP timeout in seconds. Default 10
  –secure              Use HTTPS instead of HTTP when communicating with
                        speedtest.net operated servers
  –no-pre-allocate     Do not pre allocate upload data. Pre allocation is
                        enabled by default to improve upload performance. To
                        support systems with insufficient memory, use this
                        option to avoid a MemoryError
  –version             Show the version number and exit[/cc]
ลองสั่งทดสอบความเร็วด้วย cammand line
[cc lang=”c”]$ speedtest-cli –share # –share คือเมื่อทดสอบเสร็จเราก็จะได้ output แบบเป็น url รูปไปให้คนอื่นได้ดูด้วย[/cc]
ตัวอย่าง
[cc lang=”c”]$ speedtest-cli –share –server=4347 # –server=ID ก็คือ เลือก server ที่ต้องการทดสอบครับ (ผม list ไว้ให้แล้วด้านล่างเฉพาะบ้านเรานะ)
Retrieving speedtest.net configuration…
Retrieving speedtest.net server list…
Testing from CAT Telecom public company Ltd (xxx.xxx.xxx.xxx)…
Hosted by cattelecom (Bangkok) [148.42 km]: 19.709 ms
Testing download speed………………………………….
Download: 28.55 Mbits/s
Testing upload speed…………………………………………..
Upload: 26.54 Mbits/s
Share results: http://www.speedtest.net/result/xxxxxxxxx.png
[/cc]
รายการ Server ID ของ Bangkok
[cc lang=”c”]2459) SBN (Bangkok, Thailand) [148.42 km]
3855) dtac trinet (Bangkok, Thailand) [148.42 km]
3147) AIS (Bangkok, Thailand) [148.42 km]
4250) TSAlive Network (Bangkok, Thailand) [148.42 km]
1219) STS Group (Bangkok, Thailand) [148.42 km]
4222) Shama Thunder (Bangkok, Thailand) [148.42 km]
4347) cattelecom (Bangkok, Thailand) [148.42 km][/cc]