Collectd 和石墨每 5 分鐘導入一次數據,而不是 1 分鐘
我對石墨有點陌生,所以請耐心等待。我正在尋找一個大型且相當笨重的仙人掌裝置的替代品,所以我一直在玩石墨。我們通過 SNMP 提取大量數據,因此我還下載、編譯並安裝了 collectd 以將 SNMP 數據傳輸到石墨中。
我在 collectd 中設置了一個簡單的查詢來獲取目前
eth0
的輸入/輸出計數器。我希望以一分鐘的解析度捕捉一周,然後是 5 分鐘,所以我的storage-schemas.conf
樣子是這樣的:[carbon] pattern = ^carbon\. retentions = 60:90d [default] pattern = .* retentions = 60s:1w, 5m:1y
同樣,在
collectd.conf
我設置了以下內容:<Plugin snmp> <Data "std_traffic"> Type "if_octets" Table true Instance "IF-MIB::ifDescr" Values "IF-MIB::ifInOctets" "IF-MIB::ifOutOctets" </Data> <Host "lonsbrndlb01"> Address "lonsbrndlb01" Version 2 Community "public" Collect "std_traffic" Interval 60 </Host> </Plugin>
這幾乎完美無缺。密鑰出現在石墨中,數據進入。
唯一的問題是數據是一個計數器,而不是每分鐘的速率。我可以通過使用該
derivative
函式在石墨中解決這個問題,據說該函式將計數器轉換為每分鐘速率。但是,這樣做,我看到了這張圖:很明顯,數據僅每 5 分鐘到達一次,而不是我指定的每 60 秒到達一次。為什麼是這樣?我以為我會在 collectd 和石墨中設置正確的值,所以我認為我在某處遺漏了一些東西。
編輯
關於這方面的更多數據,因為它可能有用。
我使用的公式只是
derivative(lonsbrndlb01.snmp.if_octets-eth0.tx)
andderivative(lonsbrndlb01.snmp.if_octets-eth0.rx)
,儘管由於計數器翻轉,我現在已經切換到使用 nonNegativeDerivative。我還更新了下圖以提供比例感。
whisper-dump.py
在文件上執行rx.wsp
會給出以下標題:Meta data: aggregation method: average max retention: 31536000 xFilesFactor: 0.5 Archive 0 info: offset: 40 seconds per point: 60 points: 10080 retention: 604800 size: 120960 Archive 1 info: offset: 121000 seconds per point: 300 points: 105120 retention: 31536000 size: 1261440
其次是大約 2.4M 的數據。
通過附加從圖中得到的數據
&format=json
是:[{"target": "nonNegativeDerivative(lonsbrndlb01.snmp.if_octets-eth0.rx)", "datapoints": [[null, 1342597800], [26346975.0, 1342597860], [35197821.0, 1342597920], [138121.0, 1342597980], [108605.0, 1342598040], [690712.0, 1342598100], [27213713.0, 1342598160], [876898.0, 1342598220], [463897.0, 1342598280], [137499.0, 1342598340], [96980.0, 1342598400], [26237641.0, 1342598460], [35094898.0, 1342598520], [112569.0, 1342598580], [274897.0, 1342598640], [139174.0, 1342598700], [806881.0, 1342598760], [26206311.0, 1342598820], [112298.0, 1342598880], [781205.0, 1342598940], [606872.0, 1342599000], [5184462.0, 1342599060], [61946135.0, 1342599120], [4126005.0, 1342599180], [115908.0, 1342599240], [714159.0, 1342599300], [195738.0, 1342599360], [26261781.0, 1342599420], [100503.0, 1342599480], [751322.0, 1342599540], [930865.0, 1342599600], [230666.0, 1342599660], [59636.0, 1342599720], [62575579.0, 1342599780], [104950.0, 1342599840], [1208886.0, 1342599900], [379369.0, 1342599960], [785827.0, 1342600020], [26215475.0, 1342600080], [221604.0, 1342600140], [351866.0, 1342600200], [231163.0, 1342600260], [211398.0, 1342600320], [70770807.0, 1342600380], [429324.0, 1342600440], [1937893.0, 1342600500], [1476961.0, 1342600560], [72383.0, 1342600620], [371513.0, 1342600680], [29186024.0, 1342600740], [1924055.0, 1342600800], [280068.0, 1342600860], [341216.0, 1342600920], [36643885.0, 1342600980], [26708952.0, 1342601040], [259828.0, 1342601100], [488406.0, 1342601160], [230698.0, 1342601220], [766407.0, 1342601280], [28252848.0, 1342601340]]}, {"target": "nonNegativeDerivative(lonsbrndlb01.snmp.if_octets-eth0.tx)", "datapoints": [[null, 1342597800], [26007032.0, 1342597860], [34808859.0, 1342597920], [100498.0, 1342597980], [91818.0, 1342598040], [649666.0, 1342598100], [26566941.0, 1342598160], [895897.0, 1342598220], [478867.0, 1342598280], [100242.0, 1342598340], [81130.0, 1342598400], [25908859.0, 1342598460], [34659481.0, 1342598520], [75295.0, 1342598580], [285061.0, 1342598640], [103644.0, 1342598700], [824177.0, 1342598760], [25884962.0, 1342598820], [93420.0, 1342598880], [799160.0, 1342598940], [582373.0, 1342599000], [5024696.0, 1342599060], [61269813.0, 1342599120], [3336907.0, 1342599180], [436657.0, 1342599240], [696692.0, 1342599300], [182144.0, 1342599360], [25947578.0, 1342599420], [79011.0, 1342599480], [733857.0, 1342599540], [1015395.0, 1342599600], [184960.0, 1342599660], [48026.0, 1342599720], [61462810.0, 1342599780], [89187.0, 1342599840], [1195360.0, 1342599900], [386772.0, 1342599960], [744445.0, 1342600020], [25913548.0, 1342600080], [201978.0, 1342600140], [344650.0, 1342600200], [199421.0, 1342600260], [208959.0, 1342600320], [69924581.0, 1342600380], [381593.0, 1342600440], [1610764.0, 1342600500], [1484192.0, 1342600560], [41585.0, 1342600620], [373375.0, 1342600680], [28478208.0, 1342600740], [1893711.0, 1342600800], [253921.0, 1342600860], [354558.0, 1342600920], [36199040.0, 1342600980], [26395675.0, 1342601040], [239238.0, 1342601100], [477775.0, 1342601160], [212554.0, 1342601220], [752374.0, 1342601280], [27890202.0, 1342601340]]}]
它可能是峰值數據,但這個盒子不可能每隔幾分鐘就達到 60MBit 的流量峰值。
如果您在適當的 Whisper 文件上使用 Whisper-dump.py 命令,它會顯示什麼?從圖表上看,它並不是每 5 分鐘一次。您是否有可能只是獲得尖峰網路流量?此外,對於計數器,使用 nonNegativeDerivative 而不是 Derivative 總是一個好主意,因為 nonNegative 版本考慮了翻轉。