【问题标题】:monit: failed to restartmonit: 重启失败
【发布时间】:2015-06-18 14:01:11
【问题描述】:

我正在使用monit for sidekiq

当我运行监控日志文件时,它显示错误。

[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/*

【问题讨论】:

  • 尝试将其中一个端口set httpd port 2812 更改为其他端口。
  • 你试过手动启动side_kiq吗?
  • @zmii :手动尝试它正在工作。但是在使用 moint 时不起作用。
  • 在 [xx.xxx.xx.xx:2815] [EDT Jun 18 10:05:55] 处使用 http 接口启动 monit 守护进程信息:在 [xx.xx.xx. xx:2815] [EDT Jun 18 10:05:55] 信息:监控 HTTP 服务器已启动 [EDT Jun 18 10:05:55] 信息:'trrm_server' 监控已启动 [EDT Jun 18 10:05:55] 错误:' sidekiq_site' 进程未运行 [EDT Jun 18 10:05:55] 信息:'sidekiq_site' 试图重新启动 [EDT Jun 18 10:05:55] 信息:'sidekiq_site' 开始:/bin/bash
  • 检查我的问题和我的answer 以了解此问题。希望有帮助

标签: ruby-on-rails ruby ruby-on-rails-4 monit


【解决方案1】:

在 monit 中运行启动/停止事件时,没有设置路径变量,因此所有程序都必须具有绝对路径,即使是您对 bash 的调用。

Monit 没有使用环境变量

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-03
    • 2016-07-07
    • 2017-05-16
    • 1970-01-01
    • 1970-01-01
    • 2022-11-30
    相关资源
    最近更新 更多