Bandwidth

如何在munin中獲得總頻寬圖

  • March 2, 2011

我在所有伺服器上的基本預設配置中都有 munin-node,我想創建一個摘要圖表,顯示輸入/輸出 http 的總頻寬和另一個顯示所有介面的總頻寬輸入/輸出的圖表。

$$ Edit $$在遵循第一個海報建議之後,我目前到這裡; 我正在嘗試為 if_eth0 服務實現向上/向下的聚合 SUM 圖

根據常見問題解答中的詳細資訊; http://munin-monitoring.org/wiki/faq#Q:HowdoIusefieldname.sum

和詳細的例子; http://munin-monitoring.org/wiki/aggregate_examples

還有這篇關於聚合的有趣文章; http://blog.loftninjas.org/2010/04/08/an-evening-with-munin-graph-aggregation/

我在 /etc/munin/munin.conf 中有以下內容來定義我的主機;

   [cirrusj1605.hpl.com]
   address 19x.xx.xx.205
   use_node_name yes
   [cirrusj1606.hpl.com]
   address 19x.xx.xx.206
   use_node_name yes

和一個像這樣的聚合虛擬主機;

$$ hpl.com;aggregates $$ 更新沒有聯繫人沒有

   total_bandwidth.graph_title Aggregated bandwidth
   total_bandwidth.upload.label upload
   total_bandwidth.upload.sum \
   cirrusj1605.hpl.com:if_eth0:up \
   cirrusj1606.hpl.com:if_eth0:up

如果我嘗試手動執行 munin-graph,則在生成每個圖表時都會出現以下錯誤;

2011/02/24 20:04:39

$$ RRD ERROR $$無法繪製 /var/www/html/munin/hpl.com/aggregates/total_bandwidth-month.png :無效的 rpn 表達式:az1_0,UN,0,az1_0,IF,,+ 完整的跟踪如下,關於問題可能是什麼的任何建議?

謝謝,

