我在OSX 10.10.4上使用monit
运行monit
,目标是在总内存超过某个级别时重新启动进程。但是,sidekiq
认为受监视的monit
进程不消耗任何内存。 monit status
将所有内存使用情况视为系统使用情况。
以下是sidekiq
的输出,而monit start all
正在运行(以Process 'sidekiq'
status Running
monitoring status Monitored
pid 414
parent pid 1
uid 501
effective uid 501
gid 20
uptime 0m
children 1
memory 0 B
memory total 0 B
memory percent 0.0%
memory percent total 0.0%
cpu percent 0.0%
cpu percent total 0.0%
data collected Wed, 05 Aug 2015 09:57:21
System 'me-macbook-pro.local'
status Running
monitoring status Monitored
load average [1.82] [1.31] [0.59]
cpu 11.3%us 4.6%sy
memory usage 2.3 GB [56.2%]
swap usage 0 B [0.0%]
data collected Wed, 05 Aug 2015 09:57:21
开头:
monit
我需要做些什么才能让sidekiq
认识到.monitrc
进程是消耗内存的进程?
对于上下文,我已粘贴下面的### .monitrc
set daemon 20
set httpd port 2812
allow me:password_censored
check process sidekiq with pidfile /Users/me/app/tmp/pids/sidekiq.pid
start program = "/bin/bash /Users/me/app/start_sidekiq.sh" with timeout 20 seconds
stop program = "/bin/bash /Users/me/app/stop_sidekiq.sh" with timeout 20 seconds
if totalmem is greater than 150 MB for 2 cycles then restart
及相关脚本。
### start_sidekiq.sh
#!/bin/sh
cd /Users/me/app
bundle exec sidekiq -C /Users/me/app/config/sidekiq.yml \
-P /Users/me/app/tmp/pids/sidekiq.pid \
-L /Users/me/app/log/sidekiq.log \
-d
### stop_sidekiq.sh
#!/bin/sh
kill -TERM `cat /Users/me/app/tmp/pids/sidekiq.pid`
{{1}}