Question

I'm a running a Debian server.

What I need to do is to run a Cron Job (Hourly or Daily) to determine the ram usage of the process running in the server.

But, the idea is to pass the output to some conditional operators (bash?) so IF and only IF some process or the total running process exceeds a defined limit, then email me with an alert and a report.

How could this be done?

Was it helpful?

Solution

have you considered using tools like snmp (cacti) and nagios maybe? It seems a better idea to me than trying to develop your own specific thing.

OTHER TIPS

Use:

ps -o vsize -p <your process pid>

To have only the virtual size printed:

ps -o vsize -p <your process pid> | tail -n 1 |awk '{print $1;}'

Substitute vsize with rss to have the resident memory used by the process

One suggestion, use monit Monit. Very flexible

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top