Skip to content

Commit

Permalink
check-ec2-cpu_balance: Use proc to transform instance_families to a list
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrilgdn authored and Cyril Gaudin committed Feb 19, 2019
1 parent 2bef707 commit 510ac58
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bin/check-ec2-cpu_balance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ class EC2CpuBalance < Sensu::Plugin::Check::CLI
description: 'List of burstable instance families to check. Default to t2,t3',
short: '-f t2,t3',
long: '--instance-families t2,t3',
default: 't2,t3'
proc: proc { |x| x.split(',') },
default: %w[t2 t3]

def data(instance)
client = Aws::CloudWatch::Client.new
Expand Down Expand Up @@ -107,7 +108,7 @@ def run
level = 0
instances.reservations.each do |reservation|
reservation.instances.each do |instance|
next unless instance.instance_type.start_with?(*config[:instance_families].split(','))
next unless instance.instance_type.start_with?(*config[:instance_families])
id = instance.instance_id
result = data id
tag = config[:tag] ? " (#{instance_tag(instance, config[:tag])})" : ''
Expand Down

0 comments on commit 510ac58

Please sign in to comment.