bin/check-redshift-events.rb
# return an array of clusters that are in maintenance
return an array of clusters that are in maintenance
return an array of clusters that are in maintenance
def clusters_in_maint(clusters)
    maint_clusters = []
    clusters.each do |cluster_name|
      events_record = redshift.describe_events(start_time: (Time.now - 7200).iso8601, source_type: 'cluster', source_identifier: cluster_name)
      next if events_record[:events].empty?
      maint_clusters.push(cluster_name) if events_record[:events][-1][:event_id] == 'REDSHIFT-EVENT-2003'
    end
    maint_clusters
  end
def clusters_in_maint ( clusters ) maint_clusters = [ ] clusters . each do | cluster_name | events_record = redshift . describe_events ( start_time : ( Time . now - 7200 ) . iso8601 , source_type : 'cluster' , source_identifier : cluster_name ) next if events_record [ :events ] . empty? maint_clusters . push ( cluster_name ) if events_record [ :events ] [ - 1 ] [ :event_id ] == 'REDSHIFT-EVENT-2003' end maint_clusters end
return an array of clusters that are in maintenance
return an array of clusters that are in maintenance
# fetch the last 2 hours of events for each cluster # if the last event is a start maint event then the cluster is still in maint
clusters
<not_specific>