2016-08-02 52 views
0

我創建了很多RRDTool圖表來監視Raspberry Pi服務器的各個方面。如何避免在我的RRDTool圖表中獲取空格?

我顯示36小時,10天,45天及18個月之類的東西傳送的數據,CPU溫度,平均負載等

然而,唯一的「連續」尋找圖分別是10天圖表中,所有其他人都有差距。我每隔一段時間記錄每個數據點。

有28(29)的圖像,所以我不打算把他們都在這裏,所以我把它們放在imgur for your perusal

但這裏是我談論的例子:

10天工作正常!

enter image description here

45天,沒有這麼多。

enter image description here

這裏是我的.rrd創建腳本:

rrdtool create data.rrd   \ 
--start N --step '60'   \ 
'DS:rx:GAUGE:60:0:U'   \ 
'DS:tx:GAUGE:60:0:U'   \ 
'DS:rxc:COUNTER:60:0:U'   \ 
'DS:txc:COUNTER:60:0:U'   \ 
'DS:wrx:GAUGE:60:0:U'   \ 
'DS:wtx:GAUGE:60:0:U'   \ 
'DS:wrxc:COUNTER:60:0:U'  \ 
'DS:wtxc:COUNTER:60:0:U'  \ 
'RRA:AVERAGE:0.5:1:129600'  \ 
'RRA:AVERAGE:0.5:2:64800'  \ 
'RRA:AVERAGE:0.5:60:14400'  \ 
'RRA:AVERAGE:0.5:300:12960'  \ 
'RRA:AVERAGE:0.5:3600:13140'  

rrdtool create load.rrd   \ 
--start N      \ 
--step '60'      \ 
'DS:load:GAUGE:60:0:4'   \ 
'RRA:AVERAGE:0.5:1:129600'  \ 
'RRA:AVERAGE:0.5:2:64800'  \ 
'RRA:AVERAGE:0.5:60:14400'  \ 
'RRA:AVERAGE:0.5:300:12960'  \ 
'RRA:AVERAGE:0.5:3600:13140'  

rrdtool create mem.rrd   \ 
--start N      \ 
--step '60'      \ 
'DS:mem:GAUGE:60:0:100'   \ 
'RRA:AVERAGE:0.5:1:129600'  \ 
'RRA:AVERAGE:0.5:2:64800'  \ 
'RRA:AVERAGE:0.5:60:14400'  \ 
'RRA:AVERAGE:0.5:300:12960'  \ 
'RRA:AVERAGE:0.5:3600:13140'  

rrdtool create pitemp.rrd  \ 
--start N      \ 
--step '60'      \ 
'DS:pitemp:GAUGE:60:U:U'  \ 
'RRA:AVERAGE:0.5:1:129600'  \ 
'RRA:AVERAGE:0.5:2:64800'  \ 
'RRA:AVERAGE:0.5:60:14400'  \ 
'RRA:AVERAGE:0.5:300:12960'  \ 
'RRA:AVERAGE:0.5:3600:13140'  

我的整個抽獎腳本是像900線長,所以我就在這裏包括實際的抽獎代碼爲一組圖形($RRDTOOL是一個包含路徑/usr/bin/rrdtool一個變量):

$RRDTOOL graph /var/www/html/images/graphs/data36h.png     \ 
--title 'Odin Absolute Traffic (eth0)'         \ 
--watermark "Graph Drawn `date`"          \ 
--vertical-label 'Bytes'            \ 
--lower-limit '0'              \ 
--rigid                 \ 
--alt-autoscale               \ 
--units=si                \ 
--width '640'               \ 
--height '300'               \ 
--full-size-mode              \ 
--start end-36h               \ 
'DEF:rx=/usr/local/bin/system/data.rrd:rx:AVERAGE'      \ 
'CDEF:cleanrx=rx,UN,PREV,rx,IF'           \ 
'DEF:tx=/usr/local/bin/system/data.rrd:tx:AVERAGE'      \ 
'AREA:rx#00CC00FF:Download\:'           \ 
'GPRINT:rx:LAST:\:%8.2lf %s]'           \ 
'STACK:tx#0000FFFF:Upload\:'           \ 
'GPRINT:tx:LAST:\:%8.2lf %s]\n' 

