Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using Cacti in Centos 6.3 and I would like to get the list of the top 10 memory consuming processes, with a memory graph, so that if server fails I can easily find the processes behind that.

It is possible with a plugin or template?

share|improve this question

First, This data is hard to represent in an RRD database. Because your 10 PID's/processes will change but RRD data sources are static. You could just log 1-10 but then you can't get any more information. You could get around this by mapping a name/pid to a datasource, but then you need to come up with all the required names in advance, which is not easy. Alternatively you could create 65536 data sources for each pid, but then graphing is a bit tricky.

Might be time to try something a bit more extensible like OpenTSDB

Second, monitoring actual memory usage in Linux is not easy. ps lies. Linux makes use of shared memory and doesn't provide a simple interface to query that information on a per process level. There are also kernel memory and caches that can impact memory performance on a machine.

There are 3 things you can track to help highlight memory issues.

  • Per executable shared and private memory
  • Per process private memory
  • Kernel Memory

Per executable shared and private memory

This ps_mem.py script, which is the best "off the shelf" estimate I've found.

Note "these values are per program, not per process", which is a by product of the way shared memory works and the accounting done in the kernel.

Private memory, per process

You can get the private memory per process from /proc/[0-9]*/smaps by tallying all the values of Private_Dirty and Private_Clean per file. Process names you can get from /proc/[0-9]*/status or /proc/[0-9]*/stat


Overall memory usage values from /proc/meminfo


There is a bunch of information you can extrapolate from the values in /proc/meminfo which are probably better things to graph than all those data points individually.

From those three you should be able to have a good idea of where most memory issues have originated from.

After all this I've still found there is still a 'hole' in what linux accounts as allocated memory. This hole appears to be the virtual->physical memory map as the hole get's bigger the more memory a machine has.

share|improve this answer

There is a template that allows you to use snmp to monitor using proc cacti is able to pipe it out as a graph..


share|improve this answer
Thanks a lot ............. – K.K Patel Dec 18 '12 at 9:44
This template is not working well. – K.K Patel Dec 21 '12 at 6:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.