Added support for RRDtool file updating.
This commit is contained in:
parent
795bc51da4
commit
443862e974
|
@ -72,7 +72,7 @@ Usage
|
|||
$ speedtest-cli -h
|
||||
usage: speedtest-cli [-h] [--bytes] [--share] [--simple] [--list]
|
||||
[--server SERVER] [--mini MINI] [--source SOURCE]
|
||||
[--version]
|
||||
[--version] [--rrdfile RRDFILE]
|
||||
|
||||
Command line interface for testing internet bandwidth using speedtest.net.
|
||||
--------------------------------------------------------------------------
|
||||
|
@ -90,6 +90,7 @@ Usage
|
|||
--mini MINI URL of the Speedtest Mini server
|
||||
--source SOURCE Source IP address to bind to
|
||||
--version Show the version number and exit
|
||||
--rrdfile Output results to an RRD file, three columns, ping (ms), download (bits per second), and upload (bits per second)
|
||||
|
||||
Inconsistency
|
||||
-------------
|
||||
|
|
|
@ -486,6 +486,7 @@ def speedtest():
|
|||
parser.add_argument('--source', help='Source IP address to bind to')
|
||||
parser.add_argument('--version', action='store_true',
|
||||
help='Show the version number and exit')
|
||||
parser.add_argument('--rrdfile', help='Output results to an RRD file, three columns, ping (ms), download (bits per second), and upload (bits per second)')
|
||||
|
||||
options = parser.parse_args()
|
||||
if isinstance(options, tuple):
|
||||
|
@ -635,6 +636,13 @@ def speedtest():
|
|||
print_('Upload: %0.2f M%s/s' %
|
||||
((ulspeed / 1000 / 1000) * args.units[1], args.units[0]))
|
||||
|
||||
if args.rrdfile:
|
||||
import rrdtool
|
||||
rrdping = int(round(best['latency'], 0))
|
||||
rrdDLSpeedBits = int(round(dlspeed * 8, 0))
|
||||
rrdULSpeedBits = int(round(ulspeed * 8, 0))
|
||||
ret = rrdtool.update(args.rrdfile,'N:' + `rrdping` + ':' + `rrdDLSpeedBits` + ':' + `rrdULSpeedBits`);
|
||||
|
||||
if args.share and args.mini:
|
||||
print_('Cannot generate a speedtest.net share results image while '
|
||||
'testing against a Speedtest Mini server')
|
||||
|
|
Loading…
Reference in New Issue