Linux track cpu usage per user

Quick info how to setup everything so you’ll be able to check the cpu user per each user.
As a note I have the PHP set up in fcgid mode and also suexec so each php process is running under the proper username.

The solution I found is to install munin – this can be installed from 1. shell 2. whm

1. from shell it’s as simple as:
1.a. sudo yum -y install munin
1.b. sudo yum -y install munin-node

if you run into dependencies problem make sure to check what you have in the global exclude list (I had ruby and perl packages excluded). Also set up the proper repositories:

sudo vi /etc/yum.repos.d/dag.repo

and inside the file place:

[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
gpgkey=http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
enabled=1
sudo  vi /etc/yum.repos.d/rubyworks.repo

and inside the file place:

# Link file for RubyWorks yum repository
# Place this file in /etc/yum.repos.d

[rubyworks]
name=RubyWorks
baseurl=http://rubyworks.rubyforge.org/redhat/$releasever/RPMS/$basearch
enabled=1
gpgcheck=1
gpgkey=http://rubyworks.rubyforge.org/RubyWorks.GPG.key
priority=1

2. if you have cpanel installed, from whm is a lot simpler:
2.a go to plugins and install munin from there
2.b go to whm home->plugins->Munin Service Monitor and there you have all the graphs

Latest steps is to install this plugin: http://exchange.munin-monitoring.org/plugins/cpubyuser/details
and restart the munin-node:

sudo /etc/init.d/munin-node restart