collectionswrite_graphite插件 – 多个/不同的前缀?

我正在使用snmp和write_graphite插件的collectd。 我希望某些指标以前缀A转到Graphite,而其他指标以前缀B转到Graphite / Whisper中组织的数据。

例如,我想分开这样的东西:

network.switches.xxxx power.pdu.xxxxxx

我的write_graphiteconfiguration如下所示:

<Plugin write_graphite> <Node "mygraphitehost"> Host "mygraphitehost" Port "2003" Protocol "tcp" LogSendErrors true Prefix "network." Postfix "-collectd" </Node> </Plugin> 

这会导致我用snmp插件收集的所有内容显示在Graphite Web界面的“network”文件夹下。 用不同的configs / init脚本运行多个collectds是解决这个问题的唯一方法吗?

它看起来像collectD哈希匹配可能是你在找什么:

https://collectd.org/wiki/index.php/Match:Hashed/Config

你显然没有多个石墨服务器,但它看起来像你可以使用模式匹配发送指标到不同的服务器,在你的情况下,将具有相同的“主机”值,但前缀值可能是不同的。

要使用“ 高级模式 ”来精确指定path,请将EscapeCharacter设置为"."

 <Plugin write_graphite> EscapeCharacter "." </Plugin> 

小心:当你这样做的时候,你正在有效地为主机上的所有东西写新的密钥。

要确保主机的密钥保持不变,请手动将主机名设置在/etc/collectd.conf的顶部

 Hostname "thishost_mydomain_net" 

然后你可以在/etc/collectd.d/snmp.conf (或者你存储它们的地方)中编辑所有的主机,把它们放到你想要的地方。

 <Host "network.switches.core-router"> Address "10.1.1.1" Version 2 Community "public" Collect "snmp_dataset1" </Host> <Host "network.switches.accounting"> Address "10.1.1.2" Version 2 Community "public" Collect "snmp_dataset2" </Host>