-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
check-ec2-cpu_balance.rb: Make instance families configurable. #320
Conversation
72c2c7d
to
1c225b5
Compare
Thanks for your contribution to Sensu plugins! Without people like you submitting PRs we couldn't run the project. I will review it shortly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks good after fixing the typo. Could you please also include a changelog entry?
bin/check-ec2-cpu_balance.rb
Outdated
@@ -101,7 +107,7 @@ def run | |||
level = 0 | |||
instances.reservations.each do |reservation| | |||
reservation.instances.each do |instance| | |||
next unless instance.instance_type.start_with? 't2.' | |||
next unless instance.instance_type.start_with?(*config[:instance_families].split(',')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think *
is a typo? Also it might make sense to do this when passed in the var, for example: https://github.com/sensu-plugins/sensu-plugins-aws/blob/16.1.0/bin/check-cloudwatch-alarms.rb#L53 this makes it easier to use in other locations in this check if that makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think * is a typo?
No, it's the splat operator because start_with
does not take an array as argument but as many strings as we want.
Also it might make sense to do this when passed in the var, for example: https://github.com/sensu-plugins/sensu-plugins-aws/blob/16.1.0/bin/check-cloudwatch-alarms.rb#L53 this makes it easier to use in other locations in this check if that makes sense.
Totally, I was not aware of this proc
attribute, I'll do that !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh this might be a splat operator just saw the error with CI and assumed it was a typo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah thanks for the explanation sorry I didnt see it, was not refreshed when I was looking.
@majormoses I already did. Or maybe I missed something ? |
@cyrilgdn nope I must have been multitasking too much. |
I will look into the CI failure this evening. |
@majormoses Yes I was about to asking your help because it does not seem to be linked to what I've done.
I moved the split in the proc attr. |
Ya looks unrelated, I will let you know what I find and will probably commit a fix to your branch assuming you dont have an issue with that. |
There's a new CPU burstable instance family: t3 I added it in the default value but thought it may be a good idea to add an option for that. (So no need to wait for a plugin update when AWS will add another new burstable family.) # Conflicts: # CHANGELOG.md
f45618c
to
d80b1c9
Compare
@majormoses Done ! (but for now Travis build is pending since hours) |
bin/check-ec2-cpu_balance.rb
Outdated
short: '-f t2,t3', | ||
long: '--instance-families t2,t3', | ||
proc: proc { |x| x.split(',') }, | ||
default: ['t2', 't3'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since you are doing a split(',')
on input the default should be t2,t3
Ya unfortunately we get so many concurrent builders from travis and I made a major release of |
5d51ce0
to
c0fb668
Compare
c0fb668
to
510ac58
Compare
@majormoses Travis is green 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There's a new CPU burstable instance family: t3
I added it in the default value but thought it may be a good idea to add an option for that.
(So no need to wait for a plugin update when AWS will add another new burstable family.)