> -bash-3.2$ /usr/share/munin/munin-graph --debug
> --nofork --nolazy --host aggregates 2011/02/24 20:04:39 [DEBUG] Creating
> new lock file
> /var/run/munin/munin-graph.lock
> 2011/02/24 20:04:39 [DEBUG] Creating
> lock : /var/run/munin/munin-graph.lock
> succeeded 2011/02/24 20:04:39 Starting
> munin-graph 2011/02/24 20:04:39
> [DEBUG] Doing work synchrnonously
> 2011/02/24 20:04:39 [DEBUG] Node name:
> total_bandwidth 2011/02/24 20:04:39
> [DEBUG] Expanding specials for
> total_bandwidth: "upload". 2011/02/24
> 20:04:39 DEBUG: expand_specials
> (cirrusj1605.hpl.com:if_eth0:up):
> Doing sum... 2011/02/24 20:04:39
> [DEBUG] Checking field lengths for
> total_bandwidth:
> "z1_0=cirrusj1605.hpl.com:if_eth0:up".
> 2011/02/24 20:04:39 [DEBUG] Treating
> fields
> "z1_0=cirrusj1605.hpl.com:if_eth0:up","upload".
> 2011/02/24 20:04:39 [DEBUG] Processing
> field "z1_0" [z1_0]. 2011/02/24
> 20:04:39 [PERL WARNING] Use of
> uninitialized value in subroutine
> entry at
> /usr/lib/perl5/vendor_perl/5.8.8/Munin/Master/GraphOld.pm
> line 757. 2011/02/24 20:04:39 DEBUG:
> single_value: Checking field "z1_0".
> 2011/02/24 20:04:39 DEBUG:
> single_value: Checking field "upload".
> 2011/02/24 20:04:39 [DEBUG] service
> hpl.com :: aggregates ::
> total_bandwidth has 2 elements.
> 2011/02/24 20:04:39 [PERL WARNING] Use
> of uninitialized value in
> concatenation (.) or string at
> /usr/lib/perl5/vendor_perl/5.8.8/Munin/Master/GraphOld.pm
> line 774. 2011/02/24 20:04:39 [DEBUG]
> RRD name / filename: z1_0 / 2011/02/24
> 20:04:39 [PERL WARNING] Use of
> uninitialized value in concatenation
> (.) or string at
> /usr/lib/perl5/vendor_perl/5.8.8/Munin/Master/GraphOld.pm
> line 783. 2011/02/24 20:04:39 [PERL
> WARNING] Use of uninitialized value in
> concatenation (.) or string at
> /usr/lib/perl5/vendor_perl/5.8.8/Munin/Master/GraphOld.pm
> line 785. 2011/02/24 20:04:39 [PERL
> WARNING] Use of uninitialized value in
> concatenation (.) or string at
> /usr/lib/perl5/vendor_perl/5.8.8/Munin/Master/GraphOld.pm
> line 786. 2011/02/24 20:04:39 [DEBUG]
> Field name after cdef set to cdefz1_0
> 2011/02/24 20:04:39 [DEBUG] Drawing
> field "z1_0". 2011/02/24 20:04:39
> 
> rrdtool 'graph' '--font' \
>     'LEGEND:7:/usr/share/fonts/bitstream-vera/VeraMono.ttf'
> \
>     '--font' \
>     'UNIT:7:/usr/share/fonts/bitstream-vera/VeraMono.ttf'
> \
>     '--font' \
>     'AXIS:7:/usr/share/fonts/bitstream-vera/VeraMono.ttf'
> \
>     '-W' \
>     'Munin 1.4.5' \
>     '/var/www/html/munin/hpl.com/aggregates/total_bandwidth-month.png'
> \
>     '--title' \
>     'Aggregated bandwidth - by month' \
>     '--start' \
>     '-33d' \
>     '--height' \
>     '175' \
>     '--width' \
>     '400' \
>     '--imgformat' \
>     'PNG' \
>     'DEF:az1_0=:42:MAX' \
>     'DEF:iz1_0=:42:MIN' \
>     'DEF:gz1_0=:42:AVERAGE' \
>     'CDEF:acdefz1_0=az1_0,UN,0,az1_0,IF,,+'
> \
>     'CDEF:icdefz1_0=iz1_0,UN,0,iz1_0,IF,,+'
> \
>     'CDEF:gcdefz1_0=gz1_0,UN,0,gz1_0,IF,,+'
> \
>     'CDEF:ccdefz1_0=gcdefz1_0' \
>     'COMMENT:      ' \
>     'COMMENT: Cur\:' \
>     'COMMENT:Min\:' \
>     'COMMENT:Avg\:' \
>     'COMMENT:Max\:  \j' \
>     'LINE1.6:gcdefz1_0#00CC00:upload ' \
>     'GPRINT:ccdefz1_0:LAST:%6.2lf%s' \
>     'GPRINT:icdefz1_0:MIN:%6.2lf%s' \
>     'GPRINT:gcdefz1_0:AVERAGE:%6.2lf%s' \
>     'GPRINT:acdefz1_0:MAX:%6.2lf%s\j' \
>     'COMMENT:Last update\: Wed Dec 31 16\:00\:00 1969\r' 2011/02/24 20:04:39
> [RRD ERROR] Unable to graph
> /var/www/html/munin/hpl.com/aggregates/total_bandwidth-month.png
> : invalid rpn expression in:
> az1_0,UN,0,az1_0,IF,,+ 2011/02/24
> 20:04:39
> 
> rrdtool 'graph' '--font' \
>     'LEGEND:7:/usr/share/fonts/bitstream-vera/VeraMono.ttf'
> \
>     '--font' \
>     'UNIT:7:/usr/share/fonts/bitstream-vera/VeraMono.ttf'
> \
>     '--font' \
>     'AXIS:7:/usr/share/fonts/bitstream-vera/VeraMono.ttf'
> \
>     '-W' \
>     'Munin 1.4.5' \
>     '/var/www/html/munin/hpl.com/aggregates/total_bandwidth-week.png'
> \
>     '--title' \
>     'Aggregated bandwidth - by week' \
>     '--start' \
>     '-8d' \
>     '--height' \
>     '175' \
>     '--width' \
>     '400' \
>     '--imgformat' \
>     'PNG' \
>     'DEF:az1_0=:42:MAX' \
>     'DEF:iz1_0=:42:MIN' \
>     'DEF:gz1_0=:42:AVERAGE' \
>     'CDEF:acdefz1_0=az1_0,UN,0,az1_0,IF,,+'
> \
>     'CDEF:icdefz1_0=iz1_0,UN,0,iz1_0,IF,,+'
> \
>     'CDEF:gcdefz1_0=gz1_0,UN,0,gz1_0,IF,,+'
> \
>     'CDEF:ccdefz1_0=gcdefz1_0' \
>     'COMMENT:      ' \
>     'COMMENT: Cur\:' \
>     'COMMENT:Min\:' \
>     'COMMENT:Avg\:' \
>     'COMMENT:Max\:  \j' \
>     'LINE1.6:gcdefz1_0#00CC00:upload ' \
>     'GPRINT:ccdefz1_0:LAST:%6.2lf%s' \
>     'GPRINT:icdefz1_0:MIN:%6.2lf%s' \
>     'GPRINT:gcdefz1_0:AVERAGE:%6.2lf%s' \
>     'GPRINT:acdefz1_0:MAX:%6.2lf%s\j' \
>     'COMMENT:Last update\: Wed Dec 31 16\:00\:00 1969\r' 2011/02/24 20:04:39
> [RRD ERROR] Unable to graph
> /var/www/html/munin/hpl.com/aggregates/total_bandwidth-week.png
> : invalid rpn expression in:
> az1_0,UN,0,az1_0,IF,,+ 2011/02/24
> 20:04:39
> 
> rrdtool 'graph' '--font' \
>     'LEGEND:7:/usr/share/fonts/bitstream-vera/VeraMono.ttf'
> \
>     '--font' \
>     'UNIT:7:/usr/share/fonts/bitstream-vera/VeraMono.ttf'
> \
>     '--font' \
>     'AXIS:7:/usr/share/fonts/bitstream-vera/VeraMono.ttf'
> \
>     '-W' \
>     'Munin 1.4.5' \
>     '/var/www/html/munin/hpl.com/aggregates/total_bandwidth-day.png'
> \
>     '--title' \
>     'Aggregated bandwidth - by day' \
>     '--start' \
>     '-30h' \
>     '--height' \
>     '175' \
>     '--width' \
>     '400' \
>     '--imgformat' \
>     'PNG' \
>     'DEF:az1_0=:42:MAX' \
>     'DEF:iz1_0=:42:MIN' \
>     'DEF:gz1_0=:42:AVERAGE' \
>     'CDEF:acdefz1_0=az1_0,UN,0,az1_0,IF,,+'
> \
>     'CDEF:icdefz1_0=iz1_0,UN,0,iz1_0,IF,,+'
> \
>     'CDEF:gcdefz1_0=gz1_0,UN,0,gz1_0,IF,,+'
> \
>     'CDEF:ccdefz1_0=gcdefz1_0' \
>     'COMMENT:      ' \
>     'COMMENT: Cur\:' \
>     'COMMENT:Min\:' \
>     'COMMENT:Avg\:' \
>     'COMMENT:Max\:  \j' \
>     'LINE1.6:gcdefz1_0#00CC00:upload ' \
>     'GPRINT:ccdefz1_0:LAST:%6.2lf%s' \
>     'GPRINT:icdefz1_0:MIN:%6.2lf%s' \
>     'GPRINT:gcdefz1_0:AVERAGE:%6.2lf%s' \
>     'GPRINT:acdefz1_0:MAX:%6.2lf%s\j' \
>     'COMMENT:Last update\: Wed Dec 31 16\:00\:00 1969\r' 2011/02/24 20:04:39
> [RRD ERROR] Unable to graph
> /var/www/html/munin/hpl.com/aggregates/total_bandwidth-day.png
> : invalid rpn expression in:
> az1_0,UN,0,az1_0,IF,,+ 2011/02/24
> 20:04:39
> 
> rrdtool 'graph' '--font' \
>     'LEGEND:7:/usr/share/fonts/bitstream-vera/VeraMono.ttf'
> \
>     '--font' \
>     'UNIT:7:/usr/share/fonts/bitstream-vera/VeraMono.ttf'
> \
>     '--font' \
>     'AXIS:7:/usr/share/fonts/bitstream-vera/VeraMono.ttf'
> \
>     '-W' \
>     'Munin 1.4.5' \
>     '/var/www/html/munin/hpl.com/aggregates/total_bandwidth-year.png'
> \
>     '--title' \
>     'Aggregated bandwidth - by year' \
>     '--start' \
>     '-400d' \
>     '--height' \
>     '175' \
>     '--width' \
>     '400' \
>     '--imgformat' \
>     'PNG' \
>     'DEF:az1_0=:42:MAX' \
>     'DEF:iz1_0=:42:MIN' \
>     'DEF:gz1_0=:42:AVERAGE' \
>     'CDEF:acdefz1_0=az1_0,UN,0,az1_0,IF,,+'
> \
>     'CDEF:icdefz1_0=iz1_0,UN,0,iz1_0,IF,,+'
> \
>     'CDEF:gcdefz1_0=gz1_0,UN,0,gz1_0,IF,,+'
> \
>     'CDEF:ccdefz1_0=gcdefz1_0' \
>     'COMMENT:      ' \
>     'COMMENT: Cur\:' \
>     'COMMENT:Min\:' \
>     'COMMENT:Avg\:' \
>     'COMMENT:Max\:  \j' \
>     'LINE1.6:gcdefz1_0#00CC00:upload ' \
>     'GPRINT:ccdefz1_0:LAST:%6.2lf%s' \
>     'GPRINT:icdefz1_0:MIN:%6.2lf%s' \
>     'GPRINT:gcdefz1_0:AVERAGE:%6.2lf%s' \
>     'GPRINT:acdefz1_0:MAX:%6.2lf%s\j' \
>     'COMMENT:Last update\: Wed Dec 31 16\:00\:00 1969\r' 2011/02/24 20:04:39
> [RRD ERROR] Unable to graph
> /var/www/html/munin/hpl.com/aggregates/total_bandwidth-year.png
> : invalid rpn expression in:
> az1_0,UN,0,az1_0,IF,,+ 2011/02/24
> 20:04:39 Graphed service :
> total_bandwidth (0.01 sec * 4)
> 2011/02/24 20:04:39 Munin-graph
> finished (0.11 sec)

