1 | 1 | simandl | #!/bin/bash |
2 | | | |
3 | | | device=/var/statistiky/zebra |
4 | | | |
5 | | | PATH=$PATH:/opt/rrdtool/bin |
6 | | | |
7 | | | now=`date +%s` |
8 | | | |
9 | | | function make_obr() |
10 | | | # $1 ... device |
11 | | | # $2 ... timediff |
12 | | | # $3 ... suffix |
13 | | | # $4 ... popis |
14 | | | { |
15 | | | local device=$1 |
16 | | | local timediff=$2 |
17 | | | local suffix=$3 |
18 | | | local popis=$4 |
19 | | | |
20 | | | if [ $# -lt 4 ] |
21 | | | then |
22 | | | echo "ERROR: function make_obr - Malo parametru" |
23 | | | return 1 |
24 | | | fi |
25 | | | |
26 | | | rrdtool graph ${device}_${suffix}.png --imgformat PNG --start `expr $now - ${timediff}` --end $now \ |
27 | | | DEF:routes=${device}.rrd:count:AVERAGE \ |
28 | | | LINE2:routes#0000FF:"routes" \ |
29 | | | --vertical-label Pocet \ |
30 | | | --height 200 \ |
31 | | | --title "${popis}" |
32 | | | |
33 | | | mv ${device}_${suffix}.png /var/www/htdocs/stat/img |
34 | | | } |
35 | | | |
36 | | | make_obr $device 86400 1den "pocet rout behem posledniho dne" |
37 | | | make_obr $device 604800 tyden "pocet rout behem posledniho tydne" |