2

I'm using collectd with the snmp and write_graphite plugins. I want certain metrics to go to Graphite with prefix A, and others to go with prefix B, to keep the data in Graphite/Whisper organized.

For example, I would like to divide things up like this:

network.switches.xxxx power.pdu.xxxxxx

My write_graphite config looks like this:

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

This causes everything I gather with the snmp plugin show up under the "network" folder in the Graphite web interface. Is running multiple collectds with different configs/init scripts the only way to solve this?

digdoug
  • 21
  • 1
  • 2

2 Answers2

0

It looks like the collectD Hashed Match might be what you are looking for:

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

You obviously don't have multiple graphite servers, but it looks like you can use pattern matching to send metrics to the different servers, which in your case would have the same "host" value but the prefix value could be different.

Iain
  • 46
  • 3
  • Match:Hashed is close, but it's for load balancing. If you were going to use a Match plugin, you should use `Match:RegEx`, but I still think that's the longer way around. See my `EscapeCharacter` work-around. – jnovack Sep 03 '14 at 21:13
0

To use "advanced mode" where you specify your path exactly, set the EscapeCharacter to ".".

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

CAUTION: When you do this, you are effectively writing new keys for everything on that host.

To make sure the host's keys stay the same, manually set the hostname at the top of /etc/collectd.conf

Hostname    "thishost_mydomain_net"

Then you can edit all your hosts within /etc/collectd.d/snmp.conf (or wherever you store them) to put them down the tree exactly where you want them.

<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>
jnovack
  • 126
  • 3