module Eye::Process::Notify
Constants
- LEVELS
notify to user: 1) process crashed by itself, and we restart it [:info] 2) checker bounded to restart process [:warn] 3) flapping + switch to unmonitored [:error]
Public Instance Methods
notify(level, msg)
click to toggle source
# File lib/eye/process/notify.rb, line 10 def notify(level, msg) # logging it error "NOTIFY: #{msg}" if ilevel(level) > ilevel(:info) return if self[:notify].blank? # send notifies message = { message: msg, name: name, full_name: full_name, pid: pid, host: Eye::Local.host, level: level, at: Time.now } self[:notify].each do |contact, not_level| Eye::Notify.notify(contact, message) if ilevel(level) >= ilevel(not_level) end end
Private Instance Methods
ilevel(level)
click to toggle source
# File lib/eye/process/notify.rb, line 28 def ilevel(level) LEVELS[level].to_i end