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

Add WAF metrics #275

Merged
merged 1 commit into from
Apr 28, 2018
Merged

Add WAF metrics #275

merged 1 commit into from
Apr 28, 2018

Conversation

yuri-zubov
Copy link
Contributor

@yuri-zubov yuri-zubov commented Mar 26, 2018

Pull Request Checklist

Is this in reference to an existing issue?

General

  • Update Changelog following the conventions laid out here

  • Update README with any necessary configuration snippets

  • Binstubs are created if needed

  • RuboCop passes

  • Existing tests pass

New Plugins

  • Tests

  • Add the plugin to the README

  • Does it have a complete header as outlined here

Purpose

Known Compatibility Issues

sensu-plugins/community#97

@majormoses
Copy link
Member

Sorry I started reviewing this then closed the window without submitting the feedback, let me go make a pass and ensure I was complete with my review.

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.

Overall I think this looks good. I see a few enhancements to make:

  • leverage already existing library functions over redefining the same thing
  • support multiple metric formatters, while I am not saying you need to add support for it but making it easier to add those in the future seems like a good idea minimally.

@cloud_watch ||= Aws::CloudWatch::Client.new
end

def cloud_watch_metric(metric_name, value)
Copy link
Member

Choose a reason for hiding this comment

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

Is there something that this does not work for?

https://github.com/sensu-plugins/sensu-plugins-aws/blob/11.3.0/lib/sensu-plugins-aws/cloudwatch-common.rb#L29-L40

If so can we enhance it instead?

require 'sensu-plugins-aws'
require 'time'

class WafMetrics < Sensu::Plugin::Metric::CLI::Graphite
Copy link
Member

Choose a reason for hiding this comment

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

rather than making it directly use graphite only format if possible we should use generic and use an option to control the output format. This means that someone using influxdb does not need to rewrite the check just add the option and choose to specify their format.

sensu-plugins/sensu-plugin#185

In order to use this new functionality we would need to bump sensu-plugin ~> 2.4 which is fine since we are already using ~> 2.0 it remains backwards compatible.

@yuri-zubov
Copy link
Contributor Author

@majormoses - fixed comments

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 3f33c75 into sensu-plugins:master Apr 28, 2018
@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.

None yet

2 participants