riemann-unicorn 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +22 -0
  3. data/README.md +17 -0
  4. data/bin/riemann-unicorn +55 -0
  5. metadata +74 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 28450e41ed2c16b75870397bb42d5ff9506a6184
4
+ data.tar.gz: 74f662f2245eb0744d3fef00084b2388ce733a9e
5
+ SHA512:
6
+ metadata.gz: c98d89e800971ab99f60fa0d4cb712b7d874ba431f7f836a354273bdfe8633471bbc43328eee75682a4d994b01a29775764b704346c11b32e5f04a3c8293c281
7
+ data.tar.gz: f09bdc56afd656ec7b6678f6afd745c5c1eda7f9059c7570f4bee7e5c0eccee4415498e735e09e5ab547be11778d7186f465197e11e1575fbe9ee37fb3215aa1
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 ClipInteractive
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 all
13
+ 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 THE
21
+ SOFTWARE.
22
+
@@ -0,0 +1,17 @@
1
+ Riemann Unicorn
2
+ =============
3
+
4
+ Riemann client to report the number of active and queued transactions in Unicorn.
5
+
6
+ Usage
7
+ =============
8
+
9
+ For Unix sockets
10
+ ```bash
11
+ riemann-unicorn --unicorn-socket /path/to/socket.sock
12
+ ```
13
+
14
+ For TCP listeners
15
+ ```bash
16
+ riemann-unicorn --unicorn-tcp 127.0.0.1:8080
17
+ ```
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Reports Unicorn active and queued statistics to Riemann.
4
+
5
+ require 'riemann/tools'
6
+
7
+ class Riemann::Tools::Unicorn
8
+ include Riemann::Tools
9
+ require 'unicorn'
10
+
11
+ opt :unicorn_socket, 'Path to Unicorn Unix Socket', :type => String, :default => nil
12
+ opt :unicorn_tcp, 'Unicorn TCP Listener', :type => String, :default => nil
13
+
14
+ def initialize
15
+ unless opts[:unicorn_socket] || opts[:unicorn_tcp]
16
+ puts 'Error: --unicorn-socket or --unicorn-tcp must be provided'
17
+ exit 1
18
+ end
19
+
20
+ if opts[:unicorn_socket] && !File.exists?(opts[:unicorn_socket])
21
+ puts "Error: Unix socket #{opts[:unicorn_socket]} not found"
22
+ exit 1
23
+ end
24
+ end
25
+
26
+ def tick
27
+ fetch_stats.each do |addr, stats|
28
+ report(
29
+ :service => 'Unicorn Active',
30
+ :metric => stats.active,
31
+ :state => 'ok',
32
+ :description => 'Unicorn Active Transactions',
33
+ :tags => ['unicorn']
34
+ )
35
+
36
+ report(
37
+ :service => 'Unicorn Queued',
38
+ :metric => stats.queued,
39
+ :state => 'ok',
40
+ :description => 'Unicorn Queued Transactions',
41
+ :tags => ['unicorn']
42
+ )
43
+ end
44
+ end
45
+
46
+ def fetch_stats()
47
+ if opts[:unicorn_socket]
48
+ Raindrops::Linux.unix_listener_stats([opts[:unicorn_socket]])
49
+ else
50
+ Raindrops::Linux.tcp_listener_stats([opts[:unicorn_tcp]])
51
+ end
52
+ end
53
+ end
54
+
55
+ Riemann::Tools::Unicorn.run
metadata ADDED
@@ -0,0 +1,74 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: riemann-unicorn
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Benjamin Good
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-11-05 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.1
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.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: unicorn
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.17.1
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 0.17.1
41
+ description:
42
+ email: bgood@clipinteractive.com
43
+ executables:
44
+ - riemann-unicorn
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - LICENSE
49
+ - README.md
50
+ - bin/riemann-unicorn
51
+ homepage: https://github.com/ClipInteractive/riemann-unicorn
52
+ licenses: []
53
+ metadata: {}
54
+ post_install_message:
55
+ rdoc_options: []
56
+ require_paths:
57
+ - lib
58
+ required_ruby_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 2.0.0
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ requirements: []
69
+ rubyforge_project: riemann-unicorn
70
+ rubygems_version: 2.2.2
71
+ signing_key:
72
+ specification_version: 4
73
+ summary: Unicorn Riemann Client
74
+ test_files: []