Initial commit

This commit is contained in:
Alex 2020-04-11 23:44:21 +02:00
commit 3b0eda764c
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
2 changed files with 20 additions and 0 deletions

13
fetchparse.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/zsh
QUEUE="$(curl -sSL 'https://2b2t.io/api/queue?range=1h')"
PRIO="$(curl -sSL 'https://2b2t.io/api/prioqueue?range=1h')"
PLAY="$(curl -sSL 'https://2b2t.io/api/pingstats?range=1h')"
function gnuplot-parsable {
for ((i=0; i<$(print $1 | jq ".|length");i++)); do
printf "%s\t%s\n" $(print $1 | jq ".[$i][0]") $(print $1 | jq ".[$i][1]");
done
}
gnuplot-parsable "$QUEUE" > queuedata
gnuplot-parsable "$PRIO" > priodata
gnuplot-parsable "$PLAY" > playerdata

7
gnuplot Normal file
View File

@ -0,0 +1,7 @@
set xdata time
set timefmt "%s"
set grid
set terminal pngcairo size 1000,1000
set output 'graph.png'
f(x)=sprintf("%d", x)
plot "queuedata" u (f($1)):2 w lp title "Queue", "priodata" u (f($1)):2 w lp title "Priority Queue", "playerdata" u (f($1)):2 w lp title "Players"