bin/check-instance-events.rb in sensu-plugins-aws-0.0.2 vs bin/check-instance-events.rb in sensu-plugins-aws-0.0.3
- old
+ new
@@ -26,11 +26,11 @@
# Released under the same terms as Sensu (the MIT license); see LICENSE
# for details.
#
require 'sensu-plugin/check/cli'
-require 'aws-sdk'
+require 'aws-sdk-v1'
class CheckInstanceEvents < Sensu::Plugin::Check::CLI
option :aws_access_key,
short: '-a AWS_ACCESS_KEY',
long: '--aws-access-key AWS_ACCESS_KEY',
@@ -91,10 +91,11 @@
# "description": "[Completed] Scheduled reboot",
# "not_before": "2015-01-05 12:00:00 UTC",
# "not_after": "2015-01-05 18:00:00 UTC"
# }
# ]
- unless i[:events_set].select { |x| x[:code] == 'system-reboot' && x[:description] =~ /\[Completed\]/ }
+ useful_events = i[:events_set].reject { |x| x[:code] == 'system-reboot' && x[:description] =~ /\[Completed\]/ }
+ unless useful_events.empty?
event_instances << i[:instance_id]
end
end
end
rescue => e