[collectd] processes plugin

Florian Forster octo at verplant.org
Mon May 5 11:17:01 CEST 2008

On Sat, May 03, 2008 at 10:49:14PM +0400, Oleg King wrote:
> I writing now patch for processes plugin.
> I have some question to you how to do it better.
> 1. I added libkvm support to processes, so it can be run on FreeBSD.
> While iterating on processes I assign num_proc=1, num_lwp = number of
> threads, so typical values are: num_proc=1, num_lwp=1. Am I right?

Many programs are single-threaded, i. e. they have only one thread per
process. Multi-threaded programs, such as collectd itself, have more
than one thread per process, so example values could be:

> 2. I added regexp support, so I can now set second (optional) part of
> 'Process' key in config file. If 'Procerss' key consists of two
> parts, second is used as regexp in ps_list_search.
> It is cool to be able to use settings like this:
> Process "httpd"
> Process "bind"
> Process "render-daemon" "perl(.*)di2-client.pl"
> Process "total" "(.*)"

That's a very good idea. :) However, I don't like it when configuration
options behave different depending on the number of arguments they get.
Ideally the configuration would look something like that:
  <Plugin "processes">
    <Group "render-daemon">
      Match "perl(.*)di2-client.pl"

I know the configuration handling can be tricky, so if you want I can do
that for you..

> a) (optional) support for reporting not only names of processes like
> 'perl', but entire command line ('/usr/bin/perl /text/myscript.pl').
> I have done this in kvm, but do not know how to implement this in

Hm, I'll look into this..

> do you consider it useful?

Yes, definitely :)

On Sun, May 04, 2008 at 09:52:59AM +0400, Oleg King wrote:
> One more question. KVM can get only or CPU percent (which requires
> adding new GAUGE instead of CPU jiffies), or CPU time on process
> (in milliseconds). Now I'm collecting milliseconds and store it into
> Jiffies. What have I do to do it right? :)

All you should have to do is set the `cpu_user_counter' and
`cpu_system_counter' members of the `procstat_entry_t' to the number of
milliseconds the process has spent in user- or system-space and call
`ps_list_add'. So if you're asking whether to use percents or
milliseconds, please use milliseconds.

Does that answer your question?

Florian octo Forster
Hacker in training
GnuPG: 0x91523C3D
-------------- 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/20080505/7c5a4df5/attachment.pgp 

More information about the collectd mailing list