master
DJh2o2 2022-08-02 09:39:44 +07:00
commit 9a9fb42368
3 changed files with 37 additions and 0 deletions

Binary file not shown.

@ -0,0 +1,16 @@
import sqlite3, pandas, matplotlib
matplotlib.use('tkAgg')
import matplotlib.pyplot as plt
conn = sqlite3.connect("bandwidth.db")
sql = """SELECT times, ping, download, upload FROM bandwidth"""
data = pandas.read_sql(sql, conn)
plt.plot(data.times,data.ping, label = "Ping", )
plt.plot(data.times,data.download, label = "Download")
plt.plot(data.times,data.upload, label = "Upload")
plt.legend()
plt.title("Bandwidth")
plt.show()

@ -0,0 +1,21 @@
#!/bin/bash
function writeDB () {
# now import the csv data in to sqlite db
sqlite3 -batch bandwidth.db <<"EOF"
.separator ","
.import speedtest.tmp bandwidth
EOF
}
function runTest () {
# run speedtest against named server with csv output saved in tmp file
speedtest-cli --secure --csv > speedtest.tmp
# write output to db
writeDB
# write output to csv
cat speedtest.tmp >> speedtest.csv
}
# main
runTest