Linux – How to get the CPU usage for a given process out of collectd

collectdcpu-usagegraphitelinux

I'm running multiple ubuntu (precise) boxes & I've got collectd pushing data up to a central logstash box, which is then sending it to carbon (graphite).

I'm running the processes plugin for collectd, which gives CPU time with a 10 second interval. What I want to be able to chart in graphite is the cpu usage (either in jiffies or preferably in a percentage, but I realise that can be problematic) for each process.

I'm just not grokking how to take the process CPU time metric which is a ever-increasing counter of the cpu time used by the process and turn that into a gauge of how much cpu the process is using over time.

Can I do this, and if so, how?

Best Answer

I'm pretty sure the value you're referring to is a multiple of jiffies. I remember you have to divide it by a power of 10, then you can simply convert it to a percentage by converting it to a rate (e.g. by plotting its derivative in graphite)

Related Topic