Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Еще один вопрос по мониторингу!
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Russian
View previous topic :: View next topic  
Author Message
ManJak
Guru
Guru


Joined: 18 Dec 2004
Posts: 561
Location: St. Petersburg, Russia

PostPosted: Fri Aug 26, 2005 7:20 pm    Post subject: Еще один вопрос по мониторингу! Reply with quote

Есть куча данных:
Code:

#!/bin/sh
export RRD_DEFAULT_FONT=/usr/share/fonts/WIN_TTF/times.ttf

# Graphics size
size_v=500
size_h=850

# DB file
db_file=/var/www/localhost/htdocs/rrd/temp0.rrd

# digitemp -t 0 -q -o "%.3C" -c /etc/digitemp

# Декомментировать один раз при старте, чтоб не делать услоие [ -f ]
#rrdtool create -s 60 /var/www/localhost/htdocs/rrd/temp0.rrd \
#DS:value:GAUGE:120:U:U \
#RRA:AVERAGE:0.5:1:3600 \
#RRA:AVERAGE:0.5:60:8640 \
#RRA:AVERAGE:0.5:1440:21600 \
#RRA:AVERAGE:0.5:44640:21600 \
#RRA:AVERAGE:0.5:535680:21600 \

value=`digitemp -t 0 -q -o "%.3C" -c /etc/digitemp`
rrdtool update ${db_file} N:$value

# 1 Hour graph
rrdtool graph /var/www/localhost/htdocs/rrd/temp0_hour.png \
-s -3600 -e now -i -a PNG -v "Temperature" -w ${size_h} -h ${size_v} -R mono \
-x MINUTE:1:MINUTE:10:MINUTE:5:0:%H:%M \
DEF:av_temp=${db_file}:value:AVERAGE \
VDEF:last=av_temp,LAST \
VDEF:min=av_temp,MINIMUM \
VDEF:av=av_temp,AVERAGE \
VDEF:max=av_temp,MAXIMUM \
AREA:av_temp#00FF00:"C" \
LINE:min#0000FF:"C, Min" \
LINE:av#FF00FF:"C, Average" \
LINE:max#FF0000:"C, Max" \
COMMENT:"\n" \
GPRINT:last:"Last\: %.2lf C" \
GPRINT:min:"Minimal\: %.2lf C" \
GPRINT:av:"Average\: %.2lf C" \
GPRINT:max:"Maximal\: %.2lf C"

# 1 Day graph
rrdtool graph /var/www/localhost/htdocs/rrd/temp0_day.png \
-s -86400 -e now -i -a PNG -v "Temperature" -w ${size_h} -h ${size_v} -R mono \
-x MINUTE:10:HOUR:1:HOUR:2:0:%H:%M \
DEF:av_temp=${db_file}:value:AVERAGE \
VDEF:last=av_temp,LAST \
VDEF:min=av_temp,MINIMUM \
VDEF:av=av_temp,AVERAGE \
VDEF:max=av_temp,MAXIMUM \
AREA:av_temp#00FF00:"C" \
LINE:min#0000FF:"C, Min" \
LINE:av#FF00FF:"C, Average" \
LINE:max#FF0000:"C, Max" \
COMMENT:"\n" \
GPRINT:last:"Last\: %.2lf C" \
GPRINT:min:"Minimal\: %.2lf C" \
GPRINT:av:"Average\: %.2lf C" \
GPRINT:max:"Maximal\: %.2lf C"

# 1 Month graph
rrdtool graph /var/www/localhost/htdocs/rrd/temp0_month.png \
-s -2592000 -e now -i -a PNG -v "Temperature" -w ${size_h} -h ${size_v} -R mono \
-x DAY:1:MONTH:1:DAY:2:0:%d.%m \
DEF:av_temp=${db_file}:value:AVERAGE \
VDEF:last=av_temp,LAST \
VDEF:min=av_temp,MINIMUM \
VDEF:av=av_temp,AVERAGE \
VDEF:max=av_temp,MAXIMUM \
AREA:av_temp#00FF00:"C" \
LINE:min#0000FF:"C, Min" \
LINE:av#FF00FF:"C, Average" \
LINE:max#FF0000:"C, Max" \
COMMENT:"\n" \
GPRINT:last:"Last\: %.2lf C" \
GPRINT:min:"Minimal\: %.2lf C" \
GPRINT:av:"Average\: %.2lf C" \
GPRINT:max:"Maximal\: %.2lf C"

