sensu-plugins-edgelab 1.14.1 → 1.15.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: cac9db6c64318afdd3af552c867128d4e220b304afa9ce52e315f17c5f091b1e
4
- data.tar.gz: d84928b4ccde348c7da971fe0638c18859b6f4d9ee8aeaa75579f47daf7d212e
3
+ metadata.gz: f38ff0f24f0e3a491976bc6fae7f2942c9b494dfb98ec17455b079e2c828990f
4
+ data.tar.gz: 38f65906f36cd6c9fbfecdcd172888a6992b69ff97c141caa61fb04bc8891781
5
5
  SHA512:
6
- metadata.gz: 8eb1971adf0e30ac0aa670d6353ffe3b03459d729271070737147ccae8cabdb50719547235acb50f8deeabbfebfbea2ef7d2942d28a4376b6acc26294e379dcd
7
- data.tar.gz: 2b7ded62142c3443fef65d8f0b5b04a6ff003a2626c4e031c4961842bd6bf3ff47d00f924de3af9c1e112f691a58e9700eeb542b897187ba5ffeafca52079670
6
+ metadata.gz: c325f11551adfe492248175780d855fbe2af9b09035defbb58bc62a08dc5299530d9a3ef9dddc58f772408ed4e4a1bc95c8f4a1236e060e22411f73934f565cb
7
+ data.tar.gz: a6e99efa6ae435a996aaf8035107aedda5e006732b4238af1e90406b12734955aeedfdbefc4feb23fa51d50714838775a5360b3d1ac95d45db008531827f0477
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-edgelab
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.14.1
4
+ version: 1.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edgelab
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-29 00:00:00.000000000 Z
11
+ date: 2018-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -175,9 +175,6 @@ executables:
175
175
  - check-nomad-leader.rb
176
176
  - check-swarm-cluster.rb
177
177
  - handler-multi-hipchat.rb
178
- - metrics-aws-asg.rb
179
- - metrics-aws-elb.rb
180
- - metrics-aws-rds.rb
181
178
  - metrics-cassandra-basic.rb
182
179
  - metrics-es-indices.rb
183
180
  - metrics-redis-key-pattern.rb
@@ -193,9 +190,6 @@ files:
193
190
  - bin/check-nomad-leader.rb
194
191
  - bin/check-swarm-cluster.rb
195
192
  - bin/handler-multi-hipchat.rb
196
- - bin/metrics-aws-asg.rb
197
- - bin/metrics-aws-elb.rb
198
- - bin/metrics-aws-rds.rb
199
193
  - bin/metrics-cassandra-basic.rb
200
194
  - bin/metrics-es-indices.rb
201
195
  - bin/metrics-redis-key-pattern.rb
