Server Fault is a question and answer site for system and network administrators. 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 have a Debian server where some processes going rogue from time to time and start consuming too much memory. How I could monitor this at process level so I can set an alarm? Currently I monitor when the server starts using too much memory but I would like to monitor the process individually.

share|improve this question
What monitoring system are you using? – Sven May 4 '11 at 8:26
I am using zabbix. – Eric L. May 4 '11 at 8:42
up vote 1 down vote accepted

This is how I monitor the total RAM used by apache:

ps -e -orss=,args= | awk '/apache/{ SUM += $1} END { print SUM }'

Just change apache to your process.

share|improve this answer
is that the RAM used currently or the RAM that has been used while the process has been runnning? Thanks! – Eric L. May 4 '11 at 11:15
Currently used. – Bart De Vos May 4 '11 at 12:13

You could try using monit

share|improve this answer
I do not see how monit solves my problem. – Eric L. May 4 '11 at 8:47
Monit solve it easily : Here example how I monitor memory of my tomcat processes and if something get wrong send an alarm and run set of scripts that take number of snapshot of running services before restart service: check process tomcat6 with pidfile /var/run/ if cpu > 80% for 5 cycles then alert if totalmem > 7 GB for 2 cycles then alert else if succeeded for 5 cycles then alert if totalmem > 7 GB for 2 cycles then exec "/usr/local/bin/asset4/" – Ruslan May 4 '11 at 10:00
Thanks! I did not know it and it looks interesting. – Eric L. May 4 '11 at 11:16
+1 for monit. As Ruslan explained, it can not only alert on the failure mode, but it can be given instructions on how to remedy the problem (which is normally a case of restarting the service) – Daniel Lawson May 29 '11 at 23:32

Use Nagios and it's "check_procs" plugin with the RSS-metric parameter:

 -r, --rss=RSS
  Only scan for processes with RSS higher than indicated.


"check_procs -w 1500000 -c 2000000 --metric=RSS"

Alter w & c to fit your warning- and critical-levels for the misbehaving process.

To see the current RSS use this one-liner and check the proc its RSS in the third column:

ps -eo pid,ppid,rss,size,vsize,sz,pmem,comm
share|improve this answer

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.