ruby-on-railssidekiqmonitorprocess-monitoring

Notification mail not working in rails eye gem,


I was using eye gem to monitor sidekiq background process in my rails application, but I am not receiving notification mails. I know that most probably, my config syntax itself is wrong but I am not able to find a complete documentation or tutorial anywhere.

Eye is monitoring fine and it does restart sidekiq when I kill sidekiq process but its not sending email notifications.

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

Solution

  • According to the source code, you are missing user param for mail:

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

    Does it help?