Root/ircstat/stat

Source at commit 36f8bf11e9f224e64996864763fc298e8b72b7ca created 8 years 15 days ago.
By Werner Almesberger, ircstat/stat: don't plot the last (partial) month
1#!/bin/sh
2Q=en.qi-hardware.com/irclogs/qi-hardware
3M=en.qi-hardware.com/mmlogs/milkymist
4# Saving to: `en.qi-hardware.com/irclogs/qi-hardware_2010-06-11.log.html'
5
6N=2
7t=
8>_out
9n=0
10for y in 10 11; do
11    for m in 1 2 3 4 5 6 7 8 9 10 11 12; do
12        mm=`printf "%02d" $m`
13        [ "`echo ${Q}_20${y}-${mm}-*`" = "${Q}_20${y}-${mm}-*" ] &&
14          [ "`echo ${M}_20${y}-${mm}-*`" = "${M}_20${y}-${mm}-*" ] &&
15            continue
16        if [ `expr $n % $N` = 0 ]; then
17            [ "$t" ] && t=$t,
18            t="$t \"$m/$y\" $n"
19        else
20            t="$t, \"\" $n"
21        fi
22# cat ${Q}_20${y}-${mm}-*.log.html | gzip -9 | wc -c >>_out
23        qn=`sed 's/<[^>]*>/ /g' ${Q}_20${y}-${mm}-*.log.html |
24            gzip -9 | wc -c`
25        mn=`sed 's/<[^>]*>/ /g' ${M}_20${y}-${mm}-*.log.html |
26            gzip -9 | wc -c`
27        echo $qn $mn >>_out
28        n=`expr $n + 1`
29    done
30done
31
32gnuplot -persist <<EOF
33set xtics ($t)
34set grid xtics
35set title "Traffic on the Qi-Hardware IRC channels"
36set xlabel "Month"
37set ylabel "Traffic (kbytes gzip'ed)"
38plot "<sed '\$d' _out" using (\$1/1000) with lines title "#qi-hardware" lw 2, \
39  "<sed '\$d' _out" using (\$2/1000) with lines title "#milkymist" lw 2, \
40  "<sed '\$d' _out" using :((\$1+\$2)/1000) with lines title "Both"
41set term png
42set output "out.png"
43replot
44EOF
45

Archive Download this file

Branches:
master



interactive