summaryrefslogtreecommitdiff
path: root/cron.sh
blob: 9e44c0444db2f345820aa44dab424b1042e9a990 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/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 \
          then sort -f date \
    >> $PF.csv

gnuplot -e "inputfile='$PF.csv'; outputfile='$PF.png';" $DATA/../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 \
          then sort -f date \
    >> $PF.csv

gnuplot -e "inputfile='$PF.csv'; outputfile='$PF.png';" $DATA/../errors_over_time.plt


PF=$DATA/processor_processed  # progress file
touch $PF $PF.csv
find $LOGS -name "processor-out*__????-??-??_??-??-??.log"\
    | sort\
    | comm -13 $PF - \
    | tee -a $PF \
    | xargs grep -h " database transaction " \
    | sed -E 's_^(.*?) - .*? database transaction _date=\1, _g' \
    | mlr --fs ", " \
          --ocsv \
          put '$date = sec2gmt(gmt2sec($date) // (60*60*3) * (60*60*3));' \
          then put '$duration = gsub($duration, "ms", "");' \
          then cut -f date,duration \
          then stats1 -a mean,count -f duration -g date \
          then sort -f date \
    | grep -v "1970" \
    >> $PF.csv

gnuplot -e "inputfile='$PF.csv'; outputfile='$PF.png';" $DATA/../transactions_over_time.plt


PF=$DATA/processor_batch_processed  # progress file
touch $PF $PF.csv
find $LOGS -name "processor-out*__????-??-??_??-??-??.log"\
    | sort\
    | comm -13 $PF - \
    | tee -a $PF \
    | xargs grep -h " processing batch " \
    | sed -E 's_^(.*?) - .*? processing batch _date=\1, _g' \
    | mlr --fs ", " \
          --ocsv \
          put '$date = sec2gmt(gmt2sec($date) // (60*60*3) * (60*60*3));' \
          then stats1 -a count -f players,matches,telemetries -g date \
          then sort -f date \
    | grep -v "1970" \
    >> $PF.csv

gnuplot -e "inputfile='$PF.csv'; outputfile='$PF.png';" $DATA/../objects_over_time.plt