sensu-plugins-aws 12.0.0 → 12.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 31017c7ec95b3c63fff718e67a620586aff45b234b9d498f14e48862e3362df3
4
- data.tar.gz: 8b87f31b8be52d80bbb42a7159feeefe7cd69fd43588d3a993c825c08ee7bcab
3
+ metadata.gz: dc08d77c4f4e2d59086492322c080d5796b3ecafcd26965763f441de8b191300
4
+ data.tar.gz: 3c6d7077935ea918ca4db9bc9844e4ea42e2e62ecf1580e048c5497cc6b51e94
5
5
  SHA512:
6
- metadata.gz: 4472bf2cee558b964d29815e80f37ea436a15439fb8e7c9ae45bc9376cf798324efe541b82deba3c5dbcf9f11d4ba565695b22398b7223976d4836f1df623051
7
- data.tar.gz: 90de7452049ff5025663ba86e71a78ddcab07acbe9a592576b4d0d6a4b30181c6f5afc054fe94c6c72e2d2972691907892f81ec8de3d8156d29b2da10cbd4ca6
6
+ metadata.gz: 963970d678c9ee70c61184041388f0ccf7ed143c5d67dff4a90dfb71869cd248f248d1057da7119f267bcac6cefd365393bba200f380097c1275e0a23269b88d
7
+ data.tar.gz: 2053a94ae790488fb04067ec9a59d4b99a1f14e626bd316c00964469cfb38ba30a8be97ea2125e94f212d110c07dcdf3a0f66da88acab7335fc25ac73a4da243
data/CHANGELOG.md CHANGED
@@ -5,6 +5,10 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [12.1.0] - 2018-08-28
9
+ ### Added
10
+ - new `check-efs.rb: checks cloudwatch metrics with the efs namespace for an arbitrary metric (@ivanfetch)
11
+
8
12
  ## [12.0.0] - 2018-06-21
9
13
  ### Breaking Changes
10
14
  - `check-ebs-burst-limit.rb`: Fixed period to pass to config from 60 to 120 so as to not have empty values returned sometimes (@wari)
@@ -490,7 +494,8 @@ WARNING: This release contains major breaking changes that will impact all user
490
494
  ### Added
491
495
  - initial release
492
496
 
493
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/12.0.0...HEAD
497
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/12.1.0...HEAD
498
+ [12.1.0]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/12.0.0...12.1.0
494
499
  [12.0.0]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/11.6.0...12.0.0
495
500
  [11.6.0]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/11.5.1...11.6.0
496
501
  [11.5.1]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/11.5.0...11.5.1
data/README.md CHANGED
@@ -48,6 +48,8 @@
48
48
 
49
49
  **check-ecs-service-health.rb**
50
50
 
51
+ **check-efs-metric.rb**
52
+
51
53
  **check-eip-allocation.rb**
52
54
 
53
55
  **check-elasticache-failover.rb**
@@ -173,6 +175,7 @@
173
175
  * /bin/check-ec2-filter.rb
174
176
  * /bin/check-ec2-network.rb
175
177
  * /bin/check-ecs-service-health.rb
178
+ * /bin/check-efs-metric.rb
176
179
  * /bin/check-elasticache-failover.rb
177
180
  * /bin/check-elb-certs.rb
178
181
  * /bin/check-elb-health-fog.rb
@@ -0,0 +1,145 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # check-efs-metric
4
+ #
5
+ # DESCRIPTION:
6
+ # This plugin checks a CloudWatch metric from the AWS/EFS namespace
7
+ # For more details, see https://docs.aws.amazon.com/efs/latest/ug/monitoring-cloudwatch.html#efs-metrics
8
+ #
9
+ # OUTPUT:
10
+ # plain-text
11
+ #
12
+ # PLATFORMS:
13
+ # Linux
14
+ #
15
+ # DEPENDENCIES:
16
+ # gem: aws-sdk
17
+ # gem: sensu-plugin
18
+ #
19
+ # USAGE:
20
+ # ./check-efs-metric -w 25.0 -c 75.0 \
21
+ # -m PercentIOLimit -o greater -n my-efs-filesystem-name
22
+ #
23
+ # NOTES:
24
+ #
25
+ # LICENSE:
26
+ # Ivan Fetch
27
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
28
+ # for details.
29
+ #
30
+
31
+ require 'sensu-plugins-aws'
32
+ require 'sensu-plugin/check/cli'
33
+ require 'aws-sdk'
34
+
35
+ # A Sensu plugin which uses cloudwatch-common to check EFS CloudWatch metrics
36
+ class EFSMetric < Sensu::Plugin::Check::CLI
37
+ include Common
38
+ include CloudwatchCommon
39
+
40
+ option :efs_name,
41
+ description: 'Name of the EFS file system, matching the Name tag',
42
+ short: '-n VALUE',
43
+ long: '--name VALUE',
44
+ proc: proc(&:to_s),
45
+ required: true
46
+
47
+ option :metric_name,
48
+ description: 'CloudWatch metric in the AWS/EFS namespace: E.G. PercentIOLimit',
49
+ short: '-m VALUE',
50
+ long: '--metric VALUE',
51
+ proc: proc(&:to_s),
52
+ required: true
53
+
54
+ option :statistics,
55
+ description: 'Statistic to retrieve from CloudWatch: E.G. Minimum or Maximum',
56
+ short: '-s statistic',
57
+ long: '--statistic statistic',
58
+ default: 'Average',
59
+ proc: proc(&:to_s)
60
+
61
+ option :critical,
62
+ description: 'Return critical when the metric is at this VALUE, also see the --operator option',
63
+ short: '-c VALUE',
64
+ long: '--critical VALUE',
65
+ proc: proc(&:to_f),
66
+ required: true
67
+
68
+ option :warning,
69
+ description: 'Return warning when the metric is at this VALUE, also see the --operator option',
70
+ short: '-w VALUE',
71
+ long: '--warning VALUE',
72
+ proc: proc(&:to_f)
73
+
74
+ option :period,
75
+ description: 'CloudWatch metric statistics period, in seconds. Must be a multiple of 60',
76
+ short: '-p VALUE',
77
+ long: '--period VALUE',
78
+ default: 60,
79
+ proc: proc(&:to_i)
80
+
81
+ option :compare,
82
+ description: 'Comparison operator for critical and warning thresholds: equal, not, greater, less',
83
+ short: '-o OPERATOR',
84
+ long: '--operator OPERATOR',
85
+ default: 'less'
86
+
87
+ option :unit,
88
+ description: 'CloudWatch metric unit, to be passed to the metrics request',
89
+ short: '-u UNIT',
90
+ long: '--unit UNIT'
91
+
92
+ option :no_data_ok,
93
+ description: 'Returns ok if no data is returned from the metric',
94
+ short: '-O',
95
+ long: '--allow-no-data',
96
+ boolean: true,
97
+ default: false
98
+
99
+ option :no_efs_ok,
100
+ description: 'Returns ok if the EFS file system specified by the -n option can not be found: This is useful if using a check in multiple environments where a file system may not always exist',
101
+ short: '-N',
102
+ long: '--allow-no-efs',
103
+ boolean: true,
104
+ default: false
105
+
106
+ option :aws_region,
107
+ description: 'AWS region',
108
+ short: '-r Region',
109
+ long: '--region REGION',
110
+ default: 'us-east-1'
111
+
112
+ # This is used by CloudwatchCommon to display the description for what is being checked.
113
+ def metric_desc
114
+ "#{config[:metric_name]} for #{config[:efs_name]}"
115
+ end
116
+
117
+ def run
118
+ config[:namespace] = 'AWS/EFS'
119
+ found_efs = false
120
+
121
+ efs = Aws::EFS::Client.new
122
+ filesystems = efs.describe_file_systems
123
+ filesystems.file_systems.each do |filesystem|
124
+ # Once Ruby < ver 2.4 is not supported, change this to:
125
+ # if filesystem.name.casecmp?(config[:efs_name])
126
+ # See : https://ruby-doc.org/core-2.4.0/String.html#method-i-casecmp
127
+ if filesystem.name.casecmp(config[:efs_name]).zero?
128
+ found_efs = true
129
+ config[:dimensions] = []
130
+ config[:dimensions] << { name: 'FileSystemId', value: filesystem.file_system_id }
131
+ check config
132
+ end
133
+ end
134
+
135
+ # rubocop:disable Style/GuardClause
136
+ unless found_efs
137
+ if config[:no_efs_ok]
138
+ ok "EFS file system #{config[:efs_name]} was not found in region #{config[:aws_region]} but that's ok"
139
+ else
140
+ critical "EFS file system #{config[:efs_name]} was not found in region #{config[:aws_region]}"
141
+ end
142
+ end
143
+ # rubocop:enable Style/GuardClause
144
+ end
145
+ end
@@ -1,7 +1,7 @@
1
1
  module SensuPluginsAWS
2
2
  module Version
3
3
  MAJOR = 12
4
- MINOR = 0
4
+ MINOR = 1
5
5
  PATCH = 0
6
6
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
7
7
  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: 12.0.0
4
+ version: 12.1.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-06-22 00:00:00.000000000 Z
11
+ date: 2018-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin
@@ -277,6 +277,7 @@ executables:
277
277
  - check-ec2-filter.rb
278
278
  - check-ec2-network.rb
279
279
  - check-ecs-service-health.rb
280
+ - check-efs-metric.rb
280
281
  - check-eip-allocation.rb
281
282
  - check-elasticache-failover.rb
282
283
  - check-elb-certs.rb
@@ -361,6 +362,7 @@ files:
361
362
  - bin/check-ec2-filter.rb
362
363
  - bin/check-ec2-network.rb
363
364
  - bin/check-ecs-service-health.rb
365
+ - bin/check-efs-metric.rb
364
366
  - bin/check-eip-allocation.rb
365
367
  - bin/check-elasticache-failover.rb
366
368
  - bin/check-elb-certs.rb