sensu-plugins-aws 11.3.1 → 11.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -1
- data/bin/metrics-waf.rb +111 -0
- data/lib/sensu-plugins-aws/version.rb +2 -2
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 759ebb6f5b2c991d44235b5392c64c005e25372b639d77aa561f5d2dc8de9768
|
4
|
+
data.tar.gz: 002bdfa80613f0b1a9499f968175bf81d3a94d758379174a9cd92f356b74cee8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9bf47beeff3da64504e8a4fa7c47f9c9c3e279e770ec7c806ce5747ddad06acb12fdf51ff59b3550f6aa30d7d64d5e774fb0195231b3e24e08c873a0a6f82ea
|
7
|
+
data.tar.gz: 8576679f7f3fa9702fd12691eb63574dec0102ddc8c5eff7832cb70b093480937d9e3f7c3935ccdabafb5471d3e1a9a332d171a85c57caa8bdc7195597d00896
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,13 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
+
## [11.4.0] - 2018-04-28
|
9
|
+
### Security
|
10
|
+
- updated yard dependency to `~> 0.9.11` per: https://nvd.nist.gov/vuln/detail/CVE-2017-17042 (@yuri-zubov sponsored by Actility, https://www.actility.com)
|
11
|
+
|
12
|
+
### Added
|
13
|
+
- Added ability to get metrics from WAF (@yuri-zubov sponsored by Actility, https://www.actility.com)
|
14
|
+
|
8
15
|
## [11.3.1] - 2018-04-17
|
9
16
|
### Fixed
|
10
17
|
- check-rds-events.rb: fixed issues with queries because the assume local time, now we force UTC timezone (@nadarashwin) (@majormoses)
|
@@ -459,7 +466,8 @@ WARNING: This release contains major breaking changes that will impact all user
|
|
459
466
|
### Added
|
460
467
|
- initial release
|
461
468
|
|
462
|
-
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/11.
|
469
|
+
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/11.4.0...HEAD
|
470
|
+
[11.4.0]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/11.3.1...11.4.0
|
463
471
|
[11.3.1]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/11.3.0...11.3.1
|
464
472
|
[11.3.0]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/11.2.0...11.3.0
|
465
473
|
[11.2.0]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/11.1.0...11.2.0
|
data/bin/metrics-waf.rb
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# metrics-waf
|
4
|
+
#
|
5
|
+
# DESCRIPTION:
|
6
|
+
# Gets latency metrics from CloudWatch and puts them in Graphite for longer term storage
|
7
|
+
#
|
8
|
+
# OUTPUT:
|
9
|
+
# metric-data
|
10
|
+
#
|
11
|
+
# PLATFORMS:
|
12
|
+
# Linux
|
13
|
+
#
|
14
|
+
# DEPENDENCIES:
|
15
|
+
# gem: aws-sdk
|
16
|
+
# gem: sensu-plugin
|
17
|
+
# gem: sensu-plugin-aws
|
18
|
+
# gem: time
|
19
|
+
#
|
20
|
+
# USAGE:
|
21
|
+
#
|
22
|
+
#
|
23
|
+
# NOTES:
|
24
|
+
#
|
25
|
+
# LICENSE:
|
26
|
+
# Zubov Yuri <yury.zubau@gmail.com> sponsored by Actility, https://www.actility.com
|
27
|
+
# Released under the same terms as Sensu (the MIT license); see LICENSE
|
28
|
+
# for details.
|
29
|
+
#
|
30
|
+
|
31
|
+
require 'sensu-plugin/metric/cli'
|
32
|
+
require 'aws-sdk'
|
33
|
+
require 'sensu-plugins-aws'
|
34
|
+
require 'time'
|
35
|
+
|
36
|
+
class WafMetrics < Sensu::Plugin::Metric::CLI::Generic
|
37
|
+
include CloudwatchCommon
|
38
|
+
|
39
|
+
option :scheme,
|
40
|
+
description: 'Metric naming scheme, text to prepend to metric',
|
41
|
+
short: '-s SCHEME',
|
42
|
+
long: '--scheme SCHEME',
|
43
|
+
default: 'aws.waf'
|
44
|
+
|
45
|
+
option :aws_region,
|
46
|
+
short: '-r AWS_REGION',
|
47
|
+
long: '--aws-region REGION',
|
48
|
+
description: 'AWS Region (defaults to us-east-1).',
|
49
|
+
default: 'us-east-1'
|
50
|
+
|
51
|
+
option :metric,
|
52
|
+
description: 'Metric to fetch',
|
53
|
+
short: '-m METRIC',
|
54
|
+
long: '--metric',
|
55
|
+
required: false,
|
56
|
+
in: %w[AllowedRequests BlockedRequests CountedRequests PassedRequests]
|
57
|
+
|
58
|
+
option :end_time,
|
59
|
+
short: '-t T',
|
60
|
+
long: '--end-time TIME',
|
61
|
+
default: Time.now,
|
62
|
+
proc: proc { |a| Time.parse a },
|
63
|
+
description: 'CloudWatch metric statistics end time'
|
64
|
+
|
65
|
+
option :period,
|
66
|
+
short: '-p N',
|
67
|
+
long: '--period SECONDS',
|
68
|
+
default: 60,
|
69
|
+
proc: proc(&:to_i),
|
70
|
+
description: 'CloudWatch metric statistics period'
|
71
|
+
|
72
|
+
def print_statistics(statistics, config)
|
73
|
+
statistics.each do |key, stats|
|
74
|
+
r = client.get_metric_statistics(metrics_request(config).merge(metric_name: key, statistics: [stats]))
|
75
|
+
keys = [config[:scheme]]
|
76
|
+
keys.concat([key, stats])
|
77
|
+
unless r[:datapoints].first.nil?
|
78
|
+
output metric_name: keys.join('.'), value: r[:datapoints].first[stats.downcase]
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def run
|
84
|
+
statistic = {
|
85
|
+
'AllowedRequests' => 'Sum',
|
86
|
+
'BlockedRequests' => 'Sum',
|
87
|
+
'CountedRequests' => 'Sum',
|
88
|
+
'PassedRequests' => 'Sum'
|
89
|
+
}
|
90
|
+
|
91
|
+
unless config[:metric].nil?
|
92
|
+
statistic.select! { |key, _| key == config[:metric] }
|
93
|
+
end
|
94
|
+
|
95
|
+
new_config = config.clone
|
96
|
+
new_config[:namespace] = 'WAF'
|
97
|
+
new_config[:dimensions] = [
|
98
|
+
{
|
99
|
+
name: 'WebACL',
|
100
|
+
value: 'SecurityAutomationsMaliciousRequesters'
|
101
|
+
},
|
102
|
+
{
|
103
|
+
name: 'Rule',
|
104
|
+
value: 'ALL'
|
105
|
+
}
|
106
|
+
]
|
107
|
+
|
108
|
+
print_statistics(statistic, new_config)
|
109
|
+
ok
|
110
|
+
end
|
111
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-aws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 11.
|
4
|
+
version: 11.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sensu-Plugins and contributors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|
@@ -240,14 +240,14 @@ dependencies:
|
|
240
240
|
requirements:
|
241
241
|
- - "~>"
|
242
242
|
- !ruby/object:Gem::Version
|
243
|
-
version:
|
243
|
+
version: 0.9.11
|
244
244
|
type: :development
|
245
245
|
prerelease: false
|
246
246
|
version_requirements: !ruby/object:Gem::Requirement
|
247
247
|
requirements:
|
248
248
|
- - "~>"
|
249
249
|
- !ruby/object:Gem::Version
|
250
|
-
version:
|
250
|
+
version: 0.9.11
|
251
251
|
description: |-
|
252
252
|
This plugin provides native AWS instrumentation
|
253
253
|
for monitoring and metrics collection, including:
|
@@ -333,6 +333,7 @@ executables:
|
|
333
333
|
- metrics-s3.rb
|
334
334
|
- metrics-ses.rb
|
335
335
|
- metrics-sqs.rb
|
336
|
+
- metrics-waf.rb
|
336
337
|
extensions: []
|
337
338
|
extra_rdoc_files: []
|
338
339
|
files:
|
@@ -416,6 +417,7 @@ files:
|
|
416
417
|
- bin/metrics-s3.rb
|
417
418
|
- bin/metrics-ses.rb
|
418
419
|
- bin/metrics-sqs.rb
|
420
|
+
- bin/metrics-waf.rb
|
419
421
|
- lib/sensu-plugins-aws.rb
|
420
422
|
- lib/sensu-plugins-aws/cloudwatch-common.rb
|
421
423
|
- lib/sensu-plugins-aws/common.rb
|