bin/check-beanstalk-health.rb in sensu-plugins-aws-10.1.1 vs bin/check-beanstalk-health.rb in sensu-plugins-aws-10.1.2
- old
+ new
@@ -52,11 +52,11 @@
def env_health
@env_health ||= beanstalk_client
.describe_environment_health(
environment_name: config[:environment],
- attribute_names: %w(Color Status HealthStatus Causes)
+ attribute_names: %w[Color Status HealthStatus Causes]
)
end
def beanstalk_client
@beanstalk_client ||= if config[:aws_region]
@@ -70,25 +70,25 @@
def instances_health
@instances_health ||= begin
curr_instances = beanstalk_client.describe_instances_health(
environment_name: config[:environment],
- attribute_names: %w(Color HealthStatus Causes)
+ attribute_names: %w[Color HealthStatus Causes]
)
instances = curr_instances.instance_health_list
until curr_instances.next_token.nil?
curr_instances = beanstalk_client.describe_instances_health(
environment_name: config[:environment],
- attribute_names: %w(Color HealthStatus Causes)
+ attribute_names: %w[Color HealthStatus Causes]
)
instances.concat(curr_instances.instance_health_list)
end
instances
end
end
def unhealthy_instances
- @unhealthy_instances ||= instances_health.select { |i| i.color != 'Green' }
+ @unhealthy_instances ||= instances_health.reject { |i| i.color == 'Green' }
end
def status_rollup
"Beanstalk Status: #{env_health.status}, Health Status: #{env_health.health_status}, Causes: #{env_health.causes.join(', ')}"
end