[collectd] Monitor CPU usage for a specific process

Zhou, Zhenyu zzyzzy at pku.org.cn
Sun Aug 23 15:23:15 CEST 2015


I see! Thank you so much for your help!

At2015-08-23 17:34:32,Zhou, Zhenyu<zzyzzy at pku.org.cn>wrote:
> On Sat, 22 Aug 2015 21:36:48 "Zhou, Zhenyu" wrote:
> > Thanks a lot! I'm trying to figure out how to set CGroup now - don't
> > know it before.
> > 
> > One more question, I just find /proc/[PID]/stat also contains such
> > information:
> > processCPUTime = utime + stime + cutime + cstime
> > 
> > I'm wondering whether there are any significant differences from
> > reading /proc directly and the way Collectd used?
> 
> Collectd is reading from /proc files. So if the processes plugin does
> monitor the appropriate stats, then it is reading exactly those files.
> 
> In the case of cgroups, the files being read are located on the cgroups
> filesystem (usually somewhere below /sys/fs/cgroup/).
> 
> 
> So collectd is just automating the data collection for you. Have a look
> at the sources to determine where the individual data points are
> obtained from.
> Local kernel-originated stats are mostly read from /proc, /sys or over
> netlink.
> 
> Bruno
> 
> > Thank you!
> > 
> > Zhenyu
> > 
> > At2015-08-22 20:32:29,Zhou, Zhenyu<zzyzzy at pku.org.cn>wrote:
> > > Hello,
> > > 
> > > On Sat, 22 Aug 2015 20:10:25 "Zhou, Zhenyu" wrote:
> > > > I'm new to Collectd and would like to use it to measure CPU utilization.
> > > > However, after starting the daemon and collecting results, I do not
> > > > find CPU utilization for a single process among the .rrd files. I only
> > > > find the data for overall system.
> > > > 
> > > > Does anyone have idea how to measure it for one process (according to
> > > > its PID)? Or does Collectd support such functionality?
> > > 
> > > The CPU plugin can only monitor per-CPU usage (and eventually a system
> > > average).
> > > 
> > > To monitor per-process usage you might be able to use process plugin
> > > (not sure) or cgroups (place the process you want to monitor in its own
> > > cgroup for CPU accounting and use cgroup plugin).
> > > 
> > > Bruno
> > 
> 



More information about the collectd mailing list