Last active
August 29, 2015 13:56
-
-
Save vi/9306643 to your computer and use it in GitHub Desktop.
I2P daily graph extraction framework
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Save I2P-generated bandwidth and other statistics to a set of PNG files. | |
| Each file is a png graph of some I2P stat for the given day. | |
| I2P stat can be useful for monitoring networking reliability on host | |
| (assuming that I2P itself is stable). | |
| Usage: | |
| * set parameters in the beginning of Makefile | |
| * chmod +x auxilary scripts | |
| * `make` will start downloading the pictures |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| if [ -z "$1" ]; then | |
| echo "Usage: get_date_range_from_until date_1 date_2" >&2 | |
| echo "Example: get_date_range_from_until 2014-02-27 2013-03-04" >&2 | |
| echo " should output 2014-02-27, 2014-02-28, 2014-03-01, 2014-03-02 and 2014-03-03" >&2 | |
| exit 1 | |
| fi | |
| DATE_FROM=$(date -u --date="$1" +%s) | |
| DATE_TO=$(date -u --date="$2" +%s) | |
| I=$DATE_FROM | |
| while [ $I -lt $DATE_TO ]; do | |
| date -u +'%Y-%m-%d' --date @$I | |
| I=$(expr $I + 3600 \* 24 ) | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| if [ -z "$1" ]; then | |
| echo "Usage: get_seconds_before_now utc_date" >&2 | |
| exit 1 | |
| fi | |
| DATE_SPECIFIED=$(date -u --date="$1" +%s ) | |
| DATE_NOW=$(date -u +%s) | |
| expr \( $DATE_NOW - $DATE_SPECIFIED \) / 60 - 1440 - 30 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #wget 'http://127.0.0.1:7657/viewstat.jsp?stat=tunnel.participatingTunnels&showEvents=false&period=60000&periodCount=1500&end=1744&width=2400&height=600' -O 2014-03-01.png | |
| INITIAL_DAY=2014-01-28 | |
| WIDTH=1200 | |
| HEIGHT=600 | |
| ADDR=http://127.0.0.1:7657 | |
| DATE_NOW=$(date -u +'%Y-%m-%d') | |
| DATES=$(shell ./get_date_range_from_until ${INITIAL_DAY} ${DATE_NOW}) | |
| TARGETS=$(shell for i in ${DATES}; do \ | |
| echo $${i}.pt.png; \ | |
| echo $${i}.pe.png; \ | |
| echo $${i}.bw.png; \ | |
| done) | |
| PT_COMMAND=wget "${ADDR}/viewstat.jsp?stat=tunnel.participatingTunnels&showEvents=false&period=60000&periodCount=1500&width=${WIDTH}&height=${HEIGHT}" | |
| PE_COMMAND=wget "${ADDR}/viewstat.jsp?stat=router.activePeers&showEvents=false&period=60000&periodCount=1500&width=${WIDTH}&height=${HEIGHT}" | |
| BW_COMMAND=wget "${ADDR}/viewstat.jsp?stat=bw.combined&showEvents=false&period=60000&periodCount=1500&width=${WIDTH}&height=${HEIGHT}" | |
| all: ${TARGETS} | |
| %.pt.png: | |
| ${PT_COMMAND}"&end=$(shell ./get_number_of_minutes_since_end_of_this_day $(subst .pt.png, '', $@))" -O $@ | |
| %.pe.png: | |
| ${PE_COMMAND}"&end=$(shell ./get_number_of_minutes_since_end_of_this_day $(subst .pe.png, '', $@))" -O $@ | |
| %.bw.png: | |
| ${BW_COMMAND}"&end=$(shell ./get_number_of_minutes_since_end_of_this_day $(subst .bw.png, '', $@))" -O $@ | |
| print: | |
| @echo ${TARGETS} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment