sensu-plugins-aws 1.2.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +1 -2
- data.tar.gz.sig +0 -0
- data/CHANGELOG.md +22 -0
- data/README.md +17 -1
- data/bin/check-cloudwatch-alarm.rb +104 -0
- data/bin/check-dynamodb-capacity.rb +1 -1
- data/bin/check-ec2-filter.rb +1 -1
- data/bin/check-elb-certs.rb +3 -3
- data/bin/check-elb-latency.rb +6 -6
- data/bin/check-elb-nodes.rb +1 -1
- data/bin/check-elb-sum-requests.rb +7 -7
- data/bin/check-emr-cluster.rb +147 -0
- data/bin/check-instance-events.rb +1 -1
- data/bin/check-rds-events.rb +1 -1
- data/bin/check-rds.rb +22 -11
- data/bin/check-s3-bucket.rb +89 -0
- data/bin/check-s3-object.rb +130 -0
- data/bin/check-vpc-vpn.rb +105 -0
- data/bin/handler-ec2_node.rb +1 -1
- data/bin/metrics-elb.rb +1 -1
- data/bin/metrics-sqs.rb +1 -1
- data/lib/sensu-plugins-aws/filter.rb +1 -1
- data/lib/sensu-plugins-aws/version.rb +2 -2
- metadata +18 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c473f07fdfd3b231afb1ee7a16efaf19d144e9dc
|
4
|
+
data.tar.gz: fde2609d9d3484ed097f308a8887b33ff321f669
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3519003d61b1ae11cfc6826fd41ae5e1f98af4f252f1f837086e07628b270f1fec262c21fe0d3ccbd175e70fc92526073339c8cee7399ce8339a9ffcfa68abbc
|
7
|
+
data.tar.gz: 921cfa3c2502d94e4b7a1318d7d2be15579be041b85cc15ea90b27939a30bf625b0063db9dfa46a14e3d8020f23faf3dc36d482c4b1fa1ab5fa06821d4be82b9
|
checksums.yaml.gz.sig
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
��j8���?A���tN�\�U�ӫvo�Rw*ƚ��M�'�kU<������j�Q�=���$ ���穏�}�g��F�I���+�k�w�;���e��`���+~_�����&�������,�6Bۣ>�^�������}���,X��`�)D��
|
1
|
+
�1V����M�u>��Mo���]ƃ�b'32�����A`�4%>e��bO��ʢ*�'���/�09�+dX�j�}?7[�sd����eW�31嗁v'�U�C���}�6^�um�_�+�}�_MHȇ����O`,/�x!v�0rY�5�r�ڻ����-MӔD_���=V�9`5O�S9�[F=�#��Va�����e�w��m�&q-"���5��9�(}�M�CM��!����&��x0у̙С�+0t����
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,28 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
3
3
|
|
4
4
|
This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
|
5
5
|
|
6
|
+
## Unreleased
|
7
|
+
|
8
|
+
## [2.0.0] - 2015-11-02
|
9
|
+
|
10
|
+
WARNING: This release drops support for Ruby 1.9.3, which is EOL as of 2015-02.
|
11
|
+
|
12
|
+
### Added
|
13
|
+
- Added check-cloudwatch-alarm to get alarm status
|
14
|
+
- Added connection metric for check-rds.rb
|
15
|
+
- Added check-s3-bucket that checks S3 bucket existence
|
16
|
+
- Added check-s3-object that checks S3 object existence
|
17
|
+
- Added check-emr-cluster that checks EMR cluster existence
|
18
|
+
- Added check-vpc-vpn that checks the health of VPC VPN connections
|
19
|
+
|
20
|
+
### Fixed
|
21
|
+
- handler-ec2_node checks for state_reason being nil prior to code access
|
22
|
+
- Cosmetic fixes to metrics-elb, check-rds, and check-rds-events
|
23
|
+
- Return correct metrics values in check-elb-sum-requests
|
24
|
+
|
25
|
+
### Removed
|
26
|
+
- Removed Ruby 1.9.3 support
|
27
|
+
|
6
28
|
## [1.2.0] - 2015-08-04
|
7
29
|
### Added
|
8
30
|
- Added check-ec2-filter to compare filter results to given thresholds
|
data/README.md
CHANGED
@@ -11,6 +11,8 @@
|
|
11
11
|
|
12
12
|
**check-autoscaling-cpucredits.rb**
|
13
13
|
|
14
|
+
**check-cloudwatch-alarm**
|
15
|
+
|
14
16
|
**check-dynamodb-capacity.rb**
|
15
17
|
|
16
18
|
**check-dynamodb-throttle.rb**
|
@@ -37,6 +39,8 @@
|
|
37
39
|
|
38
40
|
**check-elb-sum-requests.rb**
|
39
41
|
|
42
|
+
**check-emr-cluster.rb**
|
43
|
+
|
40
44
|
**check-instance-events.rb**
|
41
45
|
|
42
46
|
**check-rds-events.rb**
|
@@ -45,6 +49,10 @@
|
|
45
49
|
|
46
50
|
**check-redshift-events.rb**
|
47
51
|
|
52
|
+
**check-s3-bucket.rb**
|
53
|
+
|
54
|
+
**check-s3-object.rb**
|
55
|
+
|
48
56
|
**check-ses-limit.rb**
|
49
57
|
|
50
58
|
**check-sqs-messages.rb**
|
@@ -53,6 +61,8 @@
|
|
53
61
|
|
54
62
|
**check_vpc_vpn.py**
|
55
63
|
|
64
|
+
**check-vpc-vpn.rb**
|
65
|
+
|
56
66
|
**handler-ec2_node.rb**
|
57
67
|
|
58
68
|
**handler-ses.rb**
|
@@ -77,6 +87,7 @@
|
|
77
87
|
## Files
|
78
88
|
|
79
89
|
* /bin/check-autoscaling-cpucredits.rb
|
90
|
+
* /bin/check-cloudwatch-alarm.rb
|
80
91
|
* /bin/check-dynamodb-capacity.rb
|
81
92
|
* /bin/check-dynamodb-throttle.rb
|
82
93
|
* /bin/check-ebs-snapshots.rb
|
@@ -89,14 +100,17 @@
|
|
89
100
|
* /bin/check-elb-latency.rb
|
90
101
|
* /bin/check-elb-nodes.rb
|
91
102
|
* /bin/check-elb-sum-requests.rb
|
103
|
+
* /bin/check-emr-cluster.rb
|
92
104
|
* /bin/check-instance-events.rb
|
93
105
|
* /bin/check-rds-events.rb
|
94
106
|
* /bin/check-rds.rb
|
95
107
|
* /bin/check-redshift-events.rb
|
108
|
+
* /bin/check-s3-object.rb
|
96
109
|
* /bin/check-ses-limit.rb
|
97
110
|
* /bin/check-sqs-messages.rb
|
98
111
|
* /bin/check-vpc-nameservers.rb
|
99
112
|
* /bin/check_vpc_vpn.py
|
113
|
+
* /bin/check_vpc_vpn.rb
|
100
114
|
* /bin/handler-ec2_node.rb
|
101
115
|
* /bin/handler-ses.rb
|
102
116
|
* /bin/handler-sns.rb
|
@@ -142,4 +156,6 @@
|
|
142
156
|
```
|
143
157
|
## Installation
|
144
158
|
|
145
|
-
[Installation and Setup](
|
159
|
+
[Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html)
|
160
|
+
|
161
|
+
Note: In addition to the standard installation requirements the installation of this gem will require compiling the nokogiri gem. Due to this you'll need certain developmemnt packages on your system. On Ubuntu systems install build-essential, libxml2-dev and zlib1g-dev. On CentOS install gcc and zlib-devel.
|
@@ -0,0 +1,104 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# check-cloudwatch-alarm
|
4
|
+
#
|
5
|
+
# DESCRIPTION:
|
6
|
+
# This plugin retrieves the state of a CloudWatch alarm. Can be configured
|
7
|
+
# to trigger a warning or critical based on the result. Defaults to OK unless
|
8
|
+
# alarm is missing
|
9
|
+
#
|
10
|
+
# OUTPUT:
|
11
|
+
# plain-text
|
12
|
+
#
|
13
|
+
# PLATFORMS:
|
14
|
+
# Linux
|
15
|
+
#
|
16
|
+
# DEPENDENCIES:
|
17
|
+
# gem: aws-sdk
|
18
|
+
# gem: sensu-plugin
|
19
|
+
#
|
20
|
+
# USAGE:
|
21
|
+
# ./check-cloudwatch-alarm -n TestAlarm
|
22
|
+
# ./check-cloudwatch-alarm -c Alarm,INSUFFICIENT_DATA -n TestAlarm
|
23
|
+
# ./check-cloudwatch-alarm -c Alarm -w INSUFFICIENT_DATA -n TestAlarm
|
24
|
+
#
|
25
|
+
# NOTES:
|
26
|
+
#
|
27
|
+
# LICENSE:
|
28
|
+
# Justin McCarty
|
29
|
+
# Released under the same terms as Sensu (the MIT license); see LICENSE
|
30
|
+
# for details.
|
31
|
+
#
|
32
|
+
|
33
|
+
require 'sensu-plugin/check/cli'
|
34
|
+
require 'aws-sdk'
|
35
|
+
|
36
|
+
class CloudWatchCheck < Sensu::Plugin::Check::CLI
|
37
|
+
option :aws_access_key,
|
38
|
+
short: '-a AWS_ACCESS_KEY',
|
39
|
+
long: '--aws-access-key AWS_ACCESS_KEY',
|
40
|
+
description: "AWS Access Key. Either set ENV['AWS_ACCESS_KEY'] or provide it as an option",
|
41
|
+
default: ENV['AWS_ACCESS_KEY']
|
42
|
+
|
43
|
+
option :aws_secret_access_key,
|
44
|
+
short: '-k AWS_SECRET_KEY',
|
45
|
+
long: '--aws-secret-access-key AWS_SECRET_KEY',
|
46
|
+
description: "AWS Secret Access Key. Either set ENV['AWS_SECRET_KEY'] or provide it as an option",
|
47
|
+
default: ENV['AWS_SECRET_KEY']
|
48
|
+
|
49
|
+
option :aws_region,
|
50
|
+
short: '-r AWS_REGION',
|
51
|
+
long: '--aws-region REGION',
|
52
|
+
description: 'AWS Region (defaults to us-east-1).',
|
53
|
+
default: 'us-east-1'
|
54
|
+
|
55
|
+
option :name,
|
56
|
+
description: 'Alarm name',
|
57
|
+
short: '-n NAME',
|
58
|
+
long: '--name NAME',
|
59
|
+
default: ''
|
60
|
+
|
61
|
+
option :critical,
|
62
|
+
description: 'Critical List',
|
63
|
+
short: '-c Criticals',
|
64
|
+
long: '--critical',
|
65
|
+
default: ''
|
66
|
+
|
67
|
+
option :warning,
|
68
|
+
description: 'Warning state threshold',
|
69
|
+
short: '-w THRESHOLD',
|
70
|
+
long: '--warning THRESHOLD',
|
71
|
+
default: ''
|
72
|
+
|
73
|
+
def aws_config
|
74
|
+
{ access_key_id: config[:aws_access_key],
|
75
|
+
secret_access_key: config[:aws_secret_access_key],
|
76
|
+
region: config[:aws_region]
|
77
|
+
}
|
78
|
+
end
|
79
|
+
|
80
|
+
def run
|
81
|
+
client = Aws::CloudWatch::Client.new aws_config
|
82
|
+
|
83
|
+
options = { alarm_names: [config[:name]] }
|
84
|
+
data = client.describe_alarms(options)
|
85
|
+
|
86
|
+
if data.metric_alarms.empty?
|
87
|
+
unknown 'Unable to find alarm'
|
88
|
+
end
|
89
|
+
|
90
|
+
message = "Alarm State: #{data.metric_alarms[0].state_value}"
|
91
|
+
|
92
|
+
if config[:critical].upcase.split(',').include? data.metric_alarms[0].state_value
|
93
|
+
critical message
|
94
|
+
elsif config[:warning].upcase.split(',').include? data.metric_alarms[0].state_value
|
95
|
+
warning message
|
96
|
+
end
|
97
|
+
|
98
|
+
ok message
|
99
|
+
|
100
|
+
rescue => e
|
101
|
+
puts "Error: exception: #{e}"
|
102
|
+
critical
|
103
|
+
end
|
104
|
+
end
|
@@ -155,7 +155,7 @@ class CheckDynamoDB < Sensu::Plugin::Check::CLI
|
|
155
155
|
threshold = config[:"#{severity}_over"]
|
156
156
|
next unless threshold
|
157
157
|
next if percentage < threshold
|
158
|
-
flag_alert severity, "; On table #{table.name} consumed #{r_or_w} capacity is #{sprintf '%.2f', percentage}% (expected_lower_than #{threshold})"
|
158
|
+
flag_alert severity, "; On table #{table.name} consumed #{r_or_w} capacity is #{sprintf '%.2f', percentage}% (expected_lower_than #{threshold})"
|
159
159
|
break
|
160
160
|
end
|
161
161
|
end
|
data/bin/check-ec2-filter.rb
CHANGED
data/bin/check-elb-certs.rb
CHANGED
@@ -86,7 +86,7 @@ class CheckELBCerts < Sensu::Plugin::Check::CLI
|
|
86
86
|
}
|
87
87
|
end
|
88
88
|
|
89
|
-
def run
|
89
|
+
def run
|
90
90
|
ok_message = []
|
91
91
|
warning_message = []
|
92
92
|
critical_message = []
|
@@ -97,7 +97,7 @@ class CheckELBCerts < Sensu::Plugin::Check::CLI
|
|
97
97
|
|
98
98
|
begin
|
99
99
|
elb.load_balancers.each do |lb|
|
100
|
-
lb.listeners.each do |listener|
|
100
|
+
lb.listeners.each do |listener|
|
101
101
|
if listener.protocol.to_s == 'https'
|
102
102
|
url = URI.parse("https://#{lb.dns_name}:#{listener.port}")
|
103
103
|
http = Net::HTTP.new(url.host, url.port)
|
@@ -112,7 +112,7 @@ class CheckELBCerts < Sensu::Plugin::Check::CLI
|
|
112
112
|
end
|
113
113
|
|
114
114
|
cert_days_remaining = ((cert.not_after - Time.now) / 86_400).to_i
|
115
|
-
message = sprintf '%s(%d)', lb.name, cert_days_remaining
|
115
|
+
message = sprintf '%s(%d)', lb.name, cert_days_remaining
|
116
116
|
|
117
117
|
if config[:crit_under] > 0 && config[:crit_under] >= cert_days_remaining
|
118
118
|
critical_message << message
|
data/bin/check-elb-latency.rb
CHANGED
@@ -144,17 +144,17 @@ class CheckELBLatency < Sensu::Plugin::Check::CLI
|
|
144
144
|
next unless threshold
|
145
145
|
next if metric_value < threshold
|
146
146
|
flag_alert severity,
|
147
|
-
"; #{elbs.size == 1 ? nil : "#{elb.inspect}'s"} Latency is #{sprintf '%.3f', metric_value} seconds. (expected lower than #{sprintf '%.3f', threshold})"
|
147
|
+
"; #{elbs.size == 1 ? nil : "#{elb.inspect}'s"} Latency is #{sprintf '%.3f', metric_value} seconds. (expected lower than #{sprintf '%.3f', threshold})"
|
148
148
|
break
|
149
149
|
end
|
150
150
|
end
|
151
151
|
|
152
152
|
def run
|
153
|
-
@message
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
153
|
+
@message = if elbs.size == 1
|
154
|
+
elbs.first.inspect
|
155
|
+
else
|
156
|
+
"#{elbs.size} load balancers total"
|
157
|
+
end
|
158
158
|
|
159
159
|
@severities = {
|
160
160
|
critical: false,
|
data/bin/check-elb-nodes.rb
CHANGED
@@ -126,14 +126,14 @@ class CheckELBSumRequests < Sensu::Plugin::Check::CLI
|
|
126
126
|
def check_sum_requests(elb)
|
127
127
|
metric = latency_metric elb.name
|
128
128
|
metric_value = begin
|
129
|
-
|
130
|
-
puts value
|
129
|
+
latest_value metric
|
131
130
|
rescue
|
132
131
|
0
|
133
132
|
end
|
134
133
|
|
135
134
|
@severities.keys.each do |severity|
|
136
135
|
threshold = config[:"#{severity}_over"]
|
136
|
+
puts metric_value
|
137
137
|
next unless threshold
|
138
138
|
next if metric_value < threshold
|
139
139
|
flag_alert severity,
|
@@ -143,11 +143,11 @@ class CheckELBSumRequests < Sensu::Plugin::Check::CLI
|
|
143
143
|
end
|
144
144
|
|
145
145
|
def run
|
146
|
-
@message
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
146
|
+
@message = if elbs.size == 1
|
147
|
+
elbs.first.inspect
|
148
|
+
else
|
149
|
+
"#{elbs.size} load balancers total"
|
150
|
+
end
|
151
151
|
|
152
152
|
@severities = {
|
153
153
|
critical: false,
|
@@ -0,0 +1,147 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# check-emr-cluster
|
4
|
+
#
|
5
|
+
# DESCRIPTION:
|
6
|
+
# This plugin checks if a cluster exists.
|
7
|
+
#
|
8
|
+
# OUTPUT:
|
9
|
+
# plain-text
|
10
|
+
#
|
11
|
+
# PLATFORMS:
|
12
|
+
# Linux
|
13
|
+
#
|
14
|
+
# DEPENDENCIES:
|
15
|
+
# gem: aws-sdk
|
16
|
+
# gem: sensu-plugin
|
17
|
+
#
|
18
|
+
# USAGE:
|
19
|
+
# ./check-emr-cluster.rb --cluster-name MyCluster --aws-region eu-west-1 --use-iam --warning-over 14400 --critical-over 21600
|
20
|
+
#
|
21
|
+
# NOTES:
|
22
|
+
#
|
23
|
+
# LICENSE:
|
24
|
+
# Copyright (c) 2015, Olivier Bazoud, olivier.bazoud@gmail.com
|
25
|
+
# Released under the same terms as Sensu (the MIT license); see LICENSE
|
26
|
+
# for details.
|
27
|
+
#
|
28
|
+
|
29
|
+
require 'sensu-plugin/check/cli'
|
30
|
+
require 'aws-sdk'
|
31
|
+
|
32
|
+
class CheckEMRCluster < Sensu::Plugin::Check::CLI
|
33
|
+
option :aws_access_key,
|
34
|
+
short: '-a AWS_ACCESS_KEY',
|
35
|
+
long: '--aws-access-key AWS_ACCESS_KEY',
|
36
|
+
description: "AWS Access Key. Either set ENV['AWS_ACCESS_KEY'] or provide it as an option",
|
37
|
+
default: ENV['AWS_ACCESS_KEY']
|
38
|
+
|
39
|
+
option :aws_secret_access_key,
|
40
|
+
short: '-k AWS_SECRET_KEY',
|
41
|
+
long: '--aws-secret-access-key AWS_SECRET_KEY',
|
42
|
+
description: "AWS Secret Access Key. Either set ENV['AWS_SECRET_KEY'] or provide it as an option",
|
43
|
+
default: ENV['AWS_SECRET_KEY']
|
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 :use_iam_role,
|
52
|
+
short: '-u',
|
53
|
+
long: '--use-iam',
|
54
|
+
description: 'Use IAM role authenticiation. Instance must have IAM role assigned for this to work'
|
55
|
+
|
56
|
+
option :cluster_name,
|
57
|
+
short: '-b CLUSTER_NAME',
|
58
|
+
long: '--cluster-name',
|
59
|
+
description: 'The name of the EMR cluster',
|
60
|
+
required: true
|
61
|
+
|
62
|
+
option :warning_over,
|
63
|
+
description: 'Warn if cluster\'s age is greater than provided age in seconds',
|
64
|
+
short: '-w SECONDS',
|
65
|
+
long: '--warning-over SECONDS',
|
66
|
+
default: -1,
|
67
|
+
proc: proc(&:to_i)
|
68
|
+
|
69
|
+
option :critical_over,
|
70
|
+
description: 'Critical if cluster\'s age is greater than provided age in seconds',
|
71
|
+
short: '-c SECONDS',
|
72
|
+
long: '--critical-over SECONDS',
|
73
|
+
default: -1,
|
74
|
+
proc: proc(&:to_i)
|
75
|
+
|
76
|
+
option :warning_under,
|
77
|
+
description: 'Warn if cluster\'s age is lower than provided age in seconds',
|
78
|
+
short: '-w SECONDS',
|
79
|
+
long: '--warning-under SECONDS',
|
80
|
+
default: -1,
|
81
|
+
proc: proc(&:to_i)
|
82
|
+
|
83
|
+
option :critical_under,
|
84
|
+
description: 'Critical if cluster\'s age is lower than provided age in seconds',
|
85
|
+
short: '-C SECONDS',
|
86
|
+
long: '--critical-under SECONDS',
|
87
|
+
default: -1,
|
88
|
+
proc: proc(&:to_i)
|
89
|
+
|
90
|
+
def aws_config
|
91
|
+
{ access_key_id: config[:aws_access_key],
|
92
|
+
secret_access_key: config[:aws_secret_access_key],
|
93
|
+
region: config[:aws_region]
|
94
|
+
}
|
95
|
+
end
|
96
|
+
|
97
|
+
def humanize(secs)
|
98
|
+
[[60, :seconds], [60, :minutes], [24, :hours], [1000, :days]].map do |count, name|
|
99
|
+
if secs > 0
|
100
|
+
secs, n = secs.divmod(count)
|
101
|
+
"#{n.to_i} #{name}"
|
102
|
+
end
|
103
|
+
end.compact.reverse.join(' ')
|
104
|
+
end
|
105
|
+
|
106
|
+
def run
|
107
|
+
aws_config = {}
|
108
|
+
if config[:use_iam_role].nil?
|
109
|
+
aws_config.merge!(
|
110
|
+
access_key_id: config[:aws_access_key],
|
111
|
+
secret_access_key: config[:aws_secret_access_key]
|
112
|
+
)
|
113
|
+
end
|
114
|
+
|
115
|
+
emr = Aws::EMR::Client.new(aws_config.merge!(region: config[:aws_region]))
|
116
|
+
begin
|
117
|
+
emr_clusters = emr.list_clusters(created_after: Time.now - 24 * 60 * 60, created_before: Time.now).clusters
|
118
|
+
clusters = emr_clusters.select { |c| c.name == config[:cluster_name] }
|
119
|
+
|
120
|
+
critical "EMR cluster #{config[:cluster_name]} appears #{clusters.size} times" if clusters.size > 1
|
121
|
+
critical "EMR cluster #{config[:cluster_name]} not found" if clusters.size == 0
|
122
|
+
|
123
|
+
cluster = clusters.first
|
124
|
+
state = cluster.status.state
|
125
|
+
if state == 'TERMINATED_WITH_ERRORS'
|
126
|
+
critical "EMR cluster #{config[:cluster_name]} state is '#{state}'"
|
127
|
+
else
|
128
|
+
creation_date_time = cluster.status.timeline.creation_date_time
|
129
|
+
end_date_time = cluster.status.timeline.end_date_time || Time.now
|
130
|
+
age = end_date_time.to_i - creation_date_time.to_i
|
131
|
+
if age >= config[:critical_over]
|
132
|
+
critical "EMR cluster #{config[:cluster_name]} - #{humanize(age)} vs. #{humanize(config[:critical_over])}"
|
133
|
+
elsif age >= config[:warning_over]
|
134
|
+
warning "EMR cluster #{config[:cluster_name]} - #{humanize(age)} vs. #{humanize(config[:warning_over])}"
|
135
|
+
elsif age <= config[:critical_under] && state == 'TERMINATED'
|
136
|
+
critical "EMR cluster #{config[:cluster_name]} - #{humanize(age)} vs. #{humanize(config[:critical_under])}"
|
137
|
+
elsif age <= config[:warning_under] && state == 'TERMINATED'
|
138
|
+
warning "EMR cluster #{config[:cluster_name]} - #{humanize(age)} vs. #{humanize(config[:warning_under])}"
|
139
|
+
else
|
140
|
+
ok "EMR cluster #{config[:cluster_name]} - #{humanize(age)}"
|
141
|
+
end
|
142
|
+
end
|
143
|
+
rescue => e
|
144
|
+
critical "EMR cluster #{config[:cluster_name]} - #{e.message}"
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
data/bin/check-rds-events.rb
CHANGED
@@ -20,7 +20,7 @@
|
|
20
20
|
# gem: sensu-plugin
|
21
21
|
#
|
22
22
|
# USAGE:
|
23
|
-
# ./check-rds-events.rb -r ${
|
23
|
+
# ./check-rds-events.rb -r ${your_region} -k ${your_aws_secret_access_key} -a ${your_aws_access_key}
|
24
24
|
#
|
25
25
|
# NOTES:
|
26
26
|
#
|
data/bin/check-rds.rb
CHANGED
@@ -25,6 +25,9 @@
|
|
25
25
|
# Critical if CPUUtilization is over 90%, maximum of last one hour
|
26
26
|
# check-rds -i sensu-admin-db --cpu-critical-over 90 --statistics maximum --period 3600
|
27
27
|
#
|
28
|
+
# Warning if DatabaseConnections are over 100, critical over 120
|
29
|
+
# check-rds -i sensu-admin-db --connections-critical-over 120 --connections-warning-over 100 --statistics maximum --period 3600
|
30
|
+
#
|
28
31
|
# Warning if memory usage is over 80%, maximum of last 2 hour
|
29
32
|
# specifying "minimum" is intended actually since memory usage is calculated from CloudWatch "FreeableMemory" metric.
|
30
33
|
# check-rds -i sensu-admin-db --memory-warning-over 80 --statistics minimum --period 7200
|
@@ -37,7 +40,7 @@
|
|
37
40
|
#
|
38
41
|
# You can ignore accept nil values returned for a time periods from Cloudwatch as being an OK. Amazon falls behind in their
|
39
42
|
# metrics from time to time and this prevents false positives
|
40
|
-
# check-rds -i sensu-admin-db --cpu-critical-over 90 -
|
43
|
+
# check-rds -i sensu-admin-db --cpu-critical-over 90 -n
|
41
44
|
#
|
42
45
|
# NOTES:
|
43
46
|
#
|
@@ -107,7 +110,7 @@ class CheckRDS < Sensu::Plugin::Check::CLI
|
|
107
110
|
long: "--availability-zone-#{severity} AZ",
|
108
111
|
description: "Trigger a #{severity} if availability zone is different than given argument"
|
109
112
|
|
110
|
-
%w(cpu memory disk).each do |item|
|
113
|
+
%w(cpu memory disk connections).each do |item|
|
111
114
|
option :"#{item}_#{severity}_over",
|
112
115
|
long: "--#{item}-#{severity}-over N",
|
113
116
|
proc: proc(&:to_f),
|
@@ -156,7 +159,7 @@ class CheckRDS < Sensu::Plugin::Check::CLI
|
|
156
159
|
|
157
160
|
# handle time periods that are too small to return usable values. # this is a cozy addition that wouldn't port upstream.
|
158
161
|
if values.empty?
|
159
|
-
config[:accept_nil] ? ok('Cloudwatch returned no results for time period. Accept nil passed so OK') : unknown('Requested time period did not return values from Cloudwatch. Try increasing your time period.')
|
162
|
+
config[:accept_nil] ? ok('Cloudwatch returned no results for time period. Accept nil passed so OK') : unknown('Requested time period did not return values from Cloudwatch. Try increasing your time period.')
|
160
163
|
else
|
161
164
|
values.last[config[:statistics]]
|
162
165
|
end
|
@@ -187,9 +190,10 @@ class CheckRDS < Sensu::Plugin::Check::CLI
|
|
187
190
|
'db.m1.medium' => 3.75,
|
188
191
|
'db.m1.large' => 7.5,
|
189
192
|
'db.m1.xlarge' => 15.0,
|
190
|
-
'db.t2.micro'
|
191
|
-
'db.t2.small'
|
192
|
-
'db.t2.medium'
|
193
|
+
'db.t2.micro' => 1,
|
194
|
+
'db.t2.small' => 2,
|
195
|
+
'db.t2.medium' => 4,
|
196
|
+
'db.t2.large' => 8
|
193
197
|
}
|
194
198
|
|
195
199
|
memory_total_gigabytes.fetch(instance_class) * 1024**3
|
@@ -204,7 +208,7 @@ class CheckRDS < Sensu::Plugin::Check::CLI
|
|
204
208
|
@cpu_metric ||= cloud_watch_metric 'CPUUtilization'
|
205
209
|
@cpu_metric_value ||= latest_value @cpu_metric, 'Percent'
|
206
210
|
return if @cpu_metric_value < expected_lower_than
|
207
|
-
flag_alert severity, "; CPUUtilization is #{sprintf '%.2f', @cpu_metric_value}% (expected lower than #{expected_lower_than}%)"
|
211
|
+
flag_alert severity, "; CPUUtilization is #{sprintf '%.2f', @cpu_metric_value}% (expected lower than #{expected_lower_than}%)"
|
208
212
|
end
|
209
213
|
|
210
214
|
def check_memory(severity, expected_lower_than)
|
@@ -214,7 +218,7 @@ class CheckRDS < Sensu::Plugin::Check::CLI
|
|
214
218
|
@memory_usage_bytes ||= @memory_total_bytes - @memory_metric_value
|
215
219
|
@memory_usage_percentage ||= @memory_usage_bytes / @memory_total_bytes * 100
|
216
220
|
return if @memory_usage_percentage < expected_lower_than
|
217
|
-
flag_alert severity, "; Memory usage is #{sprintf '%.2f', @memory_usage_percentage}% (expected lower than #{expected_lower_than}%)"
|
221
|
+
flag_alert severity, "; Memory usage is #{sprintf '%.2f', @memory_usage_percentage}% (expected lower than #{expected_lower_than}%)"
|
218
222
|
end
|
219
223
|
|
220
224
|
def check_disk(severity, expected_lower_than)
|
@@ -224,7 +228,14 @@ class CheckRDS < Sensu::Plugin::Check::CLI
|
|
224
228
|
@disk_usage_bytes ||= @disk_total_bytes - @disk_metric_value
|
225
229
|
@disk_usage_percentage ||= @disk_usage_bytes / @disk_total_bytes * 100
|
226
230
|
return if @disk_usage_percentage < expected_lower_than
|
227
|
-
flag_alert severity, "; Disk usage is #{sprintf '%.2f', @disk_usage_percentage}% (expected lower than #{expected_lower_than}%)"
|
231
|
+
flag_alert severity, "; Disk usage is #{sprintf '%.2f', @disk_usage_percentage}% (expected lower than #{expected_lower_than}%)"
|
232
|
+
end
|
233
|
+
|
234
|
+
def check_connections(severity, expected_lower_than)
|
235
|
+
@connections_metric ||= cloud_watch_metric 'DatabaseConnections'
|
236
|
+
@connections_metric_value ||= latest_value @connections_metric, 'Count'
|
237
|
+
return if @connections_metric_value < expected_lower_than
|
238
|
+
flag_alert severity, "; DatabaseConnections are #{sprintf '%d', @connections_metric_value} (expected lower than #{expected_lower_than})"
|
228
239
|
end
|
229
240
|
|
230
241
|
def run
|
@@ -242,12 +253,12 @@ class CheckRDS < Sensu::Plugin::Check::CLI
|
|
242
253
|
@severities.keys.each do |severity|
|
243
254
|
check_az severity, config[:"availability_zone_#{severity}"] if config[:"availability_zone_#{severity}"]
|
244
255
|
|
245
|
-
%w(cpu memory disk).each do |item|
|
256
|
+
%w(cpu memory disk connections).each do |item|
|
246
257
|
send "check_#{item}", severity, config[:"#{item}_#{severity}_over"] if config[:"#{item}_#{severity}_over"]
|
247
258
|
end
|
248
259
|
end
|
249
260
|
|
250
|
-
if %w(cpu memory disk).any? { |item| %w(warning critical).any? { |severity| config[:"#{item}_#{severity}_over"] } }
|
261
|
+
if %w(cpu memory disk connections).any? { |item| %w(warning critical).any? { |severity| config[:"#{item}_#{severity}_over"] } }
|
251
262
|
@message += "(#{config[:statistics].to_s.capitalize} within #{config[:period]}s "
|
252
263
|
@message += "between #{config[:end_time] - config[:period]} to #{config[:end_time]})"
|
253
264
|
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# check-s3-bucket
|
4
|
+
#
|
5
|
+
# DESCRIPTION:
|
6
|
+
# This plugin checks a bucket and alerts if not exists
|
7
|
+
#
|
8
|
+
# OUTPUT:
|
9
|
+
# plain-text
|
10
|
+
#
|
11
|
+
# PLATFORMS:
|
12
|
+
# Linux
|
13
|
+
#
|
14
|
+
# DEPENDENCIES:
|
15
|
+
# gem: aws-sdk
|
16
|
+
# gem: sensu-plugin
|
17
|
+
#
|
18
|
+
# USAGE:
|
19
|
+
# ./check-s3-bucket.rb --bucket-name mybucket --aws-region eu-west-1
|
20
|
+
#
|
21
|
+
# NOTES:
|
22
|
+
#
|
23
|
+
# LICENSE:
|
24
|
+
# Copyright (c) 2015, Olivier Bazoud, olivier.bazoud@gmail.com
|
25
|
+
# Released under the same terms as Sensu (the MIT license); see LICENSE
|
26
|
+
# for details.
|
27
|
+
#
|
28
|
+
|
29
|
+
require 'sensu-plugin/check/cli'
|
30
|
+
require 'aws-sdk'
|
31
|
+
|
32
|
+
class CheckS3Bucket < Sensu::Plugin::Check::CLI
|
33
|
+
option :aws_access_key,
|
34
|
+
short: '-a AWS_ACCESS_KEY',
|
35
|
+
long: '--aws-access-key AWS_ACCESS_KEY',
|
36
|
+
description: "AWS Access Key. Either set ENV['AWS_ACCESS_KEY'] or provide it as an option",
|
37
|
+
default: ENV['AWS_ACCESS_KEY']
|
38
|
+
|
39
|
+
option :aws_secret_access_key,
|
40
|
+
short: '-k AWS_SECRET_KEY',
|
41
|
+
long: '--aws-secret-access-key AWS_SECRET_KEY',
|
42
|
+
description: "AWS Secret Access Key. Either set ENV['AWS_SECRET_KEY'] or provide it as an option",
|
43
|
+
default: ENV['AWS_SECRET_KEY']
|
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 :bucket_name,
|
52
|
+
short: '-b BUCKET_NAME',
|
53
|
+
long: '--bucket-name',
|
54
|
+
description: 'The name of the S3 bucket to check',
|
55
|
+
required: true
|
56
|
+
|
57
|
+
option :use_iam_role,
|
58
|
+
short: '-u',
|
59
|
+
long: '--use-iam',
|
60
|
+
description: 'Use IAM role authenticiation. Instance must have IAM role assigned for this to work'
|
61
|
+
|
62
|
+
def aws_config
|
63
|
+
{ access_key_id: config[:aws_access_key],
|
64
|
+
secret_access_key: config[:aws_secret_access_key],
|
65
|
+
region: config[:aws_region]
|
66
|
+
}
|
67
|
+
end
|
68
|
+
|
69
|
+
def run
|
70
|
+
aws_config = {}
|
71
|
+
|
72
|
+
if config[:use_iam_role].nil?
|
73
|
+
aws_config.merge!(
|
74
|
+
access_key_id: config[:aws_access_key],
|
75
|
+
secret_access_key: config[:aws_secret_access_key]
|
76
|
+
)
|
77
|
+
end
|
78
|
+
|
79
|
+
s3 = Aws::S3::Client.new(aws_config.merge!(region: config[:aws_region]))
|
80
|
+
begin
|
81
|
+
s3.head_bucket(bucket: config[:bucket_name])
|
82
|
+
ok "Bucket #{config[:bucket_name]} found"
|
83
|
+
rescue Aws::S3::Errors::NotFound => _
|
84
|
+
critical "Bucket #{config[:bucket_name]} not found"
|
85
|
+
rescue => e
|
86
|
+
critical "Bucket #{config[:bucket_name]} - #{e.message}"
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,130 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# check-s3-bucket
|
4
|
+
#
|
5
|
+
# DESCRIPTION:
|
6
|
+
# This plugin checks if a file exists in a bucket and/or is not too old.
|
7
|
+
#
|
8
|
+
# OUTPUT:
|
9
|
+
# plain-text
|
10
|
+
#
|
11
|
+
# PLATFORMS:
|
12
|
+
# Linux
|
13
|
+
#
|
14
|
+
# DEPENDENCIES:
|
15
|
+
# gem: aws-sdk
|
16
|
+
# gem: sensu-plugin
|
17
|
+
#
|
18
|
+
# USAGE:
|
19
|
+
# ./check-s3-object.rb --bucket-name mybucket --aws-region eu-west-1 --use-iam --key-name "path/to/myfile.txt"
|
20
|
+
# ./check-s3-object.rb --bucket-name mybucket --aws-region eu-west-1 --use-iam --key-name "path/to/myfile.txt" --warning 90000 --critical 126000
|
21
|
+
# ./check-s3-object.rb --bucket-name mybucket --aws-region eu-west-1 --use-iam --key-name "path/to/myfile.txt" --warning 90000 --critical 126000 --ok-zero-size
|
22
|
+
#
|
23
|
+
# NOTES:
|
24
|
+
#
|
25
|
+
# LICENSE:
|
26
|
+
# Copyright (c) 2015, Olivier Bazoud, olivier.bazoud@gmail.com
|
27
|
+
# Released under the same terms as Sensu (the MIT license); see LICENSE
|
28
|
+
# for details.
|
29
|
+
#
|
30
|
+
|
31
|
+
require 'sensu-plugin/check/cli'
|
32
|
+
require 'aws-sdk'
|
33
|
+
|
34
|
+
class CheckS3Bucket < Sensu::Plugin::Check::CLI
|
35
|
+
option :aws_access_key,
|
36
|
+
short: '-a AWS_ACCESS_KEY',
|
37
|
+
long: '--aws-access-key AWS_ACCESS_KEY',
|
38
|
+
description: "AWS Access Key. Either set ENV['AWS_ACCESS_KEY'] or provide it as an option",
|
39
|
+
default: ENV['AWS_ACCESS_KEY']
|
40
|
+
|
41
|
+
option :aws_secret_access_key,
|
42
|
+
short: '-k AWS_SECRET_KEY',
|
43
|
+
long: '--aws-secret-access-key AWS_SECRET_KEY',
|
44
|
+
description: "AWS Secret Access Key. Either set ENV['AWS_SECRET_KEY'] or provide it as an option",
|
45
|
+
default: ENV['AWS_SECRET_KEY']
|
46
|
+
|
47
|
+
option :aws_region,
|
48
|
+
short: '-r AWS_REGION',
|
49
|
+
long: '--aws-region REGION',
|
50
|
+
description: 'AWS Region (defaults to us-east-1).',
|
51
|
+
default: 'us-east-1'
|
52
|
+
|
53
|
+
option :use_iam_role,
|
54
|
+
short: '-u',
|
55
|
+
long: '--use-iam',
|
56
|
+
description: 'Use IAM role authenticiation. Instance must have IAM role assigned for this to work'
|
57
|
+
|
58
|
+
option :bucket_name,
|
59
|
+
short: '-b BUCKET_NAME',
|
60
|
+
long: '--bucket-name',
|
61
|
+
description: 'The name of the S3 bucket where object lives',
|
62
|
+
required: true
|
63
|
+
|
64
|
+
option :key_name,
|
65
|
+
short: '-b KEY_NAME',
|
66
|
+
long: '--key-name',
|
67
|
+
description: 'The name of key in the bucket',
|
68
|
+
required: true
|
69
|
+
|
70
|
+
option :ok_zero_size,
|
71
|
+
description: 'OK if file has zero size',
|
72
|
+
short: '-z',
|
73
|
+
long: '--ok-zero-size',
|
74
|
+
boolean: true,
|
75
|
+
default: false
|
76
|
+
|
77
|
+
option :warning_age,
|
78
|
+
description: 'Warn if mtime greater than provided age in seconds',
|
79
|
+
short: '-w SECONDS',
|
80
|
+
long: '--warning SECONDS'
|
81
|
+
|
82
|
+
option :critical_age,
|
83
|
+
description: 'Critical if mtime greater than provided age in seconds',
|
84
|
+
short: '-c SECONDS',
|
85
|
+
long: '--critical SECONDS'
|
86
|
+
|
87
|
+
def aws_config
|
88
|
+
{ access_key_id: config[:aws_access_key],
|
89
|
+
secret_access_key: config[:aws_secret_access_key],
|
90
|
+
region: config[:aws_region]
|
91
|
+
}
|
92
|
+
end
|
93
|
+
|
94
|
+
def run_check(type, age)
|
95
|
+
to_check = config["#{type}_age".to_sym].to_i
|
96
|
+
if to_check > 0 && age >= to_check # rubocop:disable GuardClause
|
97
|
+
send(type, "S3 object #{config[:key_name]} is #{age - to_check} seconds past (bucket #{config[:bucket_name]})")
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
def run
|
102
|
+
aws_config = {}
|
103
|
+
if config[:use_iam_role].nil?
|
104
|
+
aws_config.merge!(
|
105
|
+
access_key_id: config[:aws_access_key],
|
106
|
+
secret_access_key: config[:aws_secret_access_key]
|
107
|
+
)
|
108
|
+
end
|
109
|
+
|
110
|
+
s3 = Aws::S3::Client.new(aws_config.merge!(region: config[:aws_region]))
|
111
|
+
begin
|
112
|
+
output = s3.head_object(bucket: config[:bucket_name], key: config[:key_name])
|
113
|
+
|
114
|
+
if output[:content_length] == 0 && !config[:ok_zero_size]
|
115
|
+
critical "S3 object #{config[:key_name]} has zero size (bucket #{config[:bucket_name]})"
|
116
|
+
end
|
117
|
+
|
118
|
+
if config[:warning_age] || config[:critical_age]
|
119
|
+
age = Time.now.to_i - output[:last_modified].to_i
|
120
|
+
run_check(:critical, age) || run_check(:warning, age) || ok("S3 object #{config[:key_name]} is #{age} seconds old (bucket #{config[:bucket_name]})")
|
121
|
+
else
|
122
|
+
ok("S3 object #{config[:key_name]} exists (bucket #{config[:bucket_name]})")
|
123
|
+
end
|
124
|
+
rescue Aws::S3::Errors::NotFound => _
|
125
|
+
critical "S3 object #{config[:key_name]} not found in bucket #{config[:bucket_name]}"
|
126
|
+
rescue => e
|
127
|
+
critical "S3 object #{config[:key_name]} in bucket #{config[:bucket_name]} - #{e.message}"
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
@@ -0,0 +1,105 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# check-vpc-vpn.rb
|
4
|
+
#
|
5
|
+
# DESCRIPTION:
|
6
|
+
# This plugin checks VPC VPN connections to ensure they are up
|
7
|
+
#
|
8
|
+
# OUTPUT:
|
9
|
+
# plain text
|
10
|
+
#
|
11
|
+
# PLATFORMS:
|
12
|
+
# all
|
13
|
+
#
|
14
|
+
# DEPENDENCIES:
|
15
|
+
# gem: sensu-plugin
|
16
|
+
# gem: aws-sdk
|
17
|
+
#
|
18
|
+
# USAGE:
|
19
|
+
# ./check-vpc-vpn.rb --aws-region us-east-1 --vpn-connection-id vpn-abc1234
|
20
|
+
#
|
21
|
+
# NOTES:
|
22
|
+
# Supports inline credentials or IAM roles
|
23
|
+
#
|
24
|
+
# LICENSE:
|
25
|
+
# John Dyer johntdyer@gmail.com
|
26
|
+
# Released under the same terms as Sensu (the MIT license); see LICENSE
|
27
|
+
# for details.
|
28
|
+
#
|
29
|
+
|
30
|
+
require 'sensu-plugin/check/cli'
|
31
|
+
require 'aws-sdk'
|
32
|
+
|
33
|
+
class CheckAwsVpcVpnConnections < Sensu::Plugin::Check::CLI
|
34
|
+
@aws_config = {}
|
35
|
+
# rubocop:disable Style/AlignParameters
|
36
|
+
option :access_key,
|
37
|
+
short: '-a AWS_ACCESS_KEY',
|
38
|
+
long: '--aws-access-key AWS_ACCESS_KEY',
|
39
|
+
description: 'AWS Access Key',
|
40
|
+
default: ENV['AWS_ACCESS_KEY_ID']
|
41
|
+
|
42
|
+
option :secret_key,
|
43
|
+
short: '-s AWS_SECRET_ACCESS_KEY',
|
44
|
+
long: '--aws-secret-access-key AWS_SECRET_ACCESS_KEY',
|
45
|
+
description: 'AWS Secret Access Key.',
|
46
|
+
default: ENV['AWS_SECRET_ACCESS_KEY']
|
47
|
+
|
48
|
+
option :use_iam_role,
|
49
|
+
short: '-u',
|
50
|
+
long: '--use-iam',
|
51
|
+
description: 'Use IAM authentication'
|
52
|
+
|
53
|
+
option :vpn_id,
|
54
|
+
short: '-v VPN_ID',
|
55
|
+
long: '--vpn-connection-id VPN_ID',
|
56
|
+
required: true,
|
57
|
+
description: 'VPN connection ID'
|
58
|
+
|
59
|
+
option :aws_region,
|
60
|
+
short: '-r AWS_REGION',
|
61
|
+
long: '--aws-region REGION',
|
62
|
+
description: 'AWS Region (such as eu-west-1).',
|
63
|
+
default: 'us-east-1'
|
64
|
+
|
65
|
+
def aws_config
|
66
|
+
aws_connection_config = { region: config[:aws_region] }
|
67
|
+
if config[:use_iam_role].nil?
|
68
|
+
aws_connection_config.merge!(
|
69
|
+
access_key_id: config[:access_key],
|
70
|
+
secret_access_key: config[:secret_key]
|
71
|
+
)
|
72
|
+
end
|
73
|
+
aws_connection_config
|
74
|
+
end
|
75
|
+
|
76
|
+
def fetch_connection_data
|
77
|
+
begin
|
78
|
+
ec2 = AWS::EC2::Client.new(aws_config)
|
79
|
+
vpn_info = ec2.describe_vpn_connections(vpn_connection_ids: [config[:vpn_id]]).vpn_connection_set
|
80
|
+
down_connections = vpn_info.first.vgw_telemetry.select { |x| x.status != 'UP' }
|
81
|
+
results = { down_count: down_connections.count }
|
82
|
+
results[:down_connection_status] = down_connections.map { |x| "#{x.outside_ip_address} => #{x.status_message.nil? ? 'none' : x.status_message}" }
|
83
|
+
results[:connection_name] = vpn_info[0].tag_set.find { |x| x.key == 'Name' }.value
|
84
|
+
rescue AWS::EC2::Errors::InvalidVpnConnectionID::NotFound
|
85
|
+
warning "The vpnConnection ID '#{config[:vpn_id]}' does not exist"
|
86
|
+
rescue => e
|
87
|
+
warning e.backtrace.join(' ')
|
88
|
+
end
|
89
|
+
results
|
90
|
+
end
|
91
|
+
|
92
|
+
def run
|
93
|
+
data = fetch_connection_data
|
94
|
+
msg = data[:down_connection_status].join(' | ')
|
95
|
+
name = data[:connection_name]
|
96
|
+
case data[:down_count]
|
97
|
+
when 2 then critical "'#{name}' shows both tunnels as DOWN - [ #{msg} ]"
|
98
|
+
when 1 then warning "'#{name}' shows 1 of 2 tunnels as DOWN - [ #{msg} ]"
|
99
|
+
when 0 then ok "'#{name}' shows 2 of 2 tunnels as UP"
|
100
|
+
else
|
101
|
+
# Not sure this could ever happen
|
102
|
+
unknown "Unknown connection count - #{data[:down_count]}"
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
data/bin/handler-ec2_node.rb
CHANGED
@@ -136,7 +136,7 @@ class Ec2Node < Sensu::Handler
|
|
136
136
|
true
|
137
137
|
else
|
138
138
|
instance = instances.instances[0]
|
139
|
-
state_reason = instance.state_reason.code
|
139
|
+
state_reason = instance.state_reason.nil? ? nil : instance.state_reason.code
|
140
140
|
state = instance.state.name
|
141
141
|
states.include?(state) && state_reasons.any? { |reason| Regexp.new(reason) =~ state_reason }
|
142
142
|
end
|
data/bin/metrics-elb.rb
CHANGED
data/bin/metrics-sqs.rb
CHANGED
@@ -69,7 +69,7 @@ class SQSMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
69
69
|
|
70
70
|
def run
|
71
71
|
if config[:scheme] == ''
|
72
|
-
scheme = "aws.sqs.queue.#{config[:queue].
|
72
|
+
scheme = "aws.sqs.queue.#{config[:queue].tr('-', '_')}.message_count"
|
73
73
|
else
|
74
74
|
scheme = config[:scheme]
|
75
75
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-aws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sensu-Plugins and contributors
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
8sHuVruarogxxKPBzlL2is4EUb6oN/RdpGx2l4254+nyR+abg//Ed27Ym0PkB4lk
|
31
31
|
HP0m8WSjZmFr109pE/sVsM5jtOCvogyujQOjNVGN4gz1wwPr
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2015-
|
33
|
+
date: 2015-11-03 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: sensu-plugin
|
@@ -228,7 +228,12 @@ dependencies:
|
|
228
228
|
- - "~>"
|
229
229
|
- !ruby/object:Gem::Version
|
230
230
|
version: '0.10'
|
231
|
-
description:
|
231
|
+
description: |-
|
232
|
+
This plugin provides native AWS instrumentation
|
233
|
+
for monitoring and metrics collection, including:
|
234
|
+
health and metrics for various AWS services, such
|
235
|
+
as EC2, RDS, ELB, and more, as well as handlers
|
236
|
+
for EC2, SES, and SNS
|
232
237
|
email: "<sensu-users@googlegroups.com>"
|
233
238
|
executables:
|
234
239
|
- metrics-sqs.rb
|
@@ -242,13 +247,17 @@ executables:
|
|
242
247
|
- handler-ses.rb
|
243
248
|
- handler-ec2_node.rb
|
244
249
|
- check_vpc_vpn.py
|
250
|
+
- check-vpc-vpn.rb
|
245
251
|
- check-vpc-nameservers.rb
|
246
252
|
- check-sqs-messages.rb
|
247
253
|
- check-ses-limit.rb
|
254
|
+
- check-s3-object.rb
|
255
|
+
- check-s3-bucket.rb
|
248
256
|
- check-redshift-events.rb
|
249
257
|
- check-rds.rb
|
250
258
|
- check-rds-events.rb
|
251
259
|
- check-instance-events.rb
|
260
|
+
- check-emr-cluster.rb
|
252
261
|
- check-elb-sum-requests.rb
|
253
262
|
- check-elb-nodes.rb
|
254
263
|
- check-elb-latency.rb
|
@@ -262,6 +271,7 @@ executables:
|
|
262
271
|
- check-ebs-snapshots.rb
|
263
272
|
- check-dynamodb-throttle.rb
|
264
273
|
- check-dynamodb-capacity.rb
|
274
|
+
- check-cloudwatch-alarm.rb
|
265
275
|
- check-autoscaling-cpucredits.rb
|
266
276
|
extensions: []
|
267
277
|
extra_rdoc_files: []
|
@@ -270,6 +280,7 @@ files:
|
|
270
280
|
- LICENSE
|
271
281
|
- README.md
|
272
282
|
- bin/check-autoscaling-cpucredits.rb
|
283
|
+
- bin/check-cloudwatch-alarm.rb
|
273
284
|
- bin/check-dynamodb-capacity.rb
|
274
285
|
- bin/check-dynamodb-throttle.rb
|
275
286
|
- bin/check-ebs-snapshots.rb
|
@@ -283,13 +294,17 @@ files:
|
|
283
294
|
- bin/check-elb-latency.rb
|
284
295
|
- bin/check-elb-nodes.rb
|
285
296
|
- bin/check-elb-sum-requests.rb
|
297
|
+
- bin/check-emr-cluster.rb
|
286
298
|
- bin/check-instance-events.rb
|
287
299
|
- bin/check-rds-events.rb
|
288
300
|
- bin/check-rds.rb
|
289
301
|
- bin/check-redshift-events.rb
|
302
|
+
- bin/check-s3-bucket.rb
|
303
|
+
- bin/check-s3-object.rb
|
290
304
|
- bin/check-ses-limit.rb
|
291
305
|
- bin/check-sqs-messages.rb
|
292
306
|
- bin/check-vpc-nameservers.rb
|
307
|
+
- bin/check-vpc-vpn.rb
|
293
308
|
- bin/check_vpc_vpn.py
|
294
309
|
- bin/handler-ec2_node.rb
|
295
310
|
- bin/handler-ses.rb
|
metadata.gz.sig
CHANGED
Binary file
|