1 | 1 | simandl | #!/bin/bash |
2 | | | |
3 | | | device=$1 |
4 | | | timediff=$2 |
5 | | | suffix=$3 |
6 | | | popis=$4 |
7 | | | |
8 | | | PATH=$PATH:/opt/rrdtool/bin |
9 | | | |
10 | | | datadir=/var/statistiky |
11 | | | |
12 | | | cd $datadir |
13 | | | |
14 | | | now=`date +%s` |
15 | | | |
16 | | | rrdtool graph ${device}_${suffix}.png --imgformat PNG --start `expr $now - ${timediff}` --end $now \ |
17 | | | DEF:inbps=${device}.rrd:input:AVERAGE \ |
18 | | | DEF:outbps=${device}.rrd:output:AVERAGE \ |
19 | | | CDEF:inbpsreal=inbps,LOG \ |
20 | | | LINE2:inbpsreal#FF0000:"In traffic" \ |
21 | | | CDEF:outbps2=outbps,LOG \ |
22 | | | LINE2:outbps2#0000FF:"Out traffic" \ |
23 | | | --logarithmic \ |
24 | | | --alt-autoscale \ |
25 | | | --vertical-label Bytes/s \ |
26 | | | --height 200 \ |
27 | | | --title "${device} ${popis}" |
28 | | | |
29 | | | mv ${device}_${suffix}.png /var/www/htdocs/stat/img |