sensu-plugins-aws-boutetnico 1.3.4 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fe094383d830db96850748921c9254b10ee8a42e
4
- data.tar.gz: 871bbc246d176877295c8dd26b771d2558b4595f
3
+ metadata.gz: '0429c151e421c3247fc41559aee9178b6548730d'
4
+ data.tar.gz: a12f4309b12ae8e3cde217491e5b2a45535cd676
5
5
  SHA512:
6
- metadata.gz: 23fd3ad60e3e4df3fc498f2cf217619f8d8f46851ce8d6536084c82c9c5c45608cfb4352d3a5a429a6c3d1e41b41dcaa62d348f48862ff9f5b6b380ffc997c7f
7
- data.tar.gz: 21359c746241a7c7084c4d00aff7faf1fa7364f2450ed24ec0cd0302ebca2e8eb7af62130e62c0d940c8b10ec0a5762660039c257af924e0a61dbd633df635be
6
+ metadata.gz: f2868dfdba3e80d708ae609ca5cc3457a52a904167f9cfeb1b18fe2d136d169a6b32963b4181ddcd2434fba8522cb177f796811c4582b0d7335515fce95b132c
7
+ data.tar.gz: 11ac75a1641efed783dda2291cda3a23bc375c8e51fe3de3ca59d0349a8059edbd92de207058c3ff9cbd9bae320e980cbd404c03a04e04ce771fe03527568f7b
@@ -0,0 +1,96 @@
1
+ #! /usr/bin/env ruby
2
+ #
3
+ # savings-plans-coverage
4
+ #
5
+ # DESCRIPTION:
6
+ # Gets Savings Plans Coverage of an AWS account.
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-plugins-aws
18
+ #
19
+ # USAGE:
20
+ # metrics-savings-plans-coverage.rb
21
+ #
22
+ # NOTES:
23
+ #
24
+ # LICENSE:
25
+ # Copyright (c) 2020, Nicolas Boutet amd3002@gmail.com
26
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
27
+ # for details.
28
+ #
29
+
30
+ require 'sensu-plugin/metric/cli'
31
+ require 'aws-sdk'
32
+ require 'sensu-plugins-aws'
33
+
34
+ class SavingsPlansUtilizationMetrics < Sensu::Plugin::Metric::CLI::Graphite
35
+ include Common
36
+
37
+ option :from,
38
+ short: '-f TIME',
39
+ long: '--from TIME',
40
+ default: Time.now - 2 * 86_400, # start date cannot be after 2 days ago
41
+ proc: proc { |a| Time.parse a },
42
+ description: 'The beginning of the time period that you want the usage and costs for (inclusive).'
43
+
44
+ option :to,
45
+ short: '-t TIME',
46
+ long: '--to TIME',
47
+ default: Time.now,
48
+ proc: proc { |a| Time.parse a },
49
+ description: 'The end of the time period that you want the usage and costs for (exclusive).'
50
+
51
+ option :granularity,
52
+ short: '-g GRANULARITY',
53
+ long: '--granularity GRANULARITY',
54
+ required: false,
55
+ in: %w[HOURLY DAILY MONTHLY],
56
+ description: 'The granularity of the Amazon Web Services coverage data for your Savings Plans.',
57
+ default: 'DAILY'
58
+
59
+ option :scheme,
60
+ description: 'Metric naming scheme, text to prepend to metric.',
61
+ short: '-s SCHEME',
62
+ long: '--scheme SCHEME',
63
+ default: 'sensu.aws.savings_plans_coverage'
64
+
65
+ option :aws_region,
66
+ short: '-r AWS_REGION',
67
+ long: '--aws-region REGION',
68
+ description: 'AWS Region (defaults to us-east-1).',
69
+ default: 'us-east-1'
70
+
71
+ def run
72
+ begin
73
+ client = Aws::CostExplorer::Client.new(aws_config)
74
+
75
+ utilization = client.get_savings_plans_coverage(
76
+ time_period: {
77
+ start: config[:from].strftime('%Y-%m-%d'),
78
+ end: config[:to].strftime('%Y-%m-%d')
79
+ },
80
+ granularity: config[:granularity]
81
+ )
82
+
83
+ utilization.savings_plans_coverages.each do |period|
84
+ period.to_h.each do |category, values|
85
+ next if category.to_s == 'time_period' || category.to_s == 'attributes'
86
+ values.to_h.each do |key, value|
87
+ output "#{config[:scheme]}.#{category}.#{key}", value, Time.parse(period.time_period.end).to_i
88
+ end
89
+ end
90
+ end
91
+ rescue StandardError => e
92
+ critical "Error: exception: #{e}"
93
+ end
94
+ ok
95
+ end
96
+ end
@@ -1,8 +1,8 @@
1
1
  module SensuPluginsAWS