是的,它是通過創建組合圖在伺服器端完成的。

基本上它是通過在 munin 伺服器配置 ( munin.conf) 中描述一個新圖表來完成的,其中繪製的數據是兩個數據源的總和:

[some.machine.boo]
   total_http_bw.graph_order total_received
   total_http_bw.graph_title HTTP traffic recived by machine1 and machine2
   total_http_bw.graph_vlabel Kb/s
   total_http_bw.total_received.label HTTP received traffic
   total_http_bw.total_received.sum \
           machine1.machine.boo:http_bw:received \
           machine2.machine.boo:http_bw:received

您可以在 munin 網站上找到一個堆疊範例(將兩個數據源一個在另一個之上)。如果要繪製兩個數據源的總和,可以使用total_received.sum函式而不是total_received.stack.

$$ edit $$我在此答案中添加了具有網路介面頻寬所需的節,因為它為原始問題提供了更完整的答案(我無法選擇 2 個正確答案等) 我在讓網路介面放棄它們作為 SUM 的值時遇到了很多麻煩,所以這裡是大量隨機試驗和錯誤更改以獲得多個 munin 節點的 SUM 折線圖的最終結果

   [mydomain.com;aggregates]
   total_bandwidth.graph_args --base 1000 -l 0
   total_bandwidth.cdef 0
   total_bandwidth.graph_category Network
   total_bandwidth.graph_title Aggregated bandwidth
   total_bandwidth.graph_vlabel Bits/sec
   total_bandwidth.upload.label upload
   total_bandwidth.total.graph yes
   total_bandwidth.upload.sum \
   mybox1.mydomain.com:if_eth0.up \
   mybox2.mydomain.com:if_eth0.up
   total_bandwidth.upload.type COUNTER
   total_bandwidth.download.type COUNTER
   total_bandwidth.download.label download
   total_bandwidth.graph_order upload download
   total_bandwidth.total.graph no
   total_bandwidth.download.sum \
   mybox1.mydomain.com:if_eth0.down \
   mybox2.mydomain.com:if_eth0.down

我懷疑其中一些指令要麼是不必要的,要麼是完全錯誤的,但我希望它是任何試圖實現相同目標的人的工作起點。

我還懷疑,如果您明確確保所有主機都在聚合組中,例如 mydomain.com,即使您的主機在本地hostname -f被錯誤地命名(例如錯誤) ,它也會更好地工作

引用自:https://serverfault.com/questions/239553