[collectd] Using Chains in .conf file snippets

Tobias Wolf towolf at gmail.com
Tue Oct 31 15:50:24 CET 2017


I just realized that I was badly mistaken that my above "concatenate
parts of a chain" methods works. It doesn't.

So now I'm trying to insert more chains using "jump" into the
PostCacheChain with my basic settings. But again, I am forced to
modify the main file to include further chains with "jump". If the
chain the "jump" references, does not  exist, then collectd spams
errors.

I would like to be able to just drop additional config snippets to add
to the config, without modifying other config snippet files. This
works just fine for plugins, but not for chains.

--- 60-basic_chain.conf:

<Chain "PostCache">

# default rule for basic metrics

  <Rule "route_metrics">
    <Match "regex">
      Plugin "^apache|cgroups|cpu|df|disk|entropy|interface|load|memory|nginx|processes|protocols|swap|tcpconns|uptime$"
    </Match>
    <Target "write">
      Plugin "write_graphite/techops"
    </Target>
  </Rule>

  <Target "jump">
    Chain "include_me"
  </Target>

</Chain>

--- 61-additional-chain.conf

# additional routing of one plugin to another write destination

<Chain "include_me">
  <Rule "route_metrics">
    <Match "regex">
      Plugin "^ceph$"
    </Match>
    <Target "write">
      Plugin "write_graphite/sysadmtest"
    </Target>
  </Rule>
</Chain>


So i can only include the jump target "include_me"  if the chain
exists, but I don't know that in advance. And I don't have one central
place where collectd config is generated. The basic config is unified
and additional stuff is dropped in.



On Sun, Oct 29, 2017 at 4:37 PM, Tobias Wolf <towolf at gmail.com> wrote:
> Salvete,
>
> I tried to grok the Chains feature and how to handle varying configs across
> server types.
>
> I want to send the set of basic metrics to one server, but then I may want
> to enable some special metrics like "ceph" and send them to another server.
>
> Since, e.g., ceph.so sends a giant boatload of metrics I want to channel
> them to a specific destination first and then later filter them, when I
> found out what metrics to keep.
>
> But for my config management it is easiest if I can drop in .d snippets.
>
> However from figured, I can only configure the PostCache chain once.
> Multiple definitions did not work, I think.
>
> So I tried this approach, and it *seems* to work, but I still get weird
> parse errors during startup:
>
> # head -n 50 /etc/collectd/collectd.conf.d/6* | grep -v "#"
> ==> /etc/collectd/collectd.conf.d/60-postcache-chain-head.conf <==
>
> LoadPlugin match_regex
>
> PostCacheChain "PostCache"
>
>
> <Chain "PostCache">
>
> ==> /etc/collectd/collectd.conf.d/61-postcache-chain-default.conf <==
>
>
>   <Rule "route_metrics">
>     <Match "regex">
>       Plugin
> "^apache|cgroups|cpu|df|disk|entropy|interface|load|memory|nginx|processes|protocols|swap|tcpconns|uptime$"
>     </Match>
>     <Target "write">
>       Plugin "write_graphite/techops"
>     </Target>
>   </Rule>
>
>
> ==> /etc/collectd/collectd.conf.d/62-postcache-chain-ceph.conf <==
>   <Rule "route_metrics">
>     <Match "regex">
>       Plugin "^ceph$"
>     </Match>
>     <Target "write">
>       Plugin "write_graphite/sysadmtest"
>     </Target>
>   </Rule>
>
> ==> /etc/collectd/collectd.conf.d/69-postcache-chain-tail.conf <==
>
> </Chain>
>
>
> And here are the relevant lines after startup. What do they mean, and why do
> they occur multiple times?
>
> Does each snippet have to be valid in itself? Or do they get concatenated
> and then parsed?
>
>
> Okt 29 16:33:18 server systemd[1]: Stopped Statistics collection and
> monitoring daemon.
> Okt 29 16:33:18 server systemd[1]: Starting Statistics collection and
> monitoring daemon...
> Okt 29 16:33:18 server collectd[483069]: Parse error in file
> `/etc/collectd/collectd.conf.d/60-postcache-chain-head.conf', line 240 near
> `': syntax error, unexpected $end, expecting UNQUOTED_STRING or OPENBRAC or
> EOL
> Okt 29 16:33:18 server collectd[483069]: yyparse returned error #1
> Okt 29 16:33:18 server collectd[483069]: configfile: Cannot read file
> `/etc/collectd/collectd.conf.d/60-postcache-chain-head.conf'.
> Okt 29 16:33:18 server collectd[483069]: Parse error in file
> `/etc/collectd/collectd.conf.d/69-postcache-chain-tail.conf', line 268 near
> `/': syntax error, unexpected SLASH, expecting UNQUOTED_STRING
> Okt 29 16:33:18 server collectd[483069]: yyparse returned error #1
> Okt 29 16:33:18 server collectd[483069]: configfile: Cannot read file
> `/etc/collectd/collectd.conf.d/69-postcache-chain-tail.conf'.
> Okt 29 16:33:18 server collectd[483069]: Created new plugin context.
> Okt 29 16:33:18 server collectd[483074]: Parse error in file
> `/etc/collectd/collectd.conf.d/60-postcache-chain-head.conf', line 240 near
> `': syntax error, unexpected $end, expecting UNQUOTED_STRING or OPENBRAC or
> EOL
> Okt 29 16:33:18 server collectd[483074]: yyparse returned error #1
> Okt 29 16:33:18 server collectd[483074]: configfile: Cannot read file
> `/etc/collectd/collectd.conf.d/60-postcache-chain-head.conf'.
> Okt 29 16:33:18 server collectd[483074]: Parse error in file
> `/etc/collectd/collectd.conf.d/69-postcache-chain-tail.conf', line 268 near
> `/': syntax error, unexpected SLASH, expecting UNQUOTED_STRING
> Okt 29 16:33:18 server collectd[483074]: yyparse returned error #1
> Okt 29 16:33:18 server collectd[483074]: configfile: Cannot read file
> `/etc/collectd/collectd.conf.d/69-postcache-chain-tail.conf'.
> Okt 29 16:33:18 server collectd[483074]: Created new plugin context.
> Okt 29 16:33:18 server systemd[1]: Started Statistics collection and
> monitoring daemon.
> Okt 29 16:33:18 server collectd[483074]: Systemd detected, trying to signal
> readyness.
>



More information about the collectd mailing list