2
2
  module Version
3
3
  MAJOR = 1
4
- MINOR = 3
5
- PATCH = 4
4
+ MINOR = 4
5
+ PATCH = 0
6
6
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-aws-boutetnico
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.4
4
+ version: 1.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: 2020-05-05 00:00:00.000000000 Z
11
+ date: 2020-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin
@@ -248,93 +248,94 @@ description: |-
248
248
  for EC2, SES, and SNS.
249
249
  email: "<sensu-users@googlegroups.com>"
250
250
  executables:
251
+ - check-elb-health-fog.rb
252
+ - metrics-cloudwatch-ses.rb
253
+ - metrics-rds.rb
254
+ - check-reserved-instances.rb
255
+ - metrics-elasticache.rb
256
+ - check-elb-certs.rb
257
+ - check-kms-key.rb
251
258
  - check-redshift-events.rb
252
- - check-alb-target-group-health.rb
253
- - check-ebs-burst-limit.rb
254
- - handler-ses.rb
255
- - check-expiring-reservations.rb
256
- - check-cloudwatch-alarm.rb
257
- - check-configservice-rules.rb
258
- - check-s3-object.rb
259
- - check-rds.rb
260
- - check-route.rb
261
- - check-sqs-messages.rb
262
- - check-dynamodb-capacity.rb
263
- - check-s3-bucket.rb
264
- - check-elb-health.rb
265
- - check-asg-instances-inservice.rb
266
- - metrics-cloudfront.rb
267
- - metrics-emr-steps.rb
268
- - check-sns-subscriptions.rb
269
- - check-emr-cluster.rb
270
- - metrics-ec2-count.rb
271
- - metrics-ses.rb
272
- - check-s3-tag.rb
273
- - metrics-cloudwatch-ebs.rb
274
- - check-subnet-ip-consumption.rb
275
- - check-instance-events.rb
259
+ - metrics-waf.rb
260
+ - check-dynamodb-throttle.rb
261
+ - check-trustedadvisor-service-limits.rb
276
262
  - check-ec2-network.rb
277
- - check-ebs-snapshots.rb
278
- - check-elb-nodes.rb
279
- - check-reserved-instances.rb
263
+ - check-beanstalk-health.rb
264
+ - check-ec2-cpu_balance.rb
265
+ - handler-sns.rb
266
+ - metrics-autoscaling-instance-count.rb
267
+ - check-instance-events.rb
280
268
  - check-rds-pending.rb
281
- - metrics-ec2-filter.rb
282
- - check-elb-health-sdk.rb
283
- - check-direct-connect-virtual-interfaces.rb
284
- - handler-scale-asg-up.rb
285
- - check-elb-latency.rb
286
- - metrics-elb.rb
287
- - metrics-cloudwatch-ec2.rb
269
+ - check-route.rb
288
270
  - check-instance-reachability.rb
289
- - check-trustedadvisor-service-limits.rb
290
- - check-vpc-vpn.rb
291
- - metrics-autoscaling-instance-count.rb
292
- - metrics-s3.rb
293
- - check-eni-status.rb
294
- - check-elb-health-fog.rb
295
- - check-instances-count.rb
296
- - check-elb-instances-inservice.rb
297
271
  - check-route53-domain-expiration.rb
298
- - metrics-ses-usage.rb
299
- - metrics-sqs.rb
272
+ - check-s3-tag.rb
273
+ - check-eip-allocation.rb
274
+ - check-asg-instances-created.rb
300
275
  - check-elasticache-failover.rb
301
- - check-ec2-filter.rb
276
+ - metrics-elb.rb
277
+ - check-certificate-expiry.rb
278
+ - check-configservice-rules.rb
279
+ - check-elb-instances-inservice.rb
280
+ - metrics-emr-steps.rb
281
+ - check-alb-target-group-health.rb
282
+ - check-elb-sum-requests.rb
283
+ - check-subnet-ip-consumption.rb
284
+ - check-elb-health.rb
285
+ - handler-scale-asg-up.rb
286
+ - check-emr-cluster.rb
287
+ - check-asg-instances-inservice.rb
302
288
  - handler-scale-asg-down.rb
