0

I am using monit for sidekiq

while I am running the monit log file, it is showing the error.

[EDT Jun 18 09:50:11] error    : 'sidekiq_site' process is not running
[EDT Jun 18 09:50:11] info     : 'sidekiq_site' trying to restart
[EDT Jun 18 09:50:11] info     : 'sidekiq_site' start: /bin/bash
[EDT Jun 18 09:51:41] error    : 'sidekiq_site' failed to start

/etc/monit/conf.d/sidekiq.conf

check process sidekiq_site
  with pidfile /var/www/project/shared/pids/sidekiq.pid
  start program = "bash -c 'cd /var/www/project/current ; RAILS_ENV=production bundle exec sidekiq --index 0 --pidfile /var/www/project/shared/pids/sidekiq.pid --environment production --logfile /var/www/project/shared/log/sidekiq.log --daemon'" as uid root and gid root with timeout 90 seconds
  stop program = "bash -c 'if [ -d /var/www/project/current ] && [ -f /var/www/project/shared/pids/sidekiq.pid ] && kill -0 `cat /var/www/project/shared/pids/sidekiq.pid`> /dev/null 2>&1; then cd /var/www/project/current && bundle exec sidekiqctl stop /var/www/project/shared/pids/sidekiq.pid 1 ; else echo 'Sidekiq is not running'; fi'" as uid root and gid root
  if totalmem is greater than 200 MB for 2 cycles then restart # eating up memory?
  group site_sidekiq

/etc/monit/monitrc

set daemon 30

set logfile /var/log/monit.log
set idfile /var/lib/monit/id
set statefile /var/lib/monit/state

set eventqueue
    basedir /var/lib/monit/events
    slots 100



set httpd port 2812
   allow admin:""
set httpd port 2812 and
    use address xx.xxx.xx.xx
    allow xx.xx.xx.xx

check system trrm_server
  if loadavg(5min) > 2 for 2 cycles then alert
  if memory > 75% for 2 cycles then alert
  if cpu(user) > 75% for 2 cycles then alert

include /etc/monit/conf.d/*
Debadatt
  • 5,935
  • 4
  • 27
  • 40
  • Try changing one of the ports `set httpd port 2812` to something else. – zmii Jun 18 '15 at 14:04
  • Have you tried to launch side_kiq manually? – zmii Jun 18 '15 at 14:04
  • @zmii : trying manually it is working. But while using moint is not working. – Debadatt Jun 18 '15 at 14:07
  • Starting monit daemon with http interface at [xx.xxx.xx.xx:2815] [EDT Jun 18 10:05:55] info : Starting monit HTTP server at [xx.xx.xx.xx:2815] [EDT Jun 18 10:05:55] info : monit HTTP server started [EDT Jun 18 10:05:55] info : 'trrm_server' Monit started [EDT Jun 18 10:05:55] error : 'sidekiq_site' process is not running [EDT Jun 18 10:05:55] info : 'sidekiq_site' trying to restart [EDT Jun 18 10:05:55] info : 'sidekiq_site' start: /bin/bash – Debadatt Jun 18 '15 at 14:08
  • Check my question and my [answer](https://stackoverflow.com/q/51825517/7266232) for this issue. hope it helps – Viktova Aug 14 '18 at 10:53

1 Answers1

0

When running a start/stop event in monit there is no path variable set, therefore all programs must have absolute paths, even your call to bash.

No environment variables are used by Monit

T'Saavik
  • 175
  • 1
  • 5