bin/check-beanstalk-health.rb in sensu-plugins-aws-3.1.0 vs bin/check-beanstalk-health.rb in sensu-plugins-aws-3.2.0

- old
+ new

@@ -43,19 +43,30 @@ long: '--allow-no-data', description: 'Returns unknown if health status is Grey. If set to false this will critical on a Grey status.', boolean: true, default: true + option :aws_region, + short: '-r AWS_REGION', + long: '--aws-region REGION', + description: 'Optional parameter to specify AWS Region.' + def env_health @env_health ||= beanstalk_client .describe_environment_health( environment_name: config[:environment], attribute_names: %w(Color Status HealthStatus Causes) ) end def beanstalk_client - @beanstalk_client ||= Aws::ElasticBeanstalk::Client.new + @beanstalk_client ||= if config[:aws_region] + Aws::ElasticBeanstalk::Client.new( + region: config[:aws_region] + ) + else + Aws::ElasticBeanstalk::Client.new + end end def instances_health @instances_health ||= begin curr_instances = beanstalk_client.describe_instances_health(