289
+ - check-eni-status.rb
290
+ - metrics-ec2-count.rb
303
291
  - check-cloudfront-tag.rb
292
+ - check-ses-statistics.rb
293
+ - check-ec2-filter.rb
294
+ - check-cloudwatch-composite-metric.rb
295
+ - metrics-ses-usage.rb
296
+ - metrics-cloudwatch-ebs.rb
304
297
  - check-vpc-nameservers.rb
305
- - metrics-waf.rb
298
+ - handler-ec2_node.rb
299
+ - check-ses-limit.rb
300
+ - metrics-cloudfront.rb
301
+ - metrics-cloudwatch-ec2.rb
302
+ - check-cloudwatch-alarms.rb
303
+ - check-instances-count.rb
304
+ - check-elb-nodes.rb
305
+ - metrics-savings-plans-utilization.rb
306
+ - check-rds.rb
307
+ - check-sqs-messages.rb
306
308
  - check-sensu-client.rb
307
- - metrics-cloudwatch-ses.rb
308
- - metrics-rds.rb
309
+ - check-dynamodb-capacity.rb
310
+ - check-expiring-reservations.rb
311
+ - check-s3-bucket.rb
312
+ - metrics-reservation-utilization.rb
313
+ - check-s3-object.rb
314
+ - metrics-sqs.rb
315
+ - check-instance-health.rb
316
+ - check-elb-latency.rb
317
+ - metrics-ec2-filter.rb
309
318
  - metrics-asg.rb
310
- - check-dynamodb-throttle.rb
311
- - handler-sns.rb
312
- - check-elb-certs.rb
313
- - check-asg-instances-created.rb
319
+ - check-direct-connect-virtual-interfaces.rb
320
+ - check-sns-subscriptions.rb
321
+ - metrics-savings-plans-coverage.rb
322
+ - check-vpc-vpn.rb
323
+ - check-emr-steps.rb
324
+ - check-autoscaling-cpucredits.rb
314
325
  - check-ecs-service-health.rb
315
- - check-certificate-expiry.rb
326
+ - check-rds-events.rb
327
+ - handler-ses.rb
328
+ - metrics-s3.rb
329
+ - check-elb-health-sdk.rb
330
+ - check-beanstalk-elb-metric.rb
331
+ - check-cloudwatch-metric.rb
332
+ - check-ebs-snapshots.rb
333
+ - check-cloudwatch-alarm.rb
316
334
  - check-efs-metric.rb
317
- - check-eip-allocation.rb
318
- - check-elb-sum-requests.rb
319
- - check-s3-bucket-visibility.rb
320
- - metrics-elasticache.rb
321
- - check-cloudwatch-composite-metric.rb
322
335
  - metrics-billing.rb
323
- - check-kms-key.rb
324
- - check-ses-statistics.rb
325
- - metrics-savings-plans-utilization.rb
326
- - check-cloudwatch-metric.rb
327
- - check-beanstalk-elb-metric.rb
328
- - check-rds-events.rb
329
- - check-autoscaling-cpucredits.rb
330
- - check-ec2-cpu_balance.rb
331
- - check-ses-limit.rb
332
- - handler-ec2_node.rb
333
- - metrics-reservation-utilization.rb
334
- - check-beanstalk-health.rb
335
- - check-instance-health.rb
336
- - check-emr-steps.rb
337
- - check-cloudwatch-alarms.rb
336
+ - metrics-ses.rb
337
+ - check-s3-bucket-visibility.rb
338
+ - check-ebs-burst-limit.rb
338
339
  extensions: []
339
340
  extra_rdoc_files: []
340
341
  files:
@@ -423,6 +424,7 @@ files:
423
424
  - bin/metrics-rds.rb
424
425
  - bin/metrics-reservation-utilization.rb
425
426
  - bin/metrics-s3.rb
427
+ - bin/metrics-savings-plans-coverage.rb
426
428
  - bin/metrics-savings-plans-utilization.rb
427
429
  - bin/metrics-ses-usage.rb
428
430
  - bin/metrics-ses.rb