jablonka.czprosek.czf

crusader

Subversion Repositories:
[/] [trunk/] [statistiky/] [opt/] [statistiky/] [makeobr_teplota.sh] - Rev 3 Go to most recent revision

Compare with Previous - Blame - Download


#!/bin/bash

if [ $# -lt 4 ]
then
    echo "Usage: `basename $0` <time interval> <file suffix> <graph comment> [graph width]"
    exit 1;
fi

name=teplota
timediff=$1
suffix=$2
popis=$3

if [ $# -ge 4 ]
then
    width=$4
else
    width=400
fi

#PATH=$PATH:/opt/rrdtool/bin

datadir="/var/statistiky/system"
target_img_dir="/var/www/heaven/stat/img"

cd $datadir

now=`date +%s`

xgridstr=""
if [ $timediff -gt 108000 ]; then xgridstr="--x-grid HOUR:6:DAY:1:DAY:1:86400:%d.%m."; fi
if [ $timediff -gt 777600 ]; then xgridstr="--x-grid DAY:1:WEEK:1:WEEK:1:86400:%d.%m."; fi



function temp_prime_nekonsolidovane_hodnoty()
{
    rrdtool graph ${target_img_dir}/${name}_${suffix}.png --imgformat PNG --start $(($now-${timediff})) --end $now \
        DEF:hdd_avg=${name}.rrd:hdd_temp:AVERAGE \
        HRULE:40#000000 \
        LINE2:hdd_avg#202020:"HDD" \
        --vertical-label "Teplota [st.C]" \
        --height 200 \
        --width  ${width} \
        ${xgridstr} \
        --title "${name} ${popis}" \
        --lower-limit 0
}

if [ true ]
then
    temp_prime_nekonsolidovane_hodnoty
else
    temp_prime_nekonsolidovane_hodnoty
fi

Powered by WebSVN 2.2.1