-
Notifications
You must be signed in to change notification settings - Fork 1
/
ipfs-graph
executable file
·33 lines (31 loc) · 1.53 KB
/
ipfs-graph
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
#!/bin/sh
set -eu
rrd_file=ipfs.rrd
graph_file=ipfs.png
smoothing=120
wantlist_scale=0.001
rrdtool graph "$graph_file" -e now -s 'end-2h' -w 800 -h 400 -a PNG -E -Y \
--vertical-label "B/s" \
--right-axis "-$wantlist_scale:0" --right-axis-label "objects" \
"DEF:data_in=$rrd_file:data_in:AVERAGE" \
"DEF:bw_total_in=$rrd_file:bw_total_in:AVERAGE" \
"DEF:bw_total_out=$rrd_file:bw_total_out:AVERAGE" \
"DEF:blocks_in=$rrd_file:blocks_in:AVERAGE" \
"DEF:blocks_dup_in=$rrd_file:blocks_dup_in:AVERAGE" \
"DEF:wantlist_length=$rrd_file:wantlist_length:AVERAGE" \
"CDEF:blocks_dup_ratio=blocks_dup_in,blocks_in,/,0,ADDNAN" \
"CDEF:bw_total_dup_in=bw_total_in,blocks_dup_ratio,*" \
"CDEF:data_in_smooth=data_in,$smoothing,TRENDNAN" \
"CDEF:bw_total_in_smooth=bw_total_in,$smoothing,TRENDNAN" \
"CDEF:bw_total_out_smooth=bw_total_out,$smoothing,TRENDNAN" \
"CDEF:bw_total_dup_in_smooth=bw_total_dup_in,$smoothing,TRENDNAN" \
"CDEF:bw_total_undup_in_smooth=bw_total_in_smooth,bw_total_dup_in_smooth,-" \
"CDEF:wantlist_length_scaled=wantlist_length,-$wantlist_scale,/" \
"AREA:bw_total_undup_in_smooth#ddff77:Download rate (new blocks portion, estimated ratio)\l" \
"AREA:bw_total_dup_in_smooth#00ff00:Download rate (dup blocks portion, estimated ratio)\l:STACK" \
"LINE1:bw_total_in_smooth#00ff00" \
"LINE2:bw_total_out_smooth#770000:Upload rate\l" \
"LINE2:data_in_smooth#0000ff:File growth rate\l" \
"AREA:wantlist_length_scaled#ff00ff33" \
"LINE2:wantlist_length_scaled#ff00ff:Wantlist length\l" \
"HRULE:0#0000007f::dashes"