我无法汇总我编写的一些自定义图表。我知道聚合是功能性的,因为我能够聚合默认插件,但我不确定我的有什么问题。
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
经过多次调试,我意识到我错误地使用了标签的名称而不是值的名称。
需要是
因为
换句话说,在我的情况下,服务器行等于:
$arbitraryname1.arbitraryname2.sum $clientname;$hostgroup;$hostname:$pluginname.$valuename
cpu
我也被使用以下语法的示例所抛弃:myapp;web-servers;0-1:cpu.user
但那是因为它的值名称实际上与标签名称一致!您正在尝试将conns作为导出值传递,但这实际上是numberOfConnects