Skip to content
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

Merged
merged 2 commits into from
Feb 20, 2019

Conversation

cyrilgdn
Copy link
Contributor

@cyrilgdn cyrilgdn commented Jan 9, 2019

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.)

@majormoses
Copy link
Member

Thanks for your contribution to Sensu plugins! Without people like you submitting PRs we couldn't run the project. I will review it shortly.

Copy link
Member

@majormoses majormoses left a 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?

@@ -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(','))
Copy link
Member

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.

Copy link
Contributor Author

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 !

Copy link
Member

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.

Copy link
Member

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.

@cyrilgdn
Copy link
Contributor Author

cyrilgdn commented Jan 9, 2019

Could you please also include a changelog entry?

@majormoses I already did. Or maybe I missed something ?

@majormoses
Copy link
Member

@cyrilgdn nope I must have been multitasking too much.

@majormoses
Copy link
Member

I will look into the CI failure this evening.

@cyrilgdn
Copy link
Contributor Author

cyrilgdn commented Jan 9, 2019

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.

Also it might make sense to do this when passed in the var

I moved the split in the proc attr.

@majormoses
Copy link
Member

Yes I was about to asking your help because it does not seem to be linked to what I've done.

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.

@majormoses
Copy link
Member

@cyrilgdn if you rebase from master it was fixed in #322

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
@cyrilgdn
Copy link
Contributor Author

@majormoses Done ! (but for now Travis build is pending since hours)

short: '-f t2,t3',
long: '--instance-families t2,t3',
proc: proc { |x| x.split(',') },
default: ['t2', 't3']
Copy link
Member

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

@majormoses
Copy link
Member

@majormoses Done ! (but for now Travis build is pending since hours)

Ya unfortunately we get so many concurrent builders from travis and I made a major release of sensu-plugin gem that 99% of all the plugins use as a base and dependabot probably opened up a bunch of PRs to update the dependency therefore clogging up the travis pipeline.

@cyrilgdn cyrilgdn force-pushed the cpu_balance_t3 branch 2 times, most recently from 5d51ce0 to c0fb668 Compare February 19, 2019 10:38
@cyrilgdn
Copy link
Contributor Author

@majormoses Travis is green 👍

Copy link
Member

@majormoses majormoses left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@majormoses majormoses merged commit 463f1d9 into sensu-plugins:master Feb 20, 2019
@majormoses
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants