0

我正在运行 Debian 服务器。

我需要做的是运行 Cron 作业(每小时或每天)以确定服务器中运行的进程的 ram 使用情况。

但是,这个想法是将输出传递给一些条件运算符(bash?),所以如果并且仅当某个进程或总运行进程超过定义的限制时,然后通过电子邮件向我发送警报和报告。

怎么可能做到这一点?

4

2 回答 2

1

您是否考虑过使用 snmp (cacti) 和 nagios 之类的工具?对我来说,这似乎比尝试开发自己的特定事物更好。

于 2010-12-11T23:52:21.087 回答
0

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

于 2010-12-12T00:12:32.183 回答