Munin

聚合的 munin 圖形文件為空

  • March 24, 2016

我無法彙總我編寫的一些自定義圖表。我知道聚合是功能性的,因為我能夠聚合預設外掛,但我不確定我的有什麼問題。

munin.conf:

[myapp;web-servers;0-1]
       address 1.2.3.4
       use_node_name yes
[myapp;web-servers;0-2]
       address 5.6.7.8
       use_node_name yes

[myapp;web-servers;Aggregated]
       update no

#does not work:
   node_aggregate.graph_args --base 1000 -l 0
   node_aggregate.graph_title Aggregated connects
   node_aggregate.conns.label conns
   node_aggregate.conns.sum myapp;web-servers;0-1:nodejs_numberOfConnects.conns myapp;web-servers;0-2:nodejs_numberOfConnects.conns


#works:
   node_aggregate.graph_title Aggregated cpu
   node_aggregate.cpu.label cpu.user
   node_aggregate.cpu.sum myapp;web-servers;0-1:cpu.user myapp;web-servers;0-2:cpu.user

我的外掛看起來像這樣:

if [[ "$PARAM" == "numberOfConnects" ]]; then
       echo "graph_title Active Connects";
       echo "graph_info Active Connects";
       echo "graph_vlabel Connections";
       echo "$PARAM.label conns";
       echo "$PARAM.type GAUGE";
       echo "$PARAM.colour 0927EB"
       exit 0;
elif ...
fi
echo $PARAM.value 15

出於測試目的,我可以硬編碼“$PARAM.value 15”。然後我可以做

munin-run --servicedir /etc/munin/plugins nodejs_numberOfConnects這將返回numberOfConnects.value 15

我得到的錯誤是:

==> /var/log/munin/munin-graph.log <==
2016/03/15 13:57:01 [ERROR] filename is empty for $VAR1 = {
 '#%#name' => 'z1_0',
 'cdef' => 'z1_0,UN,0,z1_0,IF',
 'graph' => 'no',
 'label' => 'z1_0'
};
, myapp;web-servers;0-1:nodejs_numberOfConnects.conns

2016/03/15 13:57:01 [ERROR] filename is empty for $VAR1 = {
 '#%#name' => 'z1_1',
 'cdef' => 'z1_1,UN,0,z1_1,IF,z1_0,ADDNAN',
 'colour' => undef,
 'draw' => undef,
 'graph' => 'yes',
 'label' => 'conns'
};
, myapp;web-servers;0-2:nodejs_numberOfConnects.conns

您正在嘗試將conns作為導出值傳遞,但這實際上是numberOfConnects

node_aggregate.nodejs_numberOfConnects.label conns(or whatever)
node_aggregate.nodejs_numberOfConnects.sum \ 
   myapp;web-servers;0-1:nodejs_numberOfConnects.numberOfConnects \ 
   myapp;web-servers;0-2:nodejs_numberOfConnects.numberOfConnects

經過多次調試,我意識到我錯誤地使用了標籤的名稱而不是的名稱。

node_aggregate.conns.sum myapp;web-servers;0-1:nodejs_numberOfConnects.conns myapp;web-servers;0-2:nodejs_numberOfConnects.conns

需要是

node_aggregate.conns.sum myapp;web-servers;0-1:nodejs_numberOfConnects.numberOfConnects myapp;web-servers;0-2:nodejs_numberOfConnects.numberOfConnects

因為

if [[ "$PARAM" == "numberOfConnects" ]]; then
[...]
echo $PARAM.value 15

換句話說,在我的情況下,伺服器行等於:

$arbitraryname1.arbitraryname2.sum $clientname;$hostgroup;$hostname:$pluginname.$valuename

cpu我也被使用以下語法的範例所拋棄:

myapp;web-servers;0-1:cpu.user但那是因為它的值名稱實際上與標籤名稱一致!

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