[collectd] collectd chains

Florian Forster octo at verplant.org
Sat Sep 19 08:39:46 CEST 2009


Hi,

On Fri, Sep 18, 2009 at 11:07:44AM +0200, lftgl table wrote:
> <Chain "TestPreCache">
>     <Rule "testrule1">
>         <Match "regex">
>             Host "^bm-64-21.server.live$"
>             Plugin "^cpu$"
>             PluginInstance "^0$"
>             Type "^cpu$"
>             TypeInstance "idle$"
>         </Match>
>         <Target "set">
>             Host "prechache.server.live"
>         </Target>
>     </Rule>
> </Chain>
> 
> i would expect just one file in the folder
> "/opt/collectd/var/lib/collectd/rrd/prechache.server.live"
> prechache.server.live/cpu-0/cpu-idle.rrd ,
> but there are lots of files and the daemon still collects values for
> bm-64-21.server.live/cpu-0/cpu-idle.rrd

If you expect only one value (cpu-0/cpu-idle), you have to manually
discard all other values. You can discard values with the “stop” target
and quit the chain successfully (without discarding the value) with the
“return” target.

So the chain could read like this:

-- 8< --
 <Chain "TestPreCache">
     <Rule "testrule1">
         <Match "regex">
             Host "^bm-64-21.server.live$"
             Plugin "^cpu$"
             PluginInstance "^0$"
             Type "^cpu$"
             TypeInstance "idle$"
         </Match>
         <Target "set">
             Host "prechache.server.live"
         </Target>
+        # Exit the chain but keep handling this value
+        Target return
     </Rule>
+    # Default action (values not matched above): discard
+    Target stop
 </Chain>
-- >8 --

> ls -1d  /opt/collectd/var/lib/collectd/rrd/prechache.server.live/*
> /opt/collectd/var/lib/collectd/rrd/prechache.server.live/cpu-0
> /opt/collectd/var/lib/collectd/rrd/prechache.server.live/cpu-1
> /opt/collectd/var/lib/collectd/rrd/prechache.server.live/cpu-2
> /opt/collectd/var/lib/collectd/rrd/prechache.server.live/cpu-3
> /opt/collectd/var/lib/collectd/rrd/prechache.server.live/cpu-4
> .. and many more plugins, but not the complete list like in
> /opt/collectd/var/lib/collectd/rrd/bm-64-21.server.live/

Did you check the timestamp on them? collectd never deletes these files,
so they may be left over from a previous attempt. Anyway, with the above
config the hostname of cpu 1, 2, 3, and 4 is definitely not changed to
“prechache.server.live”.

> when i try to use PostChacheChains, the collectd cannot establish a
> connection to the rrdcached
> 
> logfile: read-function of plugin `rrdcached' failed. Will suspend it for 80
> seconds.

Uhm, this can't possibly be related. Can you reproduce that? Maybe use a
tool such as tcpdump or wireshark to capture some traffic between
collectd and rrdcached.

Regards,
—octo
-- 
Florian octo Forster
Hacker in training
GnuPG: 0x91523C3D
http://verplant.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20090919/e01f00c0/attachment.pgp 


More information about the collectd mailing list