iT邦幫忙

0

rrdtool繪圖疑問

各位先進,大家好!
今日在學習rrdtool時,一直有個疑問無法解決,所以想請教各位先進解惑。

我的疑惑是在產生圖片時,圖片中的數值會因資料區間的拉長,而圖檔裡面的數值會被再計算過嗎?
會這樣提問是因為我在產生5分鐘跟15分鐘的圖片時,其數值都是正常的,但卻在產生30分鐘的圖片時,發現裡面的數值都是變小的,不知道是不是再被統計過一次後才顯示繪出?

下面是5分鐘的圖檔:
https://ithelp.ithome.com.tw/upload/images/20191206/20123390JUnbUw8lVt.png

下面是15分鐘的圖檔:
https://ithelp.ithome.com.tw/upload/images/20191206/20123390vjnFVvLArr.png

下面是30分鐘的圖檔:
https://ithelp.ithome.com.tw/upload/images/20191206/20123390emWaUN0bqR.png

下面是我建立rrd的語法:

rrdtool create test.rrd --start '-1day' --step 1 \
DS:qps_ins:GAUGE:1:U:U \
DS:qps_upd:GAUGE:1:U:U \
RRA:AVERAGE:0.5:1:86400 \
RRA:MAX:0.5:1:86400

提供(一些)每秒的數值

rrdtool update test.rrd 1575621500:11:28
rrdtool update test.rrd 1575621501:0:0
rrdtool update test.rrd 1575621502:0:0
rrdtool update test.rrd 1575621503:0:0
rrdtool update test.rrd 1575621504:7:6
rrdtool update test.rrd 1575621505:0:0
rrdtool update test.rrd 1575621506:0:0
rrdtool update test.rrd 1575621507:3526:24
rrdtool update test.rrd 1575621508:3804:6
rrdtool update test.rrd 1575621509:0:0
rrdtool update test.rrd 1575621510:1:0
rrdtool update test.rrd 1575621511:0:0
rrdtool update test.rrd 1575621512:0:0
rrdtool update test.rrd 1575621513:2:5
rrdtool update test.rrd 1575621514:0:0
rrdtool update test.rrd 1575621515:0:0
rrdtool update test.rrd 1575621516:0:0
rrdtool update test.rrd 1575621517:0:0
rrdtool update test.rrd 1575621518:7:6
rrdtool update test.rrd 1575621519:1:0
rrdtool update test.rrd 1575621520:2:8
rrdtool update test.rrd 1575621521:5702:16
rrdtool update test.rrd 1575621522:1626:6
rrdtool update test.rrd 1575621523:0:0
rrdtool update test.rrd 1575621524:0:0
rrdtool update test.rrd 1575621525:0:0
rrdtool update test.rrd 1575621526:9:20
rrdtool update test.rrd 1575621527:0:0
rrdtool update test.rrd 1575621528:0:0
rrdtool update test.rrd 1575621529:1:0
rrdtool update test.rrd 1575621530:0:0
rrdtool update test.rrd 1575621531:0:1
rrdtool update test.rrd 1575621532:7:6
rrdtool update test.rrd 1575621533:0:0
rrdtool update test.rrd 1575621534:77:24
rrdtool update test.rrd 1575621535:6532:0
rrdtool update test.rrd 1575621536:721:6
rrdtool update test.rrd 1575621537:0:0
rrdtool update test.rrd 1575621538:0:0

下面是我產生圖檔的語法:

rrdtool graph test.png \
-a PNG --title '測試' \
--width 800 \
--start  1575621500 --end 1575623300 \
'DEF:s1=test.rrd:qps_ins:AVERAGE' \
'LINE1:s1#ff00E0:1' \
'GPRINT:s1:MIN:MIN\: %7.2lf ' \
'GPRINT:s1:MAX:MAX\: %7.2lf ' \

若上面所提供的訊息有不足之處,請再告訴我,我將再補上。
希望能有先進能幫我解惑,謝謝。

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

0
一級屠豬士
iT邦大師 1 級 ‧ 2019-12-06 21:53:07
最佳解答

RRD 是會聚合平均掉的,會有失真.
他是早期發展,為了節省空間,因為這樣可以確保一些設備的空間不會爆掉.
幾年前我有在本站寫了一些 Python RRDTool 抓系統資訊,網路流量,MySQL資訊的.
不只以下幾個鏈結.你有興趣可以參考看看.
這篇有做一些實例的解釋
https://ithelp.ithome.com.tw/articles/10108351
其他關於RRD的起始幾篇
https://ithelp.ithome.com.tw/articles/10104795
https://ithelp.ithome.com.tw/articles/10104999
https://ithelp.ithome.com.tw/articles/10105480

謝謝您提供資訊!
剛好這兩天休息想了一下,應該是當要呈現的時間過長,而畫布的寬度沒成等比例加大的話,在數據描繪上,就可能需要壓縮了。
今天試著把寬度調大後,其繪出的數據也就是原始資料了。

對了,另外請教一下,除了rrdtool外,是否您還有推薦其他工具使用?
亦或是我可將數據存在一般的RDB上,再使用其它的繪圖工具進行製圖?

謝謝!

Graphite:
https://db-engines.com/en/system/Graphite%3BRRDtool

這跟 RRDTool 有相似之處.

InfluxDB:
https://www.influxdata.com/

展示部分,有 Grafana,可以混搭啦.
也可以用很多語言搭配繪圖模組.看你熟悉或是有興趣哪種.

Time Series DBMS
https://db-engines.com/en/article/Time+Series+DBMS

裡面會有不少連結,可以參考.

謝謝提供資訊!

我要發表回答

立即登入回答