This is a Gitlab for NZOSS Members

Unverified Commit 0aeb3a03 authored by Tim McNamara's avatar Tim McNamara
Browse files

Plots working

parent 4b725780
......@@ -3,6 +3,14 @@ host := env_var_or_default("BBB_HOST", "bbb.nzoss.nz")
remote_path := env_var_or_default("REMOTE_PATH", "/home/" + user + "/meetings-monitoring")
exe := "ssh " + user + "@" + host
go:
just sync
make everything
just plot
plot:
make plots
# lists the files at REMOTE_PATH (for testing)
ls:
{{exe}} ls {{remote_path}}
......
rawdata = $(wildcard meetings-monitoring/Raw/*.xml)
# cleandata_ =
cleandata = $(patsubst %.xml,%.tsv, $(subst /Raw/,/Clean/,$(rawdata)))
.PHONY: everything
everything: bbb-last-6h.dat bbb-last-24h.dat
.PHONY: plots
plots: bbb-activity-all-time.png bbb-activity-last-24h.png bbb-activity-last-6h.png
$(cleandata): $(rawdata)
python meetings-monitoring/clean-data.py $(patsubst %.tsv,%.xml,$(subst /Clean/,/Raw/,$@)) $@
bbb.dat: $(cleandata)
sort meetings-monitoring/Clean/* > bbb.dat
bbb-last-6h.dat: bbb.dat
tail --lines 360 bbb.dat > bbb-last-6h.dat
bbb-last-24h.dat: bbb.dat
tail --lines 1440 bbb.dat > bbb-last-24h.dat
bbb-activity-all-time.png: bbb.dat
gnuplot meetings-monitoring/activity-alltime.plot
bbb-activity-last-6h.png: bbb-last-6h.dat
gnuplot meetings-monitoring/activity-6h.plot
bbb-activity-last-24h.png: bbb-last-24h.dat
gnuplot meetings-monitoring/activity-24h.plot
......@@ -13,13 +13,20 @@ is by installing [multipass][].
Install all necessary dependencies via `setup.sh`
$ chmod +x
$ chmod +x setup.sh
$ setup.sh
Note: if something goes wrong, please set the DEBUG variable and run the script again. See the **Contact** section for where to send this output to for help:
$ DEBUG=yes ./setup.sh
# Tasks
Synchronise the data/code:
$ just sync
# Project Structure
## Justfile
......@@ -46,7 +53,7 @@ All rights reserved.
## Contact
The preferred method is the `#technical` channel within https://chat.nzoss.nz/.
The preferred method is the `#technical` channel within https://chat.nzoss.nz/.c
## Maintainers
......
set xdata time
set timefmt "%Y-%m-%dT%H:%M:%S"
set terminal pngcairo size 1200,800 enhanced font "FreeSans,10"
set yrange [0:20]
unset border
set tics nomirror
set auto y
set auto x
set format x "%H:%M\n%d %B"
# set timestamp
set output "bbb-activity-last-24h.png"
set style line 1 lw 4
plot \
"bbb-last-24h.dat" using 1:4 every 12 with fillsteps fs noborder solid fc rgb "#e0ABC3C9" notitle,\
"bbb-last-24h.dat" using 1:3 every 12 with fillsteps fs noborder solid fc rgb "#e0F4473A" notitle,\
"bbb-last-24h.dat" using 1:5 every 12 with fillsteps fs noborder solid fc rgb "#e0601A4A" notitle,\
"bbb-last-24h.dat" using 1:3 every 12 with steps linewidth 2 lc rgb "#10F4473A" title "Number of video participants",\
"bbb-last-24h.dat" using 1:4 every 12 with steps linewidth 2 lc rgb "#10ABC3C9" title "Number of audio participants",\
"bbb-last-24h.dat" using 1:5 every 12 with steps linewidth 2 lc rgb "#70601A4A" title "Number of listeners",\
"bbb-last-24h.dat" using 1:6 every 12 with steps linewidth 2 lc rgb '#d0382119' title "Total participants",\
"bbb-last-24h.dat" using 1:2 every 8 with steps dashtype '_-' linewidth 2 lc rgb '#10382119' title "Number of meetings",\
set xdata time
set timefmt "%Y-%m-%dT%H:%M:%S"
set terminal pngcairo size 1200,800 enhanced font "FreeSans,10"
set yrange [0:20]
unset border
set tics nomirror
set auto y
set auto x
set format x "%H:%M\n%d %B"
# set timestamp
set output "bbb-activity-last-6h.png"
set style line 1 lw 4
plot \
"bbb-last-6h.dat" using 1:4 every 4 with fillsteps fs noborder solid fc rgb "#e0ABC3C9" notitle,\
"bbb-last-6h.dat" using 1:3 every 4 with fillsteps fs noborder solid fc rgb "#e0F4473A" notitle,\
"bbb-last-6h.dat" using 1:5 every 4 with fillsteps fs noborder solid fc rgb "#e0601A4A" notitle,\
"bbb-last-6h.dat" using 1:3 every 4 with steps linewidth 2 lc rgb "#10F4473A" title "Number of video participants",\
"bbb-last-6h.dat" using 1:4 every 4 with steps linewidth 2 lc rgb "#10ABC3C9" title "Number of audio participants",\
"bbb-last-6h.dat" using 1:5 every 4 with steps linewidth 2 lc rgb "#70601A4A" title "Number of listeners",\
"bbb-last-6h.dat" using 1:6 every 4 with steps linewidth 2 lc rgb '#d0382119' title "Total participants",\
"bbb-last-6h.dat" using 1:2 every 4 with steps dashtype '_-' linewidth 2 lc rgb '#10382119' title "Number of meetings",\
set xdata time
set timefmt "%Y-%m-%dT%H:%M:%S"
set terminal pngcairo size 1200,800 enhanced font "FreeSans,10"
set yrange [0:20]
unset border
set tics nomirror
set auto y
set auto x
set format x "%H:%M\n%d %B"
# set timestamp
set output "bbb-activity-all-time.png"
set style line 1 lw 4
plot \
"bbb.dat" using 1:4 every 30 with fillsteps fs noborder solid fc rgb "#e0ABC3C9" notitle,\
"bbb.dat" using 1:3 every 30 with fillsteps fs noborder solid fc rgb "#e0F4473A" notitle,\
"bbb.dat" using 1:5 every 30 with fillsteps fs noborder solid fc rgb "#e0601A4A" notitle,\
"bbb.dat" using 1:3 every 30 with steps linewidth 2 lc rgb "#10F4473A" title "Number of video participants",\
"bbb.dat" using 1:4 every 30 with steps linewidth 2 lc rgb "#10ABC3C9" title "Number of audio participants",\
"bbb.dat" using 1:5 every 30 with steps linewidth 2 lc rgb "#70601A4A" title "Number of listeners",\
"bbb.dat" using 1:6 every 30 with steps linewidth 2 lc rgb '#d0382119' title "Total participants",\
"bbb.dat" using 1:2 every 60 with steps dashtype '_-' linewidth 2 lc rgb '#10382119' title "Number of meetings",\
#! /usr/bin/python3
import datetime
import sys
import re
from glob import glob
from pathlib import Path
TZ = datetime.timezone(datetime.timedelta(seconds=43200), 'NZST')
def process_daily_file(path: Path, tz=TZ):
with open(path) as f:
for line in f:
line = line.rstrip()
t_ = re.search("<time>(.*)</time>", line).group(1)
t = datetime.datetime.fromisoformat(t_).astimezone(tz).strftime("%Y-%m-%dT%H:%M:%S")
n_meetings = len(re.findall(" <meeting> ", line))
n_video = sum(int(match) for match in re.findall(r" <videoCount>(\d+)</videoCount> ", line))
n_voice = sum(int(match) for match in re.findall(r" <voiceParticipantCount>(\d+)</voiceParticipantCount>", line))
n_listen = sum(int(match) for match in re.findall(r" <listenerCount>(\d+)</listenerCount> ", line))
yield t, n_meetings, n_video, n_voice, n_listen, n_video + n_voice + n_listen
if __name__ == "__main__":
# for match in glob('Raw/*.xml'):
path = Path(sys.argv[1])
outpath = Path(sys.argv[2])
# outpath = (Path('Clean') / path.stem).with_suffix('.tsv')
with open(outpath, 'w') as outf:
#outf.write(f'time\tn_meetings\tn_video_participants\tn_voice_participants\tn_listeners\n')
for t, n_meetings, n_video, n_voice, n_listen, total in process_daily_file(path):
outf.write(f'{t}\t{n_meetings}\t{n_video}\t{n_voice}\t{n_listen}\t{total}\n')
\ No newline at end of file
......@@ -47,7 +47,7 @@ install-gnuplot() {
if [ -n "$cmd" ]; then
return 0
fi
sudo apt install -y gnuplot
sudo apt install -y gnuplot # TODO: add libgd libfreetype
}
install-rust() {
......@@ -65,8 +65,6 @@ install-just() {
cargo install -q just
}
install-curl
install-rust
install-just
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment