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?
There is a template that allows you to use snmp to monitor using proc cacti is able to pipe it out as a graph..
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.
There are 3 things you can track to help highlight memory issues.
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
Overall memory usage values from
There is a bunch of information you can extrapolate from the values in
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.