updates, I think

This commit is contained in:
Christoffer Müller Madsen 2017-10-13 18:51:34 +02:00
parent 09e8aeb5c0
commit 05978c6c18
5 changed files with 16 additions and 8 deletions

View File

@ -15,6 +15,8 @@ log.split("\n").each do |line|
bytes = parsed['%b'].to_i bytes = parsed['%b'].to_i
status = parsed['%>s'] status = parsed['%>s']
next if request == nil
user = request[1] user = request[1]
bw_sum[user] += bytes unless user == nil or status != "200" bw_sum[user] += bytes unless user == nil or status != "200"

View File

@ -1,5 +1,6 @@
RES_BASE = "https://strawberry.thedevcave.net/~christoffermadsen/" RES_BASE = "https://strawberry.thedevcave.net/~christoffermadsen/"
USERNAMES = ["christoffermadsen","jmaa","jacob","alexander"] USERNAMES = ["christoffermadsen","jmaa","jacob","alexander"]
NAMES_SHO = {"c" => "christoffermadsen", "j" => "jmaa", "h" => "jacob", "a" => "alexander"}
SHOT_DIR = "/var/shots/" SHOT_DIR = "/var/shots/"
ERB_FILE = "dcav-index.erb" ERB_FILE = "dcav-index.erb"
HTML_FILE = "/var/shots/html/index.html" HTML_FILE = "/var/shots/html/index.html"

View File

@ -35,6 +35,7 @@
%> %>
<% end %> <% end %>
</table> </table>
<br><i>Bandwidth logged since 2017-05-23</i>
<h2>Charts</h2> <h2>Charts</h2>
<img src=<%="#{RES_BASE}img/screenshot_count.svg"%> /> <img src=<%="#{RES_BASE}img/screenshot_count.svg"%> />
<br /> <br />

View File

@ -1,17 +1,21 @@
import json
import matplotlib as mpl import matplotlib as mpl
mpl.use('svg') mpl.use('svg')
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
users = ['alexander','christoffermadsen','jmaa','jacob'] users = ['alexander','christoffermadsen','jmaa','jacob']
numbers = {} shot_counts = {}
for user in users: shot_bandwidth = json.loads(open("log/bandwidth.dat", "r").read())
number = open("log/" + user + ".log", "r").read().split("\n")[-2].split(" ")[1]
numbers[user] = number
values = list(numbers.values()) for user in users:
labels = list(numbers.keys()) shot_counts[user] = open("log/" + user + ".log", "r").read().split("\n")[-2].split(" ")[1]
fig1, ax1 = plt.subplots() fig1, ax1 = plt.subplots()
ax1.pie(values,labels=labels,autopct="%1.1f%%", shadow=True, startangle=90) ax1.pie(list(shot_counts.values()),labels=list(shot_counts.keys()),autopct="%1.1f%%", shadow=True, startangle=90)
ax1.axis('equal') ax1.axis('equal')
plt.savefig("/home/christoffermadsen/public_html/img/dcavpie.svg", format="svg") plt.savefig("/home/christoffermadsen/public_html/img/dcavpie.svg", format="svg")
#fig2, ax2 = plt.subplots()
#plt.figure(fig2.number)
#plt.bar(list(shot_bandwidth.keys()), list(shot_bandwidth.values()))
#plt.savefig("/home/christoffermadsen/public_html/img/dcavbandwidth.svg", format="svg")

View File

@ -38,7 +38,7 @@ set xlabel "Time"
set xdata time set xdata time
set timefmt "%s" set timefmt "%s"
set format x "%m/%d" set format x "%m/%d"
set xtics 60*60*24*7*2 set xtics 60*60*24*7*4
set xrange [1485275000:] set xrange [1485275000:]
set mxtics 2 set mxtics 2
set grid ytics mytics xtics mxtics set grid ytics mytics xtics mxtics