jablonka.czprosek.czf

crusader

Subversion Repositories:
[/] [trunk/] [statistiky/] [opt/] [statistiky/] [makeobr_crusader.sh] - Blame information for rev 1

 

Line No. Rev Author Line
11simandl#!/bin/bash
2 
3name=crusader$1
4timediff=$2
5suffix=$3
6popis=$4
7width=$5
8 
9PATH=$PATH:/opt/rrdtool/bin
10 
11datadir=/var/statistiky/crusader
12target_img_dir="/var/www/heaven/stat/img"
13 
14cd $datadir
15 
16xgridstr=""
17 
18if [ $timediff -ge 604800 ]
19then
20 xgridstr="--x-grid HOUR:12:DAY:1:DAY:1:86400:%d.%m."
21fi
22if [ $timediff -ge 2678400 ]
23then
24 xgridstr="--x-grid DAY:1:DAY:7:DAY:2:86400:%d.%m."
25fi
26 
27now=`date +%s`
28 
29function simple_graph()
30{
31rrdtool graph ${target_img_dir}/${name}_${suffix}.png --imgformat PNG --start `expr $now - ${timediff}` --end $now \
32 DEF:rss_min=${name}.rrd:rss:MIN \
33 DEF:rss_max=${name}.rrd:rss:MAX \
34 DEF:rss_avg=${name}.rrd:rss:AVERAGE \
35 LINE1:rss_max#FF0000:"max" \
36 AREA:rss_avg#a0a0a0:"avg" \
37 LINE1:rss_min#0000FF:"min" \
38 --vertical-label "RSS" \
39 --height 200 \
40 --width ${width} \
41 --title "${name} ${popis}"
42}
43 
44# detekce UNKNOWN
45# CDEF:offline=prumer_avg,UN,INF,0,IF \
46# AREA:offline#f3ff73 \
47 
48 
49function flow_graph()
50{
51 rrdtool graph ${target_img_dir}/${name}_${suffix}.png --imgformat PNG --start `expr $now - ${timediff}` --end $now \
52 DEF:rss_avg=${name}.rrd:rss_avg:AVERAGE \
53 DEF:rss_min=${name}.rrd:rss_min:MIN \
54 DEF:rss_max=${name}.rrd:rss_max:MAX \
55 CDEF:avg1=PREV\(rss_avg\) \
56 CDEF:avg2=PREV\(avg1\) \
57 CDEF:min1=PREV\(rss_min\) \
58 CDEF:max1=PREV\(rss_max\) \
59 CDEF:prumer_avg=rss_avg,avg1,avg2,+,+,3,/ \
60 CDEF:maxmin=max1,min1,- \
61 HRULE:400#FF0000 \
62 HRULE:450#00BB00 \
63 AREA:min1#FFFFFF \
64 STACK:maxmin#e0e0e0 \
65 LINE1:max1#FFa1a1:"max" \
66 LINE1:min1#a8a8FF:"min" \
67 LINE2:prumer_avg#202020:"avg" \
68 --vertical-label "RSS" \
69 --height 200 \
70 --width ${width} \
71 ${xgridstr} \
72 --title "Sila signalu ${name} ${popis}"
73}
74 
75#if [ $timediff -lt 86400 ]
76if [ $timediff -eq 9000 ]
77then
78 rrdtool graph ${target_img_dir}/${name}_${suffix}.png --imgformat PNG --start `expr $now - ${timediff}` --end $now \
79 DEF:rss_avg=${name}.rrd:rss_avg:AVERAGE \
80 DEF:rss_min=${name}.rrd:rss_min:MIN \
81 DEF:rss_max=${name}.rrd:rss_max:MAX \
82 CDEF:maxmin=rss_max,rss_min,- \
83 HRULE:0#000000 \
84 AREA:rss_min#FFFFFF \
85 STACK:maxmin#e0e0e0 \
86 LINE1:rss_min#a8a8FF:"min" \
87 LINE1:rss_max#FFa1a1:"max" \
88 LINE1:rss_avg#202020:"avg" \
89 --vertical-label "RSS" \
90 --height 800 \
91 --width ${width} \
92 ${xgridstr} \
93 --title "Sila signalu ${name} ${popis}"
94else
95 flow_graph
96fi

Powered by WebSVN 2.2.1