@@ -1,158 +0,0 @@
1
- #! /usr/bin/env ruby
2
- #
3
- # asg-metrics
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
- # Returns latency statistics by default. You can specify any valid ASG metric type, see
25
- # http://http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/as-metricscollected.html
26
- #
27
- # LICENSE:
28
- # Peter Hoppe <peter.hoppe.extern@bertelsmann.de>
29
- # Released under the same terms as Sensu (the MIT license); see LICENSE
30
- # for details.
31
- #
32
-
33
- require 'sensu-plugin/metric/cli'
34
- require 'aws-sdk'
35
- require 'time'
36
-
37
- class ASGMetrics < Sensu::Plugin::Metric::CLI::Graphite
38
- option :asgname,
39
- description: 'Name of the Auto Scaling Group',
40
- short: '-n ASG_NAME',
41
- long: '--name ASG_NAME'
42
-
43
- option :scheme,
44
- description: 'Metric naming scheme, text to prepend to metric',
45
- short: '-s SCHEME',
46
- long: '--scheme SCHEME',
47
- default: ''
48
-
49
- option :fetch_age,
50
- description: 'How long ago to fetch metrics for',
51
- short: '-f AGE',
52
- long: '--fetch_age',
53
- default: 60,
54
- proc: proc(&:to_i)
55
-
56
- option :metric,
57
- description: 'Metric to fetch',
58
- short: '-m METRIC',
59
- long: '--metric',
60
- default: 'GroupInServiceInstances'
61
-
62
- option :statistic,
63
- description: 'Statistics type',
64
- short: '-t STATISTIC',
65
- long: '--statistic',
66
- default: ''
67
-
68
- option :aws_region,
69
- short: '-r AWS_REGION',
70
- long: '--aws-region REGION',
71
- description: 'AWS Region (defaults to us-east-1).',
72
- default: ENV['AWS_REGION']
73
-
74
- option :end_time,
75
- short: '-t T',
76
- long: '--end-time TIME',
77
- default: Time.now,
78
- proc: proc { |a| Time.parse a },
79
- description: 'CloudWatch metric statistics end time'
80
-
81
- option :period,
82
- short: '-p N',
83
- long: '--period SECONDS',
84
- default: 60,
85
- proc: proc(&:to_i),
86
- description: 'CloudWatch metric statistics period'
87
-
88
- def cloud_watch
89
- @cloud_watch = Aws::CloudWatch::Client.new
90
- end
91
-
92
- def asg
93
- @asg = Aws::AutoScaling::Client.new
94
- end
95
-
96
- def cloud_watch_metric(metric_name, value, asg_name)
97
- cloud_watch.get_metric_statistics(
98
- namespace: 'AWS/AutoScaling',
99
- metric_name: metric_name,
100
- dimensions: [
101
- {
102
- name: 'AutoScalingGroupName',
103
- value: asg_name
104
- }
105
- ],
106
- statistics: [value],
107
- start_time: config[:end_time] - config[:period],
108
- end_time: config[:end_time],
109
- period: config[:period]
110
- )
111
- end
112
-
113
- def print_statistics(asg_name, statistics)
114
- result = {}
115
- static_value = {}
116
- statistics.each do |key, static|
117
- r = cloud_watch_metric(key, static, asg_name)
118
- static_value['AutoScalingGroup.' + quote(asg_name) + '.' + key + '.' + static] = static
119
- result['AutoScalingGroup.' + quote(asg_name) + '.' + key + '.' + static] = r[:datapoints][0] unless r[:datapoints][0].nil?
120
- end
121
- result.each do |key, value|
122
- output config[:scheme] + '.' + key.downcase.to_s, value[static_value[key].downcase], value[:timestamp].to_i
123
- end
124
- end
125
-
126
- def quote(name)
127
- name.tr(' .', '-')
128
- end
129
-
130
- def run
131
- if config[:statistic] == ''
132
- default_statistic_per_metric = {
133
- 'GroupMinSize' => 'Sum',
134
- 'GroupMaxSize' => 'Sum',
135
- 'GroupDesiredCapacity' => 'Sum',
136
- 'GroupInServiceInstances' => 'Sum',
137
- 'GroupPendingInstances' => 'Sum',
138
- 'GroupStandbyInstances' => 'Sum',
139
- 'GroupTerminatingInstances' => 'Sum',
140
- 'GroupTotalInstances' => 'Sum'
141
- }
142
- statistic = default_statistic_per_metric
143
- else
144
- statistic = config[:statistic]
145
- end
146
-
147
- begin
148
- if config[:asgname].nil?
149
- asg.describe_auto_scaling_groups.auto_scaling_groups.each do |autoascalinggroup|
150
- print_statistics(autoascalinggroup.auto_scaling_group_name, statistic)
151
- end
152
- else
153
- print_statistics(config[:asgname], statistic)
154
- end
155
- ok
156
- end
157
- end
158
- end
@@ -1,159 +0,0 @@
1
- #! /usr/bin/env ruby
2
- #
3
- # elb-metrics
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
- # #YELLOW
22
- #
23
- # NOTES:
24
- # Returns latency statistics by default. You can specify any valid ELB metric type, see
25
- # http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/CW_Support_For_AWS.html#elb-metricscollected
26
- #
27
- # By default fetches statistics from one minute ago. You may need to fetch further back than this;
28
- # high traffic ELBs can sometimes experience statistic delays of up to 10 minutes. If you experience this,
29
- # raising a ticket with AWS support should get the problem resolved.
30
- # As a workaround you can use eg -f 300 to fetch data from 5 minutes ago.
31
- #
32
- # LICENSE:
33
- # Copyright 2013 Bashton Ltd http://www.bashton.com/
34
- # Released under the same terms as Sensu (the MIT license); see LICENSE
35
- # for details.
36
- # Updated by Peter Hoppe <peter.hoppe.extern@bertelsmann.de> 09.11.2016
37
- # Using aws sdk version 2
38
-
39
- require 'sensu-plugin/metric/cli'
40
- require 'aws-sdk'
41
- require 'time'
42
-
43
- class ELBMetrics < Sensu::Plugin::Metric::CLI::Graphite
44
- option :elbname,
45
- description: 'Name of the Elastic Load Balancer',
46
- short: '-n ELB_NAME',
47
- long: '--name ELB_NAME'
48
-
49
- option :scheme,
50
- description: 'Metric naming scheme, text to prepend to metric',
51
- short: '-s SCHEME',
52
- long: '--scheme SCHEME',
53
- default: ''
54
-
55
- option :fetch_age,
56
- description: 'How long ago to fetch metrics for',
57
- short: '-f AGE',
58
- long: '--fetch_age',
59
- default: 60,
60
- proc: proc(&:to_i)
61
-
62
- option :statistic,
63
- description: 'Statistics type',
64
- short: '-t STATISTIC',
65
- long: '--statistic',
66
- default: ''
67
-
68
- option :aws_region,
69
- short: '-r AWS_REGION',
70
- long: '--aws-region REGION',
71
- description: 'AWS Region (defaults to us-east-1).',
72
- default: ENV['AWS_REGION']
73
-
74
- option :end_time,
75
- short: '-t T',
76
- long: '--end-time TIME',
77
- default: Time.now,
78
- proc: proc { |a| Time.parse a },
79
- description: 'CloudWatch metric statistics end time'
80
-
81
- option :period,
82
- short: '-p N',
83
- long: '--period SECONDS',
84
- default: 60,
85
- proc: proc(&:to_i),
86
- description: 'CloudWatch metric statistics period'
87
-
88
- def cloud_watch
89
- @cloud_watch = Aws::CloudWatch::Client.new
90
- end
91
-
92
- def loadbalancer
93
- @loadbalancer = Aws::ElasticLoadBalancing::Client.new
94
- end
95
-
96
- def cloud_watch_metric(metric_name, value, load_balancer_name)
97
- cloud_watch.get_metric_statistics(
98
- namespace: 'AWS/ELB',
99
- metric_name: metric_name,
100
- dimensions: [
101
- {
102
- name: 'LoadBalancerName',
103
- value: load_balancer_name
104
- }
105
- ],
106
- statistics: [value],
107
- start_time: config[:end_time] - config[:period],
108
- end_time: config[:end_time],
109
- period: config[:period]
110
- )
111
- end
112
-
113
- def print_statistics(load_balancer_name, statistics)
114
- result = {}
115
- static_value = {}
116
- statistics.each do |key, static|
117
- r = cloud_watch_metric(key, static, load_balancer_name)
118
- static_value[config[:scheme] + '.' + 'loadbalancer.' + load_balancer_name + '.' + key + '.' + static] = static
119
- result[config[:scheme] + '.' + 'loadbalancer.' + load_balancer_name + '.' + key + '.' + static] = r[:datapoints][0] unless r[:datapoints][0].nil?
120
- end
121
- result.each do |key, value|
122
- output key.downcase.to_s, value[static_value[key].downcase], value[:timestamp].to_i
123
- end
124
- end
125
-
126
- def run
127
- if config[:statistic] == ''
128
- default_statistic_per_metric = {
129
- 'Latency' => 'Average',
130
- 'RequestCount' => 'Sum',
131
- 'UnHealthyHostCount' => 'Average',
132
- 'HealthyHostCount' => 'Average',
133
- 'HTTPCode_Backend_2XX' => 'Sum',
134
- 'HTTPCode_Backend_3XX' => 'Sum',
135
- 'HTTPCode_Backend_4XX' => 'Sum',
136
- 'HTTPCode_Backend_5XX' => 'Sum',
137
- 'HTTPCode_ELB_4XX' => 'Sum',
138
- 'HTTPCode_ELB_5XX' => 'Sum',
139
- 'BackendConnectionErrors' => 'Sum',
140
- 'SurgeQueueLength' => 'Maximum',
141
- 'SpilloverCount' => 'Sum'
142
- }
143
- statistic = default_statistic_per_metric
144
- else
145
- statistic = config[:statistic]
146
- end
147
-
148
- begin
149
- if config[:elbname].nil?
150
- loadbalancer.describe_load_balancers.load_balancer_descriptions.each do |elb|
151
- print_statistics(elb.load_balancer_name, statistic)
152
- end
153
- else
154
- print_statistics(config[:elbname], statistic)
155
- end
156
- ok
157
- end
158
- end
159
- end
@@ -1,136 +0,0 @@
1
- #! /usr/bin/env ruby
2
- #
3
- # rds-metrics
4
- #
5
- # DESCRIPTION:
6
- # Gets RDS 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: sensu-plugin
16
- #
17
- # USAGE:
18
- # rds-metrics --aws-region eu-west-1
19
- # rds-metrics --aws-region eu-west-1 --name sr2x8pbti0eon1
20
- #
21
- # NOTES:
22
- # Returns all RDS statistics for all RDS instances in this account unless you specify --name
23
- #
24
- # LICENSE:
25
- # Peter Hoppe <peter.hoppe.extern@bertelsmann.de>
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 'time'
33
-
34
- class RDSMetrics < Sensu::Plugin::Metric::CLI::Graphite
35
- option :aws_region,
36
- short: '-r AWS_REGION',
37
- long: '--aws-region REGION',
38
- description: 'AWS Region (defaults to us-east-1).',
39
- default: ENV['AWS_REGION']
40
-
41
- option :db_instance_id,
42
- short: '-i N',
43
- long: '--db-instance-id NAME',
44
- description: 'DB instance identifier'
45
-
46
- option :end_time,
47
- short: '-t T',
48
- long: '--end-time TIME',
49
- default: Time.now,
50
- proc: proc { |a| Time.parse a },
51
- description: 'CloudWatch metric statistics end time'
52
-
53
- option :period,
54
- short: '-p N',
55
- long: '--period SECONDS',
56
- default: 60,
57
- proc: proc(&:to_i),
58
- description: 'CloudWatch metric statistics period'
59
-
60
- option :statistics,
61
- short: '-S N',
62
- long: '--statistics NAME',
63
- default: :average,
64
- proc: proc { |a| a.downcase.intern },
65
- description: 'CloudWatch statistics method'
66
-
67
- option :scheme,
68
- description: 'Metric naming scheme, text to prepend to metric',
69
- short: '-s SCHEME',
70
- long: '--scheme SCHEME',
71
- default: ''
72
-
73
- def rds
74
- @rds = Aws::RDS::Client.new
75
- end
76
-
77
- def cloud_watch
78
- @cloud_watch = Aws::CloudWatch::Client.new
79
- end
80
-
81
- def find_db_instance(id)
82
- db = rds.describe_db_instances.db_instances.detect { |db_instance| db_instance.db_instance_identifier == id }
83
- unknown 'DB instance not found.' if db.nil?
84
- db
85
- end
86
-
87
- def cloud_watch_metric(metric_name, value)
88
- cloud_watch.get_metric_statistics(
89
- namespace: 'AWS/RDS',
90
- metric_name: metric_name,
91
- dimensions: [
92
- {
93
- name: 'DBInstanceIdentifier',
94
- value: value
95
- }
96
- ],
97
- start_time: config[:end_time] - config[:period],
98
- end_time: config[:end_time],
99
- statistics: [config[:statistics].to_s.capitalize],
100
- period: config[:period]
101
- )
102
- end
103
-
104
- def run
105
- statistic_type = {
106
- 'CPUUtilization' => 'Average',
107
- 'DatabaseConnections' => 'Average',
108
- 'FreeStorageSpace' => 'Average',
109
- 'ReadIOPS' => 'Average',
110
- 'ReadLatency' => 'Average',
111
- 'ReadThroughput' => 'Average',
112
- 'WriteIOPS' => 'Average',
113
- 'WriteLatency' => 'Average',
114
- 'WriteThroughput' => 'Average',
115
- 'ReplicaLag' => 'Average',
116
- 'SwapUsage' => 'Average',
117
- 'BinLogDiskUsage' => 'Average',
118
- 'DiskQueueDepth' => 'Average'
119
- }
120
-
121
- @db_instance = find_db_instance config[:db_instance_id]
122
- @message = "#{config[:db_instance_id]}: "
123
-
124
- result = {}
125
-
126
- rdsname = @db_instance.db_instance_identifier
127
-
128
- statistic_type.each do |key, _value|
129
- r = cloud_watch_metric key, rdsname
130
- result[config[:scheme] + '.' + rdsname + '.' + key] = r[:datapoints][0] unless r[:datapoints][0].nil?
131
- end
132
- result.each do |key, value|
133
- output key.to_s, value.average, value[:timestamp].to_i
134
- end
135
- end
136
- end