jablonka.czprosek.czf

crusader

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

Powered by WebSVN 2.2.1