riemann-sqs 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d8c4357305c6b39d2a32cf36fdeed6afbba88384
4
+ data.tar.gz: 62c7ae6d651278f0a6f1e0385f075b7649f883f3
5
+ SHA512:
6
+ metadata.gz: 00e0989b0cfb57d952cbbec8a51f887a3fa9e5d484dc4515480052601b992dc39abb6dc124df7d7dd27296e7979e0db7f7ae5b7b3c58468a4d92bbfd26b28de2
7
+ data.tar.gz: 4bc44631016bde6d8fc215d36f31d5c1c7b5a2f1eddebcc4377863ae22e47702329680d26aba2c6507203d9ebf7578507a45c884e9c35d821028b35efd42bddb
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ pkg/
2
+ ._*
3
+ *~
4
+ *.log
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2015 Fernando Alonso
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,4 @@
1
+ Riemann Sqs
2
+ ================
3
+
4
+ Riemann Sqs queue agent.
data/bin/riemann-sqs ADDED
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Riemann agent to collect AWS Sqs queue metrics
4
+
5
+ require 'fog'
6
+ require 'riemann/tools'
7
+
8
+ $0 = __FILE__ # Let's not expose our AWS keys in the process list
9
+
10
+ class Riemann::Tools::AWS
11
+ include Riemann::Tools
12
+
13
+ opt :access_key, "AWS access key", :type => String
14
+ opt :secret_key, "Secret access key", :type => String
15
+ opt :region, "AWS region", :type => String, :default => 'us-east-1'
16
+ opt :queue, "SQS Queue name", :type => String
17
+ def initialize
18
+ @sqs = Fog::AWS::SQS.new(:aws_access_key_id => opts[:access_key],
19
+ :aws_secret_access_key => opts[:secret_key],
20
+ :region => opts[:region])
21
+ response = @sqs.list_queues({'QueueNamePrefix' => opts[:queue]})
22
+ @queue_url = response[:body]['QueueUrls'].first
23
+ end
24
+
25
+ def tick
26
+ response = @sqs.get_queue_attributes(@queue_url, 'All')
27
+ ['ApproximateNumberOfMessages', 'ApproximateNumberOfMessagesNotVisible'].each do |attr|
28
+ msg = {
29
+ metric: response[:body]['Attributes'][attr],
30
+ service: "#{opts[:queue]} #{attr}",
31
+ state: 'ok'
32
+ }
33
+ report msg
34
+ end
35
+ end
36
+ end
37
+
38
+ Riemann::Tools::AWS.run
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "riemann-sqs"
7
+ spec.version = '0.0.1'
8
+ spec.authors = ["Fernando Alonso"]
9
+ spec.email = ["krakatoa1987@gmail.com"]
10
+ spec.summary = %q{Riemann agent to collect SQS queue metrics}
11
+ spec.description = %q{Riemann agent to collect SQS queue metrics}
12
+ spec.homepage = "https://github.com/krakatoa/riemann-sqs"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_runtime_dependency "riemann-tools", "~> 0.2.6"
21
+ spec.add_runtime_dependency "fog", ">= 1.4.0"
22
+ spec.add_development_dependency "bundler", "~> 1.6"
23
+ end
metadata ADDED
@@ -0,0 +1,92 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: riemann-sqs
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Fernando Alonso
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-08-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: riemann-tools
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 0.2.6
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 0.2.6
27
+ - !ruby/object:Gem::Dependency
28
+ name: fog
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: 1.4.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: 1.4.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.6'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.6'
55
+ description: Riemann agent to collect SQS queue metrics
56
+ email:
57
+ - krakatoa1987@gmail.com
58
+ executables:
59
+ - riemann-sqs
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - .gitignore
64
+ - LICENSE
65
+ - README.md
66
+ - bin/riemann-sqs
67
+ - riemann-sqs.gemspec
68
+ homepage: https://github.com/krakatoa/riemann-sqs
69
+ licenses:
70
+ - MIT
71
+ metadata: {}
72
+ post_install_message:
73
+ rdoc_options: []
74
+ require_paths:
75
+ - lib
76
+ required_ruby_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - '>='
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ required_rubygems_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ requirements: []
87
+ rubyforge_project:
88
+ rubygems_version: 2.4.8
89
+ signing_key:
90
+ specification_version: 4
91
+ summary: Riemann agent to collect SQS queue metrics
92
+ test_files: []