[collectd] improve Processes plugin

Florian Forster octo at collectd.org
Sun Sep 4 18:13:00 CEST 2011

Hi Lukas,

On Sun, Sep 04, 2011 at 09:29:31AM +0200, Lukas Bednar wrote:
> But there is problem that these specific processes execute another
> processes (children) which generate considerable load. These
> child-processes isn't counted to statistic data of specific process.

as far as I know, there is no such functionality yet in collectd.

> So we would like improve this plugin with ProcessTree and
> ProcessMatchTree option.

IIrc, there's a place in the processes plugin doing basically:

  for pid
    for configured_process
      if pid matches configured_process
        do_acounting (pid, configured_process)

I think rather than building a real process tree, I'd do something like

  for pid
    for configured_process
      cur_pid = pid
      while cur_pid != ppid(cur_pid)
        if cur_pid matches configured_process
          do_acounting (pid, configured_process)
          cur_pid = ppid(cur_pid)

Since normal "options" are just blocks without any children in
collectd's config, I'd propose to use the following alternative config

  <Plugin processes>
    <Process "my_parent">
      AccountChildren true|false|<num>


 * true:  Account all children (in code: check PPID until we reach init)
 * false: Don't account any children (in code: never check PPID; default
          to preserve backwards compatibility)
 * <num>: Account <num> levels of children. "true" would be the same as
          infinity / 65536, "false" would be the same as 0.

Best regards,
Florian octo Forster
Hacker in training
GnuPG: 0x0C705A15
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://mailman.verplant.org/pipermail/collectd/attachments/20110904/812b62bd/attachment.pgp>

More information about the collectd mailing list