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

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

View File

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

View File

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

View File

@ -1,17 +1,21 @@
import json
import matplotlib as mpl
mpl.use('svg')
import matplotlib.pyplot as plt
users = ['alexander','christoffermadsen','jmaa','jacob']
numbers = {}
for user in users:
number = open("log/" + user + ".log", "r").read().split("\n")[-2].split(" ")[1]
numbers[user] = number
shot_counts = {}
shot_bandwidth = json.loads(open("log/bandwidth.dat", "r").read())
values = list(numbers.values())
labels = list(numbers.keys())
for user in users:
shot_counts[user] = open("log/" + user + ".log", "r").read().split("\n")[-2].split(" ")[1]
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')
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 timefmt "%s"
set format x "%m/%d"
set xtics 60*60*24*7*2
set xtics 60*60*24*7*4
set xrange [1485275000:]
set mxtics 2
set grid ytics mytics xtics mxtics