I'm running sidekiq
on OSX 10.10.4, using monit
, with the goal of restarting the process when total memory balloons over a certain level. However, monit
thinks that the monitored sidekiq
process does not consume any memory. monit
instead sees all memory usage as system usage.
Here is the output of monit status
, while sidekiq
is running (started with 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
What do I need to do to get monit
to recognize that the sidekiq
process is the one consuming the memory?
For context, I have pasted my .monitrc
and associated scripts below.
### .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`