Hello Guillaume, Yes I can see this is one right now.
Process 'unicorn_master_myapp' status OK monitoring status Monitored monitoring mode active on reboot start pid 21645 parent pid 1 uid 1000 effective uid 1000 gid 1000 uptime 1d 2h 37m threads 2 children 3 cpu 0.0% cpu total 19.1% memory 1.1% [175.5 MB] memory total 52.5% [8.0 GB] security attribute unconfined disk read 0 B/s [1.4 MB total] disk write 0 B/s [1.1 GB total] data collected Thu, 26 Aug 2021 16:49:13 Process 'unicorn_myapp_worker0' status OK monitoring status Monitored monitoring mode active on reboot start pid 7017 parent pid 21645 uid 1000 effective uid 1000 gid 1000 uptime 17h 11m threads 3 children 0 cpu 0.6% cpu total 0.6% memory 2.2% [343.0 MB] memory total 2.2% [343.0 MB] security attribute unconfined disk write 0 B/s [15.8 MB total] data collected Thu, 26 Aug 2021 16:49:13 Process 'unicorn_myapp_worker1' status OK monitoring status Monitored monitoring mode active on reboot start pid 5580 parent pid 21645 uid 1000 effective uid 1000 gid 1000 uptime 1d 0h 26m threads 4 children 0 cpu 0.6% cpu total 0.6% memory 2.1% [331.7 MB] memory total 2.1% [331.7 MB] security attribute unconfined disk write 0 B/s [45.3 MB total] data collected Thu, 26 Aug 2021 16:49:13 Looking at logs now : Aug 27 15:27:02 ip-172-31-32-81 monit[10922]: 'unicorn_myapp_worker1' mem amount check succeeded [current mem amount = 190.7 MB] Aug 27 15:27:02 ip-172-31-32-81 monit[10922]: 'unicorn_myapp_worker1' mem amount check succeeded [current mem amount = 190.7 MB] Aug 27 15:36:32 ip-172-31-32-81 monit[10922]: 'unicorn_myapp_worker1' process is not running Aug 27 15:36:32 ip-172-31-32-81 monit[10922]: 'unicorn_myapp_worker1' trying to restart Aug 27 15:36:32 ip-172-31-32-81 monit[10922]: 'unicorn_myapp_worker1' process is not running Aug 27 15:36:32 ip-172-31-32-81 monit[10922]: 'unicorn_myapp_worker1' trying to restart Aug 27 15:36:54 ip-172-31-32-81 monit[10922]: 'unicorn_myapp_worker1' process is running with pid 32304 Aug 27 15:36:54 ip-172-31-32-81 monit[10922]: 'unicorn_myapp_worker1' process is running with pid 32304 Aug 27 17:10:21 ip-172-31-32-81 monit[10922]: 'unicorn_myapp_worker1' mem amount of 358.9 MB matches resource limit [mem amount > 350 MB] Aug 27 17:10:21 ip-172-31-32-81 monit[10922]: 'unicorn_myapp_worker1' exec: '/bin/bash -c /bin/kill -TERM `cat /var/run/service/unicorn_myapp_worker1.pid` && sleep 1' Aug 27 17:10:21 ip-172-31-32-81 monit[10922]: 'unicorn_myapp_worker1' mem amount of 358.9 MB matches resource limit [mem amount > 350 MB] Aug 27 17:10:21 ip-172-31-32-81 monit[10922]: 'unicorn_myapp_worker1' exec: '/bin/bash -c /bin/kill -TERM `cat /var/run/service/unicorn_myapp_worker1.pid` && sleep 1' Aug 27 17:10:51 ip-172-31-32-81 monit[10922]: 'unicorn_myapp_worker1' mem amount check succeeded [current mem amount = 184.5 MB] Aug 27 17:10:51 ip-172-31-32-81 monit[10922]: 'unicorn_myapp_worker1' mem amount check succeeded [current mem amount = 184.5 MB] It looks it is being killed right after matching the limit not respecting the 8 cycles. defined as individually below ``` check process unicorn_master_teachworks with pidfile /var/run/engineyard/unicorn_myapp.pid start program = "/bin/bash -c ‘/service/bin/app_myapp start'" as uid deploy and gid deploy stop program = "/bin/bash -c ‘/service/bin/app_myapp stop'" as uid deploy and gid deploy if mem > 350 MB for 2 cycles then restart —> Is this group directive overwriting the individual one below? if cpu > 100% for 2 cycles then restart group unicorn_myapp check process unicorn_myapp_worker1 with pidfile /var/run/service/unicorn_myapp_worker1.pid if mem > 350.0 MB for 8 cycles then exec "/bin/bash -c '/bin/kill -TERM `cat /var/run/service/unicorn_myapp_worker1.pid` && sleep 1'" group unicorn_myapp ``` Thank You, Carlos Cano > On 26 Aug 2021, at 07:27, Guillaume François <guillaume.francoi...@gmail.com> > wrote: > > Hello, > > According to your configuration, it should be 3 different Monit processes. > > Do you see 3 elements while issuing command "monit status" ? > > Also the log file should contain more details about what is detected and > which actions are performed from monit. > > Regards. > > Le jeu. 26 août 2021 à 02:48, <hc...@solucoes.net > <mailto:hc...@solucoes.net>> a écrit : > Hello, > > I am using Monit version 5.25.1 > > My config is: > > ``` > check process unicorn_master_myapp > with pidfile /var/run/services/unicorn_myapp.pid > start program = "/bin/bash -c '/services/bin/app_myapp start'" > as uid deploy and gid deploy > stop program = "/bin/bash -c '/services/bin/app_myapp stop'" > as uid deploy and gid deploy > if mem > 350 MB for 2 cycles then restart > if cpu > 100% for 2 cycles then restart > group unicorn_myapp > > check process unicorn_myapp_worker0 > with pidfile /var/run/services/unicorn_worker_myapp_0.pid > if mem > 350.0 MB for 8 cycles then exec "/bin/bash -c '/bin/kill -TERM > `cat /var/run/services/unicorn_worker_myapp_0.pid` && sleep 1'" > group unicorn_myapp > > check process unicorn_myapp_worker1 > with pidfile /var/run/services/unicorn_worker_myapp_1.pid > if mem > 350.0 MB for 8 cycles then exec "/bin/bash -c '/bin/kill -TERM > `cat /var/run/services/unicorn_worker_myapp_1.pid` && sleep 1'" > group unicorn_myapp > ``` > > > > Unicorn has a master process then each worker has another. > > In this case if the master process is above 350MB for 2 cycles it has to be > restarted. > > Now the workers has a limit of 8 cycles. > > My question is: > > I am seeing workers being killed after 2 cycles. > Is it intentional as the check on group unicorn_myapp is in some kind > overwriting the later ones? > > What I may be missing? > > > Thank You, > Carlos Cano > >