summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2017-06-17 19:02:21 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2017-06-17 19:02:21 +0200
commita798128abda047f25c42a37fd5486fff9acffcb9 (patch)
tree3b4f44b067bb3e3fae9d133238ec1adaab0dc84d
downloadstatus-a798128abda047f25c42a37fd5486fff9acffcb9.tar.gz
status-a798128abda047f25c42a37fd5486fff9acffcb9.zip
first version
-rw-r--r--.gitignore1
-rw-r--r--connection_end_over_time.plt14
-rw-r--r--cron.sh40
-rw-r--r--errors_over_time.plt10
-rw-r--r--index.html10
5 files changed, 75 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..8fce603
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+data/
diff --git a/connection_end_over_time.plt b/connection_end_over_time.plt
new file mode 100644
index 0000000..1620572
--- /dev/null
+++ b/connection_end_over_time.plt
@@ -0,0 +1,14 @@
+set title "API /matches response times"
+set timefmt "%Y-%m-%dT%H:%M:%SZ";
+set xdata time;
+set ylabel "response time in ms";
+set yrange [ 60:1000 ];
+
+set datafile separator ", ";
+
+set terminal png noenhanced;
+set key autotitle columnhead;
+set output outputfile;
+plot inputfile using "date":"connection_end_min" with lines, \
+ inputfile using "date":"connection_end_mean" with lines, \
+ inputfile using "date":"connection_end_max" with lines;
diff --git a/cron.sh b/cron.sh
new file mode 100644
index 0000000..109c55f
--- /dev/null
+++ b/cron.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+DATA=$(dirname "$0")/data
+LOGS="/home/timo/vainsocial/logs/logs/pm2"
+mkdir -p $DATA || exit 0
+
+PF=$DATA/apigrabber_processed # progress file
+touch $PF $PF.csv
+find $LOGS -name "apigrabber-out*__????-??-??_??-??-??.log"\
+ | sort\
+ | comm -13 $PF - \
+ | tee -a $PF \
+ | xargs grep -h "connection_end"\
+ | sed -E 's_^(.*?) - .*? API response _date=\1, _g' \
+ | mlr --fs ", " \
+ --ocsv \
+ put '$date = sec2gmt(gmt2sec($date) // (60*60*3) * (60*60*3));' \
+ then cut -f date,connection_end \
+ then stats1 -a min,mean,max -f connection_end -g date \
+ >> $PF.csv
+
+gnuplot -e "inputfile='$PF.csv'; outputfile='$PF.png';" connection_end_over_time.plt
+
+
+PF=$DATA/apigrabber_error_processed # progress file
+touch $PF $PF.csv
+find $LOGS -name "apigrabber-error*__????-??-??_??-??-??.log"\
+ | sort\
+ | comm -13 $PF - \
+ | tee -a $PF \
+ | xargs grep -h " API error "\
+ | sed -E 's_^(.*?) - .*? API error _date=\1, _g' \
+ | mlr --fs ", " \
+ --ocsv \
+ put '$date = sec2gmt(gmt2sec($date) // (60*60*3) * (60*60*3));' \
+ then cut -f date \
+ then stats1 -a count -f date -g date \
+ >> $PF.csv
+
+gnuplot -e "inputfile='$PF.csv'; outputfile='$PF.png';" errors_over_time.plt
diff --git a/errors_over_time.plt b/errors_over_time.plt
new file mode 100644
index 0000000..1e6dbe3
--- /dev/null
+++ b/errors_over_time.plt
@@ -0,0 +1,10 @@
+set title "API /matches errors"
+set timefmt "%Y-%m-%dT%H:%M:%SZ";
+set xdata time;
+
+set datafile separator ", ";
+
+set terminal png noenhanced;
+set key autotitle columnhead;
+set output outputfile;
+plot inputfile using "date":"date_count" with lines;
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..979ca66
--- /dev/null
+++ b/index.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>VainSocial status</title>
+ </head>
+ <body>
+ <img src="/data/apigrabber_processed.png" />
+ <img src="/data/apigrabber_error_processed.png" />
+ </body>
+</html>