jablonka.czprosek.czf

crusader

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

 

Line No. Rev Author Line
11simandl#!/bin/bash
2 
3name=mpstat
4timediff=$1
5suffix=$2
6popis=$3
7width=$4
8 
9PATH=$PATH:/opt/rrdtool/bin
10 
11datadir=/var/statistiky/system
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 
29if [ $timediff -gt 7200 ]
30then
31 
32 for stat in user nice system iowait irq softirq idle intrs
33 do
34 rrdtool graph ${target_img_dir}/${name}_${stat}_${suffix}.png --imgformat PNG --start `expr $now - ${timediff}` --end $now \
35 DEF:avg_value=${name}.rrd:${stat}:AVERAGE \
36 DEF:min_value=${name}.rrd:${stat}:MIN \
37 DEF:max_value=${name}.rrd:${stat}:MAX \
38 CDEF:avg1=PREV\(avg_value\) \
39 CDEF:avg2=PREV\(avg1\) \
40 CDEF:min1=PREV\(min_value\) \
41 CDEF:max1=PREV\(max_value\) \
42 CDEF:prumer_avg=avg_value,avg1,avg2,+,+,3,/ \
43 CDEF:maxmin=max1,min1,- \
44 AREA:min1#FFFFFF \
45 STACK:maxmin#e0e0e0 \
46 LINE1:max1#FFa1a1:"max" \
47 LINE1:min1#a8a8FF:"min" \
48 LINE2:prumer_avg#202020:"avg" \
49 --vertical-label "CPU time [%]" \
50 --height 200 \
51 --width ${width} \
52 ${xgridstr} \
53 --title "${stat} ${name} ${popis}"
54 done
55 
56else
57 
58 for stat in user nice system iowait irq softirq idle intrs
59 do
60 rrdtool graph ${target_img_dir}/${name}_${stat}_${suffix}.png --imgformat PNG --start `expr $now - ${timediff}` --end $now \
61 DEF:value=${name}.rrd:${stat}:MAX \
62 LINE1:value#000000 \
63 --vertical-label "CPU time [%]" \
64 --height 200 \
65 --width ${width} \
66 ${xgridstr} \
67 --title "${stat} ${name} ${popis}"
68 done
69 
70fi
71 

Powered by WebSVN 2.2.1