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.
Asked
Active
Viewed 715 times
1
-
What monitoring system are you using? – Sven May 04 '11 at 08:26
-
I am using zabbix. – Eric L. May 04 '11 at 08:42
3 Answers
1
-
-
3Monit solve it easily : http://mmonit.com/monit/documentation/monit.html#resource_testing 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/tomcat6.pid 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/jvm_mon.sh" – Ruslan May 04 '11 at 10:00
-
-
+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
1
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.
E.g.:
"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

Henk
- 1,331
- 11
- 24
1
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.

Bart De Vos
- 17,911
- 6
- 63
- 82
-
is that the RAM used currently or the RAM that has been used while the process has been runnning? Thanks! – Eric L. May 04 '11 at 11:15
-