我正在使用眼睛宝石来监视我的 rails 应用程序中的 sidekiq 后台进程,但我没有收到通知邮件。我知道很可能是我的配置语法本身是错误的,但我无法在任何地方找到完整的文档或教程。
眼睛监控良好,当我杀死 sidekiq 进程时,它确实重新启动了 sidekiq,但它没有发送电子邮件通知。
Eye.config do
logger "/tmp/eye.log"
mail domain: 'smtp@gmail.com', host: 'smtp@gmail.com', port: 587, from_mail: "umeshmalhotra1995@gmail.com", password: "xxxxxx", from_name: "Umesh"
contact :dev, :mail, "umeshmahotra1995@gmail.com"
logger_level Logger::DEBUG
end
def sidekiq_process(proxy, name)
rails_env = proxy.env['RAILS_ENV']
proxy.process(name) do
start_command "bundle exec sidekiq -e development"
pid_file "/home/dms_master/dms_webapp/tmp/pids/sidekiq_development.pid"
stdall "/home/dms_master/dms_webapp/log/sidekiqdevelopment.log"
daemonize true
stop_signals [:USR1, 0, :TERM, 10.seconds, :KILL]
check :cpu, every: 30, below: 100, times: 5
check :memory, every: 30, below: 300.megabytes, times: 5
end
end
Eye.application :sidekiq_test do
notify :dev
working_dir "/home/dms_master/dms_webapp"
stdall 'trash.log' # stdout,err logs for processes by default
env 'APP_ENV' => 'development' # global env for each processes
trigger :flapping, times: 10, within: 1.minute, retry_in: 10.minutes
#check :cpu, every: 10.seconds, below: 100, times: 3 # global check for all processes
working_dir File.expand_path(File.join(File.dirname(__FILE__), %w[ ../ ]))
env 'RAILS_ENV' => 'production'
sidekiq_process(self, :sidekiq)
end
根据源代码,您缺少邮件user
参数:
mail :host => "some.host", :port => 12345, :user => "eye@some.host", :password => "123456", :domain => "some.host"
有帮助吗?