bin/check-rds-pending.rb in sensu-plugins-aws-11.5.0 vs bin/check-rds-pending.rb in sensu-plugins-aws-11.5.1

- old
+ new

@@ -45,13 +45,15 @@ begin # fetch all clusters identifiers clusters = rds.describe_db_instances[:db_instances].map { |db| db[:db_instance_identifier] } maint_clusters = [] - # Check if there is any pending maintenance required - pending_record = rds.describe_pending_maintenance_actions(filters: [{ name: 'db-instance-id', values: clusters }]) - pending_record[:pending_maintenance_actions].each do |response| - maint_clusters.push(response[:pending_maintenance_action_details]) + if clusters.any? + # Check if there is any pending maintenance required + pending_record = rds.describe_pending_maintenance_actions(filters: [{ name: 'db-instance-id', values: clusters }]) + pending_record[:pending_maintenance_actions].each do |response| + maint_clusters.push(response[:pending_maintenance_action_details]) + end end rescue StandardError => e unknown "An error occurred processing AWS RDS API: #{e.message}" end