SHARE
TWEET

Untitled

a guest May 21st, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @instances.each do |instance|
  2.   instance.alarm_ids = alarms_id_map[instance.id]
  3.   active_instances[instance.id] = true
  4.   if blackout_instances.has_key?(instance.id)
  5.     instance.is_blackout = true
  6.     instance.blackout_dsc = blackout_instances[instance.id].dsc
  7.     instance.blackout_fd = blackout_instances[instance.id].fd
  8.     instance.blackout_td = blackout_instances[instance.id].td
  9.     instance.blackout_notify = blackout_instances[instance.id].type_notify
  10.     instance.blackout_user_id = blackout_instances[instance.id].user_id
  11.   else
  12.     if instance_alarms_dat.has_key?(instance.id)
  13.       if (Time.now.to_i - instance_alarms_dat[instance.id][:last_alarm].to_i) < 30*60
  14.         instance.last_mon_date = instance_alarms_dat[instance.id][:last_alarm]
  15.       end
  16.     end
  17.     unless instance.last_mon_date
  18.       # last_mon_date = MonitorMonitor.where(n: MonitorMonitor.select('max(n)').where(up: instance.id)).pluck(:dat)
  19.       # instance.last_mon_date = last_mon_date[0] || Time.at(0)
  20.       instance.last_mon_date = last_dates[instance.id.to_i] || Time.at(0)
  21.       if instance_alarms_dat.has_key?(instance.id) && instance_alarms_dat[instance.id][:last_metric].to_i >= instance.last_mon_date.to_i
  22.         instance.has_last_metric_alarm = true
  23.         instance.last_metric_alarm_date = instance_alarms_dat[instance.id][:last_metric]
  24.       end
  25.     end
  26.   end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top