# 1 Year graph
rrdtool graph /var/www/localhost/htdocs/rrd/temp0_year.png \
-s -31104000 -e now -i -a PNG -v "Temperature" -w ${size_h} -h ${size_v} -R mono \
-x WEEK:1:MONTH:1:MONTH:1:0:%d.%m.%Y \
DEF:av_temp=${db_file}:value:AVERAGE \
VDEF:last=av_temp,LAST \
VDEF:min=av_temp,MINIMUM \
VDEF:av=av_temp,AVERAGE \
VDEF:max=av_temp,MAXIMUM \
AREA:av_temp#00FF00:"C" \
LINE:min#0000FF:"C, Min" \
LINE:av#FF00FF:"C, Average" \
LINE:max#FF0000:"C, Max" \
COMMENT:"\n" \
GPRINT:last:"Last\: %.2lf C" \
GPRINT:min:"Minimal\: %.2lf C" \
GPRINT:av:"Average\: %.2lf C" \
GPRINT:max:"Maximal\: %.2lf C"

# Many Year graph
rrdtool graph /var/www/localhost/htdocs/rrd/temp0_years.png \
-s -155520000 -e now -i -a PNG -v "Temperature" -w ${size_h} -h ${size_v} -R mono \
-x MONTH:1:MONTH:12:YEAR:1:0:%d.%m.%Y \
DEF:av_temp=${db_file}:value:AVERAGE \
VDEF:last=av_temp,LAST \
VDEF:min=av_temp,MINIMUM \
VDEF:av=av_temp,AVERAGE \
VDEF:max=av_temp,MAXIMUM \
AREA:av_temp#00FF00:"C" \
LINE:min#0000FF:"C, Min" \
LINE:av#FF00FF:"C, Average" \
LINE:max#FF0000:"C, Max" \
COMMENT:"\n" \
GPRINT:last:"Last\: %.2lf C" \
GPRINT:min:"Minimal\: %.2lf C" \
GPRINT:av:"Average\: %.2lf C" \
GPRINT:max:"Maximal\: %.2lf C"


Данные за Час:
Last: 20,56 Minimal: 20.50 Average: 20.57 Maximal: 20.75
Сутки:
Last: 20,56 Minimal: 15.44 Average: 20.86 Maximal: 25.62
Месяц:
Last: 20,61 Minimal: 13.21 Average: 21.45 Maximal: 27.00
Год:
Last: 24.00 Minimal: 17.67 Average: 21.54 Maximal: 24.00
Пятилетка:
Last: 21.88 Minimal: 21.88 Average: 21.88 Maximal: 21.88

В чем фикус?
Минимал и максимал не должны быть одинаковые?
Хрень какая-то :cry:
Back to top
View user's profile Send private message
ManJak
Guru
Guru


Joined: 18 Dec 2004
Posts: 561
Location: St. Petersburg, Russia

PostPosted: Fri Aug 26, 2005 7:22 pm    Post subject: Reply with quote

Устраивает все, но Минимум/Максимум/Середина, - не должны (ИМХО) так разниться :cry:
Back to top
View user's profile Send private message
ba
l33t
l33t


Joined: 25 May 2003
Posts: 804

PostPosted: Sun Aug 28, 2005 2:52 pm    Post subject: Reply with quote

а ты почитай дамп выданный rrdtool dump -ом...
Back to top
View user's profile Send private message
ManJak
Guru
Guru


Joined: 18 Dec 2004
Posts: 561
Location: St. Petersburg, Russia

PostPosted: Sun Aug 28, 2005 4:38 pm    Post subject: Reply with quote

Пасиб, попробую, но читать тут больше, чем в войне и мире :D

$ rrdtool dump temp0.rrd | wc -l
77151

Но, может и впрямь - натолкнет на размышления =)

По крайней мере улыбнуло:
...
<!-- 1946-07-10 03:00:00 MSK / -740966400 --> <row><v> N
aN </v></row>
...
Т.е., данные будут долго жить :roll:
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Russian All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum