[collectd] how does a plugin keep track of multiple configurations?

German Gutierrez german.gutierrez at gmail.com
Sat Jan 17 20:10:53 CET 2015


I wrote a python plugin that can take multiple configs, take it as an
example:
https://github.com/GermanG/collectd_py_plugins/blob/master/memory_usage_collectd.py

In short, I needed to store them in an array to retrieve them when being
called.

Hope it helps.

Regards
 On Jan 17, 2015 2:46 PM, "Andreas Schuldei" <andreas at schuldei.org> wrote:

> Hi!
>
> i have this kind of config section, because i have two (and perhaps later
> on even more) devices to monitor:
>
>           LoadPlugin "OneWireCtlr"
>            <Plugin onewirectlr>
>               host "192.168.2.223"
>                 <1DA7F30D0000006F>
>                    type "counter"
>                    name "Solarthermie"
>                 </1DA7F30D0000006F>
>            </Plugin>
>            <Plugin onewirectlr>
>               host "192.168.2.222"
>                 <1DA7F30D0000006A>
>                    type "counter"
>                    name "Ofen"
>                 </1DA7F30D0000006A>
>            </Plugin>
>
> Now i see that the config callback of my plugin is called twice, once with
> each set of config parameters.
> From then on the plugin's read callback is called in every 10s (which is
> also the "Interval" setting in the config file), but not twice per
> interval, but only once.
>
> Is there a way i can get collectd to maintain two, or, more precise: as
> many contents of my plugin as there are config sections for it? Or should
> the config callback take care to create multiple instances of its own and
> then run the read code once for each instance?
>
> what is an example plugin to do this kind of multiplexing, so i can
> educate myself from it?
>
> /andreas
>
> _______________________________________________
> collectd mailing list
> collectd at verplant.org
> http://mailman.verplant.org/listinfo/collectd
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.verplant.org/pipermail/collectd/attachments/20150117/da7c928b/attachment.html>


More information about the collectd mailing list