From d80b1c9b1fcc5ff3a83e9506d5b1bb23256ea971 Mon Sep 17 00:00:00 2001 From: Cyril Gaudin Date: Wed, 9 Jan 2019 23:22:52 +0100 Subject: [PATCH] check-ec2-cpu_balance: Use proc to transform instance_families to a list --- bin/check-ec2-cpu_balance.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/check-ec2-cpu_balance.rb b/bin/check-ec2-cpu_balance.rb index e65b4cbf..3fbfadc7 100755 --- a/bin/check-ec2-cpu_balance.rb +++ b/bin/check-ec2-cpu_balance.rb @@ -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: ['t2', 't3'] def data(instance) client = Aws::CloudWatch::Client.new @@ -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])})" : ''