alerty-plugin-amazon_sns 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +6 -0
- data/README.md +2 -2
- data/alerty-plugin-amazon_sns.gemspec +1 -1
- data/example.yml +1 -1
- data/lib/alerty/plugin/amazon_sns.rb +6 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7affed57c43644806e084ab6c1bd7ecde314b528
|
4
|
+
data.tar.gz: 1cdd6940af0945660871c9f482e40aa178175016
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 280b89e75cfa73263ecddf3a2ced29a066daf543b19be338f510e9871ee9a73624e186c088a944ca06d0e757db8d17176a7626bbd875b6b67868adf440fd7509
|
7
|
+
data.tar.gz: 9804c127bba94cdb47c72b02bfd0bc2b1bce98a7667349d1cfb700846a9613351dbdcc8ea30072e6d6821d726107aafa96d48a042d96df34afbcfca60e136433
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -21,9 +21,9 @@ Or install it yourself as:
|
|
21
21
|
## Configuration
|
22
22
|
|
23
23
|
* **type**: must be `amazon_sns`
|
24
|
-
* **
|
24
|
+
* **topc_arn**: Amazon SNS topic name
|
25
25
|
* **subject**: subject of alert. `${command}` is replaced with a given command, `${hostname}` is replaced with the hostname ran a command
|
26
|
-
* **aws_region**: AWS Region. (default:
|
26
|
+
* **aws_region**: AWS Region. (default: guess from topic_arn, like arn:aws:sns:us-east-1:<account_id>:<topic_name> => us-east-1)
|
27
27
|
* **aws_access_key_id**: Credential key id (default: ENV['AWS_SECRET_KEY_id'] or ~/.aws/credentials or instance profile on EC2)
|
28
28
|
* **aws_secret_access_key**: Credential secret access_key (default: ENV['AWS_SECRET_ACCESS_KEY'] or ~/.aws/credentials or instance profile on EC2)
|
29
29
|
|
data/example.yml
CHANGED
@@ -12,7 +12,7 @@ class Alerty
|
|
12
12
|
# see http://docs.aws.amazon.com/sdkforruby/api/Aws/SNS/Client.html
|
13
13
|
# ENV or ~/.aws/credentials or instance profile on EC2, or alerty config file
|
14
14
|
params = {}
|
15
|
-
params[:region] = config.aws_region
|
15
|
+
params[:region] = config.aws_region || guess_region(config.topic_arn)
|
16
16
|
params[:access_key_id] = config.aws_access_key_id if config.aws_access_key_id
|
17
17
|
params[:secret_access_key] = config.aws_secret_access_key if config.aws_secret_access_key
|
18
18
|
@client = Aws::SNS::Client.new(params)
|
@@ -42,6 +42,11 @@ class Alerty
|
|
42
42
|
|
43
43
|
private
|
44
44
|
|
45
|
+
def guess_region(topic_arn)
|
46
|
+
# arn:aws:sns:ap-northeast-1:<account_id>:<topic_name>
|
47
|
+
topic_arn.split(':')[3]
|
48
|
+
end
|
49
|
+
|
45
50
|
def expand_placeholder(str, record)
|
46
51
|
str.gsub('${command}', record[:command]).gsub('${hostname}', record[:hostname])
|
47
52
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alerty-plugin-amazon_sns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naotoshi Seo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: alerty
|
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
133
|
version: '0'
|
134
134
|
requirements: []
|
135
135
|
rubyforge_project:
|
136
|
-
rubygems_version: 2.
|
136
|
+
rubygems_version: 2.5.1
|
137
137
|
signing_key:
|
138
138
|
specification_version: 4
|
139
139
|
summary: Amazon SNS plugin for alerty
|