sensu-plugins-aws-boutetnico 1.2.0 → 1.3.4

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
- SHA256:
3
- metadata.gz: b2a10855b93b31564af58f86c27f72de712191c5f037df52dc742538acfed984
4
- data.tar.gz: 6b5a92561b5ac979f06cd1cdacc97593a1e9838c3f508fd2c8f20908d4b67d0b
2
+ SHA1:
3
+ metadata.gz: fe094383d830db96850748921c9254b10ee8a42e
4
+ data.tar.gz: 871bbc246d176877295c8dd26b771d2558b4595f
5
5
  SHA512:
6
- metadata.gz: 3e59d8f558e7b293eef240679a68f7681c1a9c7ed443a3183bffa1347dd47d9bb4498b4d42f25ae58eca29f0a3ebdefd3b345b4742db72242c051e822021c44e
7
- data.tar.gz: 1958f736c2e8846f0d2082f7246bce9d149e24c9b4cc57bfe38c3446422a4c0249a470245162567c92c920db767afa6524397354643649af44f64302a0bd80d5
6
+ metadata.gz: 23fd3ad60e3e4df3fc498f2cf217619f8d8f46851ce8d6536084c82c9c5c45608cfb4352d3a5a429a6c3d1e41b41dcaa62d348f48862ff9f5b6b380ffc997c7f
7
+ data.tar.gz: 21359c746241a7c7084c4d00aff7faf1fa7364f2450ed24ec0cd0302ebca2e8eb7af62130e62c0d940c8b10ec0a5762660039c257af924e0a61dbd633df635be
data/README.md CHANGED
@@ -1,6 +1,5 @@
1
1
  ## Sensu-Plugins-aws
2
2
 