$RRDTOOL graph /var/www/html/images/graphs/data10d.png     \ 
--title 'Odin Absolute Traffic (eth0) 10 days'       \ 
--watermark "Graph Drawn `date`"          \ 
--vertical-label 'Bytes'            \ 
--lower-limit '0'              \ 
--rigid                 \ 
--alt-autoscale               \ 
--units=si                \ 
--width '640'               \ 
--height '300'               \ 
--full-size-mode              \ 
--start end-10d               \ 
'DEF:rx=/usr/local/bin/system/data.rrd:rx:AVERAGE'      \ 
'DEF:tx=/usr/local/bin/system/data.rrd:tx:AVERAGE'      \ 
'AREA:rx#00CC00FF:Download\:'           \ 
'GPRINT:rx:LAST:\:%8.2lf %s]'           \ 
'STACK:tx#0000FFFF:Upload\:'           \ 
'GPRINT:tx:LAST:\:%8.2lf %s]\n' 

$RRDTOOL graph /var/www/html/images/graphs/data45d.png     \ 
--title 'Odin Absolute Traffic (eth0) 45 days'       \ 
--watermark "Graph Drawn `date`"          \ 
--vertical-label 'Bytes'            \ 
--lower-limit '0'              \ 
--rigid                 \ 
--alt-autoscale               \ 
--units=si                \ 
--width '640'               \ 
--height '300'               \ 
--full-size-mode              \ 
--start end-45d               \ 
'DEF:rx=/usr/local/bin/system/data.rrd:rx:AVERAGE'      \ 
'DEF:tx=/usr/local/bin/system/data.rrd:tx:AVERAGE'      \ 
'AREA:rx#00CC00FF:Download\:'           \ 
'GPRINT:rx:LAST:\:%8.2lf %s]'           \ 
'STACK:tx#0000FFFF:Upload\:'           \ 

$RRDTOOL graph /var/www/html/images/graphs/data18m.png     \ 
--title 'Odin Absolute Traffic (eth0) 18 month'       \ 
--watermark "Graph Drawn `date`"          \ 
--vertical-label 'Bytes'            \ 
--lower-limit '0'              \ 
--rigid                 \ 
--alt-autoscale               \ 
--units=si                \ 
--width '640'               \ 
--height '300'               \ 
--full-size-mode              \ 
--start end-1y6m              \ 
'DEF:rx=/usr/local/bin/system/data.rrd:rx:AVERAGE'      \ 
'DEF:tx=/usr/local/bin/system/data.rrd:tx:AVERAGE'      \ 
'AREA:rx#00CC00FF:Download\:'           \ 
'GPRINT:rx:LAST:\:%8.2lf %s]'           \ 
'STACK:tx#0000FFFF:Upload\:' 

是的,我知道,標題上的一個圖表是錯誤的,我已經解決了這個問題,但只有在將所有圖像保存爲imgur後。

回答

1

如果您選擇60秒內的--step,我會選擇120秒的mrhb,而不是60秒,因爲rrdtool會忽略超過60秒的任何更新。

rrdtool create data.rrd   \ 
--start N --step '60'   \ 
'DS:rx:GAUGE:120:0:U'   \ 
'DS:tx:GAUGE:120:0:U'   \ 
'DS:rxc:COUNTER:120:0:U'   \ 
'DS:txc:COUNTER:120:0:U'   \ 
'DS:wrx:GAUGE:120:0:U'   \ 
'DS:wtx:GAUGE:120:0:U'   \ 
'DS:wrxc:COUNTER:120:0:U'  \ 
'DS:wtxc:COUNTER:120:0:U'  \ 
'RRA:AVERAGE:0.5:1:129600'  \ 
'RRA:AVERAGE:0.5:2:64800'  \ 
'RRA:AVERAGE:0.5:60:14400'  \ 
'RRA:AVERAGE:0.5:300:12960'  \ 
'RRA:AVERAGE:0.5:3600:13140'  
+0

哇,這個人自己!感謝Tobi。按照您的建議,我會用更長的心跳重新創建'.rrd'。並給它一個鏡頭。我會讓它運行幾個星期來確定它是否有效。 – Jim

+0

也許還可以將RRA定義中的xff增加到更高的值。 0.5的默認值通常很好,但如果你得到一些未填充的數據點,那麼你可能會得到未知數。也許提高到0.75,看看這是否有幫助。您的圖表可能使用60尺寸的RRA,因此這可能會有所作爲。 –

+0

我一直在運行120s的心跳,它已經看上去好多了,'Odin絕對流量(eth0)'圖表的頂部沒有更多的「抖動」......從來沒有理解爲什麼日益增加的數量會有微小的減少,但現在已被淘汰。我會密切關注這些圖表,並在幾天內將其標記爲正確。 – Jim