[collectd] improve Processes plugin

Paul Colomiets paul at colomiets.name
Sun Sep 4 21:39:45 CEST 2011


Hi Florian,

On Sun, Sep 4, 2011 at 7:18 PM, Florian Forster <octo at collectd.org> wrote:
> Hi Paul,
>
> On Sun, Sep 04, 2011 at 01:19:16PM +0300, Paul Colomiets wrote:
>> But I would like to propose another way to solve the problem. I'd like
>> processes to be matched by environment.
>
> I'm not sure this is solving the same problem. I don't think the PPID is
> necessarily present in the environment

It isn't. What I propose is to group processes by some environment
variable, which usually have the same value in every child. This
is easier, because you don't need to build hierarchy by ppid.
Depending on the task it can also be more precise in the case
original process crashed, but child is still working for a long time.

> and even if it were you'd need to
> reconfigure and restart collectd everytime the process whose children
> you're trying to watch restarts.

Not sure what you mean. As far as I can see collectd is scanning all
the pids every time anyway. So it's easy to catch up new process
having some environment variable set. You potentially can even
add a new process group to monitor by just spawning a process
with appropriate environment set.

> As an alternative, you'd need special
> logic in the processes plugin, so we don't gain simplicity from it.
>
>> Also I find it easier to implement than subtree search.
>
> That's possibly true for Linux, but on many systems the processes plugin
> supports I'd guess it is way easier to get the PPID than the
> environment, given that general information about the process is already
> available in the plugin.

Sorry, I've forgot about compatibility, so maybe you are right.

So does.collectd has a solution to differentiate between several processes
with the same binary? It's crucial for few my projects which has a bunch
of redis and a bunch of python processes which are needed to be monitored
separately. Solution I'm thinking of so far is sym/hard-linking binaries,
which isn't very pretty.

-- 
Paul



More information about the collectd mailing list