3
- [![Build Status](https://travis-ci.org/boutetnico/sensu-plugins-aws.svg?branch=master)](https://travis-ci.org/boutetnico/sensu-plugins-aws)
4
3
  [![Gem Version](https://badge.fury.io/rb/sensu-plugins-aws-boutetnico.svg)](https://badge.fury.io/rb/sensu-plugins-aws-boutetnico.svg)
5
4
  [![Sensu Bonsai Asset](https://img.shields.io/badge/Bonsai-Download%20Me-brightgreen.svg?colorB=89C967&logo=sensu)](https://bonsai.sensu.io/assets/boutetnico/sensu-plugins-aws)
6
5
 
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,96 @@
1
+ #! /usr/bin/env ruby
2
+ #
3
+ # savings-plans-utilization
4
+ #
5
+ # DESCRIPTION:
6
+ # Gets Savings Plans Utilization 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-utilization.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 utillization 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_utilization'
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_utilization(
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_utilizations_by_time.each do |period|
84
+ period.to_h.each do |category, values|
85
+ next if category.to_s == 'time_period'
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
File without changes
@@ -1,8 +1,8 @@
1
1
  module SensuPluginsAWS
2
2
  module Version
3
3
  MAJOR = 1
4
- MINOR = 2
5
- PATCH = 0
4
+ MINOR = 3
5
+ PATCH = 4
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.2.0
4
+ version: 1.3.4
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-03-25 00:00:00.000000000 Z
11
+ date: 2020-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin
@@ -248,92 +248,93 @@ description: |-
248
248
  for EC2, SES, and SNS.
249
249
  email: "<sensu-users@googlegroups.com>"
250
250
  executables:
251
- - check-reserved-instances.rb
252
- - check-vpc-nameservers.rb
253
- - metrics-autoscaling-instance-count.rb
254
- - check-cloudwatch-alarm.rb
255
- - check-dynamodb-throttle.rb
256
- - metrics-cloudwatch-ebs.rb
257
- - check-cloudwatch-alarms.rb
258
- - check-kms-key.rb
259
- - check-ses-limit.rb
260
- - metrics-s3.rb
261
- - handler-sns.rb
262
- - check-s3-bucket-visibility.rb
263
- - metrics-cloudfront.rb
264
- - check-ec2-network.rb
265
- - check-rds-events.rb
266
- - metrics-rds.rb
267
- - check-instances-count.rb
268
- - metrics-sqs.rb
269
- - check-emr-steps.rb
270
- - check-ebs-burst-limit.rb
271
251
  - check-redshift-events.rb
272
- - check-instance-health.rb
273
- - check-elb-health.rb
252
+ - check-alb-target-group-health.rb
253
+ - check-ebs-burst-limit.rb
254
+ - handler-ses.rb
274
255
  - check-expiring-reservations.rb
275
- - handler-ec2_node.rb
276
- - check-elb-instances-inservice.rb
277
- - check-ec2-cpu_balance.rb
256
+ - check-cloudwatch-alarm.rb
257
+ - check-configservice-rules.rb
258
+ - check-s3-object.rb
259
+ - check-rds.rb
260
+ - check-route.rb
278
261
  - check-sqs-messages.rb
279
- - check-rds-pending.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
280
269
  - check-emr-cluster.rb
281
- - check-eip-allocation.rb
282
- - metrics-ec2-filter.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
276
+ - check-ec2-network.rb
283
277
  - check-ebs-snapshots.rb
284
- - metrics-waf.rb
285
- - metrics-billing.rb
278
+ - check-elb-nodes.rb
279
+ - check-reserved-instances.rb
280
+ - 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
286
287
  - metrics-cloudwatch-ec2.rb
287
- - check-autoscaling-cpucredits.rb
288
- - metrics-asg.rb
289
- - check-instance-events.rb
288
+ - 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
290
297
  - check-route53-domain-expiration.rb
298
+ - metrics-ses-usage.rb
299
+ - metrics-sqs.rb
291
300
  - check-elasticache-failover.rb
292
301
  - check-ec2-filter.rb
293
- - check-elb-sum-requests.rb
294
- - metrics-reservation-utilization.rb
295
- - check-sns-subscriptions.rb
296
- - metrics-ses.rb
297
- - check-elb-health-fog.rb
298
- - handler-scale-asg-up.rb
302
+ - handler-scale-asg-down.rb
303
+ - check-cloudfront-tag.rb
304
+ - check-vpc-nameservers.rb
305
+ - metrics-waf.rb
299
306
  - check-sensu-client.rb
300
- - check-elb-nodes.rb
301
- - check-s3-object.rb
302
- - check-trustedadvisor-service-limits.rb
303
- - check-ses-statistics.rb
304
- - check-cloudwatch-metric.rb
305
- - check-beanstalk-health.rb
306
- - check-dynamodb-capacity.rb
307
307
  - metrics-cloudwatch-ses.rb
308
- - check-eni-status.rb
309
- - check-s3-tag.rb
310
- - metrics-ses-usage.rb
311
- - check-direct-connect-virtual-interfaces.rb
312
- - check-cloudwatch-composite-metric.rb
313
- - metrics-ec2-count.rb
314
- - metrics-elasticache.rb
315
- - check-cloudfront-tag.rb
316
- - check-alb-target-group-health.rb
317
- - check-elb-health-sdk.rb
318
- - check-elb-latency.rb
319
- - check-s3-bucket.rb
320
- - handler-scale-asg-down.rb
308
+ - metrics-rds.rb
309
+ - metrics-asg.rb
310
+ - check-dynamodb-throttle.rb
311
+ - handler-sns.rb
321
312
  - check-elb-certs.rb
322
- - check-efs-metric.rb
323
- - check-vpc-vpn.rb
324
- - check-subnet-ip-consumption.rb
325
- - check-ecs-service-health.rb
326
- - check-rds.rb
327
- - handler-ses.rb
328
313
  - check-asg-instances-created.rb
329
- - check-route.rb
330
- - check-instance-reachability.rb
314
+ - check-ecs-service-health.rb
331
315
  - check-certificate-expiry.rb
332
- - check-asg-instances-inservice.rb
333
- - metrics-emr-steps.rb
334
- - metrics-elb.rb
335
- - check-configservice-rules.rb
316
+ - 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
+ - metrics-billing.rb
323
+ - check-kms-key.rb
324
+ - check-ses-statistics.rb
325
+ - metrics-savings-plans-utilization.rb
326
+ - check-cloudwatch-metric.rb
336
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
337
338
  extensions: []
338
339
  extra_rdoc_files: []
339
340
  files:
@@ -422,6 +423,7 @@ files:
422
423
  - bin/metrics-rds.rb
423
424
  - bin/metrics-reservation-utilization.rb
424
425
  - bin/metrics-s3.rb
426
+ - bin/metrics-savings-plans-utilization.rb
425
427
  - bin/metrics-ses-usage.rb
426
428
  - bin/metrics-ses.rb
427
429
  - bin/metrics-sqs.rb
@@ -457,7 +459,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
457
459
  version: '0'
458
460
  requirements: []
459
461
  rubyforge_project:
460
- rubygems_version: 2.7.7
462
+ rubygems_version: 2.6.14.4
461
463
  signing_key:
462
464
  specification_version: 4
463
465
  summary: Sensu plugins for working with an AWS environment