通知邮件在 rails 眼睛 gem 中不起作用,

Notification mail not working in rails eye gem,

我在 rails 应用程序中使用 eye gem 监控 sidekiq 后台进程,但我没有收到通知邮件。我知道很可能是我的配置语法本身是错误的,但我无法在任何地方找到完整的文档或教程。

Eye 监控正常,当我终止 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

根据 source code,您缺少邮件的 user 参数:

mail :host => "some.host", :port => 12345, :user => "eye@some.host", :password => "123456", :domain => "some.host"

有帮助吗?