passenger-metrics 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +1 -0
- data/Gemfile +15 -0
- data/Gemfile.lock +124 -0
- data/Guardfile +16 -0
- data/LICENSE +21 -0
- data/README.md +4 -0
- data/Rakefile +38 -0
- data/VERSION +1 -0
- data/bin/_guard-core +16 -0
- data/bin/guard +16 -0
- data/bin/passenger-metrics-cloudwatch +8 -0
- data/lib/passenger-metrics.rb +14 -0
- data/lib/passenger-metrics/cloudwatch.rb +81 -0
- data/lib/passenger-metrics/metrics/base.rb +20 -0
- data/lib/passenger-metrics/metrics/queue_length.rb +13 -0
- data/lib/passenger-metrics/status.rb +18 -0
- data/passenger-metrics.gemspec +85 -0
- data/spec/fixtures/status.xml +2 -0
- data/spec/passenger-metrics/cloudwatch_spec.rb +21 -0
- data/spec/passenger-metrics/status_spec.rb +10 -0
- data/spec/passenger_metrics_spec.rb +8 -0
- data/spec/spec_helper.rb +17 -0
- data/spec/status_spec.rb +10 -0
- metadata +182 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 07aeea52c5e0197e4c8c831c78a771b55f74f151
|
4
|
+
data.tar.gz: 048ef9fe348d7594a972a34d71db12fa989db62d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 979fcdd55c23f3b7b30f34142688bc8755436fe73fe94ad5a08f71f25212936658cd39aaef0ea7bf587d7f54fb0ff5346887b31c7ee4845d861785481a6ef4cb
|
7
|
+
data.tar.gz: 1b447b051f292fc49a97c591c9535d3e46956269894be83186c94ac47c9960136a379e4700675efd8b45434febdd8199d8b10e51c500cc83140d09d72ad9a60d
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
gem 'crack'
|
4
|
+
gem 'aws-sdk'
|
5
|
+
|
6
|
+
# Add dependencies to develop your gem here.
|
7
|
+
# Include everything needed to run rake, tests, features, etc.
|
8
|
+
group :development do
|
9
|
+
gem "rspec", ">= 0"
|
10
|
+
gem "bundler", "~> 1.0"
|
11
|
+
gem "jeweler", "~> 2.0.1"
|
12
|
+
gem 'guard'
|
13
|
+
gem 'guard-rspec', require: false
|
14
|
+
gem 'byebug'
|
15
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
addressable (2.4.0)
|
5
|
+
aws-sdk (2.2.24)
|
6
|
+
aws-sdk-resources (= 2.2.24)
|
7
|
+
aws-sdk-core (2.2.24)
|
8
|
+
jmespath (~> 1.0)
|
9
|
+
aws-sdk-resources (2.2.24)
|
10
|
+
aws-sdk-core (= 2.2.24)
|
11
|
+
builder (3.2.2)
|
12
|
+
byebug (8.2.2)
|
13
|
+
coderay (1.1.1)
|
14
|
+
crack (0.4.3)
|
15
|
+
safe_yaml (~> 1.0.0)
|
16
|
+
descendants_tracker (0.0.4)
|
17
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
18
|
+
diff-lcs (1.2.5)
|
19
|
+
faraday (0.9.2)
|
20
|
+
multipart-post (>= 1.2, < 3)
|
21
|
+
ffi (1.9.10)
|
22
|
+
formatador (0.2.5)
|
23
|
+
git (1.3.0)
|
24
|
+
github_api (0.13.1)
|
25
|
+
addressable (~> 2.4.0)
|
26
|
+
descendants_tracker (~> 0.0.4)
|
27
|
+
faraday (~> 0.8, < 0.10)
|
28
|
+
hashie (>= 3.4)
|
29
|
+
multi_json (>= 1.7.5, < 2.0)
|
30
|
+
oauth2
|
31
|
+
guard (2.13.0)
|
32
|
+
formatador (>= 0.2.4)
|
33
|
+
listen (>= 2.7, <= 4.0)
|
34
|
+
lumberjack (~> 1.0)
|
35
|
+
nenv (~> 0.1)
|
36
|
+
notiffany (~> 0.0)
|
37
|
+
pry (>= 0.9.12)
|
38
|
+
shellany (~> 0.0)
|
39
|
+
thor (>= 0.18.1)
|
40
|
+
guard-compat (1.2.1)
|
41
|
+
guard-rspec (4.6.4)
|
42
|
+
guard (~> 2.1)
|
43
|
+
guard-compat (~> 1.1)
|
44
|
+
rspec (>= 2.99.0, < 4.0)
|
45
|
+
hashie (3.4.3)
|
46
|
+
highline (1.7.8)
|
47
|
+
jeweler (2.0.1)
|
48
|
+
builder
|
49
|
+
bundler (>= 1.0)
|
50
|
+
git (>= 1.2.5)
|
51
|
+
github_api
|
52
|
+
highline (>= 1.6.15)
|
53
|
+
nokogiri (>= 1.5.10)
|
54
|
+
rake
|
55
|
+
rdoc
|
56
|
+
jmespath (1.1.3)
|
57
|
+
json (1.8.3)
|
58
|
+
jwt (1.5.1)
|
59
|
+
listen (3.0.6)
|
60
|
+
rb-fsevent (>= 0.9.3)
|
61
|
+
rb-inotify (>= 0.9.7)
|
62
|
+
lumberjack (1.0.10)
|
63
|
+
method_source (0.8.2)
|
64
|
+
mini_portile2 (2.0.0)
|
65
|
+
multi_json (1.11.2)
|
66
|
+
multi_xml (0.5.5)
|
67
|
+
multipart-post (2.0.0)
|
68
|
+
nenv (0.3.0)
|
69
|
+
nokogiri (1.6.7.2)
|
70
|
+
mini_portile2 (~> 2.0.0.rc2)
|
71
|
+
notiffany (0.0.8)
|
72
|
+
nenv (~> 0.1)
|
73
|
+
shellany (~> 0.0)
|
74
|
+
oauth2 (1.1.0)
|
75
|
+
faraday (>= 0.8, < 0.10)
|
76
|
+
jwt (~> 1.0, < 1.5.2)
|
77
|
+
multi_json (~> 1.3)
|
78
|
+
multi_xml (~> 0.5)
|
79
|
+
rack (>= 1.2, < 3)
|
80
|
+
pry (0.10.3)
|
81
|
+
coderay (~> 1.1.0)
|
82
|
+
method_source (~> 0.8.1)
|
83
|
+
slop (~> 3.4)
|
84
|
+
rack (1.6.4)
|
85
|
+
rake (10.5.0)
|
86
|
+
rb-fsevent (0.9.7)
|
87
|
+
rb-inotify (0.9.7)
|
88
|
+
ffi (>= 0.5.0)
|
89
|
+
rdoc (4.2.2)
|
90
|
+
json (~> 1.4)
|
91
|
+
rspec (3.4.0)
|
92
|
+
rspec-core (~> 3.4.0)
|
93
|
+
rspec-expectations (~> 3.4.0)
|
94
|
+
rspec-mocks (~> 3.4.0)
|
95
|
+
rspec-core (3.4.3)
|
96
|
+
rspec-support (~> 3.4.0)
|
97
|
+
rspec-expectations (3.4.0)
|
98
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
99
|
+
rspec-support (~> 3.4.0)
|
100
|
+
rspec-mocks (3.4.1)
|
101
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
102
|
+
rspec-support (~> 3.4.0)
|
103
|
+
rspec-support (3.4.1)
|
104
|
+
safe_yaml (1.0.4)
|
105
|
+
shellany (0.0.1)
|
106
|
+
slop (3.6.0)
|
107
|
+
thor (0.19.1)
|
108
|
+
thread_safe (0.3.5)
|
109
|
+
|
110
|
+
PLATFORMS
|
111
|
+
ruby
|
112
|
+
|
113
|
+
DEPENDENCIES
|
114
|
+
aws-sdk
|
115
|
+
bundler (~> 1.0)
|
116
|
+
byebug
|
117
|
+
crack
|
118
|
+
guard
|
119
|
+
guard-rspec
|
120
|
+
jeweler (~> 2.0.1)
|
121
|
+
rspec
|
122
|
+
|
123
|
+
BUNDLED WITH
|
124
|
+
1.11.2
|
data/Guardfile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
2
|
+
require "guard/rspec/dsl"
|
3
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
4
|
+
|
5
|
+
# Feel free to open issues for suggestions and improvements
|
6
|
+
|
7
|
+
# RSpec files
|
8
|
+
rspec = dsl.rspec
|
9
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
10
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
11
|
+
watch(rspec.spec_files)
|
12
|
+
|
13
|
+
# Ruby files
|
14
|
+
ruby = dsl.ruby
|
15
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
16
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 ControlShift
|
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.
|
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
|
17
|
+
gem.name = "passenger-metrics"
|
18
|
+
gem.homepage = "http://github.com/controlshift/passenger-metrics"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{ruby interface to passenger-status}
|
21
|
+
gem.description = %Q{Get passenger metrics from passenger-status into the analytics tool of your choice.}
|
22
|
+
gem.email = "nathan@gcontrolshiftlabs.com"
|
23
|
+
gem.authors = ["Nathan Woodhull"]
|
24
|
+
gem.executables = ['passenger-metrics-cloudwatch']
|
25
|
+
# dependencies defined in Gemfile
|
26
|
+
end
|
27
|
+
Jeweler::RubygemsDotOrgTasks.new
|
28
|
+
|
29
|
+
require 'rspec/core/rake_task'
|
30
|
+
desc 'Default: run specs.'
|
31
|
+
task :default => :spec
|
32
|
+
|
33
|
+
desc "Run specs"
|
34
|
+
RSpec::Core::RakeTask.new do |t|
|
35
|
+
t.pattern = "./spec/**/*_spec.rb" # don't need this, it's default.
|
36
|
+
t.rspec_opts = '--color'
|
37
|
+
end
|
38
|
+
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.0
|
data/bin/_guard-core
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application '_guard-core' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require "pathname"
|
10
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require "rubygems"
|
14
|
+
require "bundler/setup"
|
15
|
+
|
16
|
+
load Gem.bin_path("guard", "_guard-core")
|
data/bin/guard
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'guard' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require "pathname"
|
10
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require "rubygems"
|
14
|
+
require "bundler/setup"
|
15
|
+
|
16
|
+
load Gem.bin_path("guard", "guard")
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'aws-sdk'
|
2
|
+
require 'crack'
|
3
|
+
require 'byebug'
|
4
|
+
|
5
|
+
module PassengerMetrics
|
6
|
+
def self.status
|
7
|
+
@status ||= PassengerMetrics::Status.new
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
require 'passenger-metrics/metrics/base'
|
12
|
+
require 'passenger-metrics/metrics/queue_length'
|
13
|
+
require 'passenger-metrics/status'
|
14
|
+
require 'passenger-metrics/cloudwatch'
|
@@ -0,0 +1,81 @@
|
|
1
|
+
module PassengerMetrics
|
2
|
+
class Cloudwatch
|
3
|
+
DEFAULT_NAMESPACE = "Passenger"
|
4
|
+
DEFAULT_METRIC_NAME = "MetricName"
|
5
|
+
DEFAULT_DIMENSION_NAME = "InstanceId"
|
6
|
+
DEFAULT_DIMENSION_VALUE = "InstanceId"
|
7
|
+
|
8
|
+
METRIC_UNITS = {
|
9
|
+
nil => "None",
|
10
|
+
:count => "Count"
|
11
|
+
}
|
12
|
+
|
13
|
+
attr_accessor :metric
|
14
|
+
|
15
|
+
def initialize(metric = nil)
|
16
|
+
self.metric = metric
|
17
|
+
end
|
18
|
+
|
19
|
+
def put
|
20
|
+
client.put_metric_data(put_metric_data_payload)
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def put_metric_data_payload
|
26
|
+
{:namespace => namespace, :metric_data => metric_data}
|
27
|
+
end
|
28
|
+
|
29
|
+
def metric_data
|
30
|
+
[
|
31
|
+
{
|
32
|
+
:metric_name => metric_name,
|
33
|
+
:dimensions => dimensions,
|
34
|
+
:timestamp => timestamp,
|
35
|
+
:value => value,
|
36
|
+
:unit => unit
|
37
|
+
}
|
38
|
+
]
|
39
|
+
end
|
40
|
+
|
41
|
+
def namespace
|
42
|
+
ENV["AWS_CLOUDWATCH_NAMESPACE"] || DEFAULT_NAMESPACE
|
43
|
+
end
|
44
|
+
|
45
|
+
def metric_name
|
46
|
+
ENV["AWS_CLOUDWATCH_METRIC_NAME"] || DEFAULT_METRIC_NAME
|
47
|
+
end
|
48
|
+
|
49
|
+
def dimension_name
|
50
|
+
ENV["AWS_CLOUDWATCH_DIMENSION_NAME"] || DEFAULT_DIMENSION_NAME
|
51
|
+
end
|
52
|
+
|
53
|
+
def dimension_value
|
54
|
+
ENV["AWS_CLOUDWATCH_DIMENSION_VALUE"] || DEFAULT_DIMENSION_VALUE
|
55
|
+
end
|
56
|
+
|
57
|
+
def dimensions
|
58
|
+
(ENV["AWS_CLOUDWATCH_DIMENSIONS"] && JSON.parse(ENV["AWS_CLOUDWATCH_DIMENSIONS"])) || default_dimensions
|
59
|
+
end
|
60
|
+
|
61
|
+
def default_dimensions
|
62
|
+
[{:name => dimension_name, :value => dimension_value}]
|
63
|
+
end
|
64
|
+
|
65
|
+
def timestamp
|
66
|
+
Time.now
|
67
|
+
end
|
68
|
+
|
69
|
+
def value
|
70
|
+
metric.value
|
71
|
+
end
|
72
|
+
|
73
|
+
def unit
|
74
|
+
METRIC_UNITS[metric.unit]
|
75
|
+
end
|
76
|
+
|
77
|
+
def client
|
78
|
+
@client ||= ::Aws::CloudWatch::Client.new region: 'us-east-1'
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module PassengerMetrics
|
2
|
+
module Metrics
|
3
|
+
class Base
|
4
|
+
DEFAULT_VALUE = "0.0"
|
5
|
+
DEFAULT_UNIT = nil
|
6
|
+
|
7
|
+
def self.descendants
|
8
|
+
ObjectSpace.each_object(Class).select { |klass| klass < self }
|
9
|
+
end
|
10
|
+
|
11
|
+
def value
|
12
|
+
DEFAULT_VALUE
|
13
|
+
end
|
14
|
+
|
15
|
+
def unit
|
16
|
+
DEFAULT_UNIT
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module PassengerMetrics
|
2
|
+
class Status
|
3
|
+
def info
|
4
|
+
@info || load!
|
5
|
+
end
|
6
|
+
|
7
|
+
def load!
|
8
|
+
@info = Crack::XML.parse(passenger_status_output)['info']
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def passenger_status_output
|
14
|
+
`passenger-status --show=xml`
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: passenger-metrics 0.0.0 ruby lib
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "passenger-metrics"
|
9
|
+
s.version = "0.0.0"
|
10
|
+
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib"]
|
13
|
+
s.authors = ["Nathan Woodhull"]
|
14
|
+
s.date = "2016-03-09"
|
15
|
+
s.description = "Get passenger metrics from passenger-status into the analytics tool of your choice."
|
16
|
+
s.email = "nathan@gcontrolshiftlabs.com"
|
17
|
+
s.executables = ["passenger-metrics-cloudwatch"]
|
18
|
+
s.extra_rdoc_files = [
|
19
|
+
"LICENSE",
|
20
|
+
"README.md"
|
21
|
+
]
|
22
|
+
s.files = [
|
23
|
+
".rspec",
|
24
|
+
"Gemfile",
|
25
|
+
"Gemfile.lock",
|
26
|
+
"Guardfile",
|
27
|
+
"LICENSE",
|
28
|
+
"README.md",
|
29
|
+
"Rakefile",
|
30
|
+
"VERSION",
|
31
|
+
"bin/_guard-core",
|
32
|
+
"bin/guard",
|
33
|
+
"bin/passenger-metrics-cloudwatch",
|
34
|
+
"lib/passenger-metrics.rb",
|
35
|
+
"lib/passenger-metrics/cloudwatch.rb",
|
36
|
+
"lib/passenger-metrics/metrics/base.rb",
|
37
|
+
"lib/passenger-metrics/metrics/queue_length.rb",
|
38
|
+
"lib/passenger-metrics/status.rb",
|
39
|
+
"passenger-metrics.gemspec",
|
40
|
+
"spec/fixtures/status.xml",
|
41
|
+
"spec/passenger-metrics/cloudwatch_spec.rb",
|
42
|
+
"spec/passenger-metrics/status_spec.rb",
|
43
|
+
"spec/passenger_metrics_spec.rb",
|
44
|
+
"spec/spec_helper.rb",
|
45
|
+
"spec/status_spec.rb"
|
46
|
+
]
|
47
|
+
s.homepage = "http://github.com/controlshift/passenger-metrics"
|
48
|
+
s.licenses = ["MIT"]
|
49
|
+
s.rubygems_version = "2.4.8"
|
50
|
+
s.summary = "ruby interface to passenger-status"
|
51
|
+
|
52
|
+
if s.respond_to? :specification_version then
|
53
|
+
s.specification_version = 4
|
54
|
+
|
55
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
56
|
+
s.add_runtime_dependency(%q<crack>, [">= 0"])
|
57
|
+
s.add_runtime_dependency(%q<aws-sdk>, [">= 0"])
|
58
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
59
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0"])
|
60
|
+
s.add_development_dependency(%q<jeweler>, ["~> 2.0.1"])
|
61
|
+
s.add_development_dependency(%q<guard>, [">= 0"])
|
62
|
+
s.add_development_dependency(%q<guard-rspec>, [">= 0"])
|
63
|
+
s.add_development_dependency(%q<byebug>, [">= 0"])
|
64
|
+
else
|
65
|
+
s.add_dependency(%q<crack>, [">= 0"])
|
66
|
+
s.add_dependency(%q<aws-sdk>, [">= 0"])
|
67
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
68
|
+
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
69
|
+
s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
|
70
|
+
s.add_dependency(%q<guard>, [">= 0"])
|
71
|
+
s.add_dependency(%q<guard-rspec>, [">= 0"])
|
72
|
+
s.add_dependency(%q<byebug>, [">= 0"])
|
73
|
+
end
|
74
|
+
else
|
75
|
+
s.add_dependency(%q<crack>, [">= 0"])
|
76
|
+
s.add_dependency(%q<aws-sdk>, [">= 0"])
|
77
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
78
|
+
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
79
|
+
s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
|
80
|
+
s.add_dependency(%q<guard>, [">= 0"])
|
81
|
+
s.add_dependency(%q<guard-rspec>, [">= 0"])
|
82
|
+
s.add_dependency(%q<byebug>, [">= 0"])
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
@@ -0,0 +1,2 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso8859-1" ?>
|
2
|
+
<info version="3"><passenger_version>5.0.25</passenger_version><group_count>1</group_count><process_count>1</process_count><max>3</max><capacity_used>1</capacity_used><get_wait_list_size>0</get_wait_list_size><supergroups><supergroup><name>agra</name><state>READY</state><get_wait_list_size>0</get_wait_list_size><capacity_used>1</capacity_used><group default="true"><name>agra</name><component_name>agra</component_name><app_root>/srv/agra</app_root><app_type>rack</app_type><environment>staging</environment><uuid>iefjzXqldzyFmwEcnMe6</uuid><enabled_process_count>1</enabled_process_count><disabling_process_count>0</disabling_process_count><disabled_process_count>0</disabled_process_count><capacity_used>1</capacity_used><get_wait_list_size>0</get_wait_list_size><disable_wait_list_size>0</disable_wait_list_size><processes_being_spawned>0</processes_being_spawned><life_status>ALIVE</life_status><user>ruby</user><uid>1001</uid><group>ruby</group><gid>1001</gid><options><app_root>/srv/agra</app_root><app_group_name>agra</app_group_name><app_type>rack</app_type><start_command>/usr/bin/passenger_free_ruby	/usr/share/passenger-enterprise/helper-scripts/rack-loader.rb</start_command><startup_file>/srv/agra/config.ru</startup_file><process_title>Passenger RubyApp</process_title><log_level>3</log_level><start_timeout>90000</start_timeout><environment>staging</environment><base_uri>/</base_uri><spawn_method>smart</spawn_method><default_user>nobody</default_user><default_group>nogroup</default_group><integration_mode>apache</integration_mode><ruby>/usr/bin/passenger_free_ruby</ruby><python>python</python><nodejs>node</nodejs><ust_router_address>unix:/tmp/passenger.h7YN1Gk/agents.s/ust_router</ust_router_address><ust_router_username>logging</ust_router_username><ust_router_password>SoqE0PCCiytxTiRUkYLN4HUq</ust_router_password><debugger>false</debugger><analytics>false</analytics><api_key>s21yNi6dfVTIgXYP</api_key><concurrency_model>process</concurrency_model><thread_count>1</thread_count><min_processes>1</min_processes><max_processes>0</max_processes><max_preloader_idle_time>300</max_preloader_idle_time><max_out_of_band_work_instances>1</max_out_of_band_work_instances><rolling_restart>false</rolling_restart><ignore_spawn_errors>false</ignore_spawn_errors></options><processes><process><pid>13755</pid><sticky_session_id>847633343</sticky_session_id><gupid>172a652-sID3Zj2IB6</gupid><concurrency>1</concurrency><sessions>0</sessions><busyness>0</busyness><processed>481</processed><spawner_creation_time>1457453880378332</spawner_creation_time><spawn_start_time>1457453895368460</spawn_start_time><spawn_end_time>1457453895438079</spawn_end_time><last_used>1457455021775215</last_used><last_used_desc>3s ago</last_used_desc><uptime>18m 49s</uptime><code_revision>4bc9beff734e706b40104159da44c6c4d512534e</code_revision><life_status>ALIVE</life_status><enabled>ENABLED</enabled><has_metrics>true</has_metrics><cpu>0</cpu><rss>313484</rss><pss>312079</pss><private_dirty>308836</private_dirty><swap>0</swap><real_memory>308836</real_memory><vmsize>874256</vmsize><process_group_id>13645</process_group_id><command>Passenger RubyApp: agra</command></process></processes></group></supergroup></supergroups></info>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe PassengerMetrics::Cloudwatch do
|
4
|
+
context 'with a queue lenght metric' do
|
5
|
+
let(:metric) { PassengerMetrics::Metrics::QueueLength.new }
|
6
|
+
subject { PassengerMetrics::Cloudwatch.new }
|
7
|
+
|
8
|
+
before(:each) do
|
9
|
+
expect(metric).to receive(:unit).and_return(:count)
|
10
|
+
expect(metric).to receive(:value).and_return('0')
|
11
|
+
|
12
|
+
subject.metric = metric
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
it 'should delegate to the queue metric' do
|
17
|
+
expect(subject.send(:unit)).to eq('Count')
|
18
|
+
expect(subject.send(:value)).to eq('0')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe PassengerMetrics::Status do
|
4
|
+
it 'should parse with nokigiri' do
|
5
|
+
expect(subject).to receive(:passenger_status_output).and_return(fixture_string('status.xml'))
|
6
|
+
subject.load!
|
7
|
+
expect(subject.info).to be_a(Hash)
|
8
|
+
expect(subject.info['get_wait_list_size']).to eq('0')
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe PassengerMetrics do
|
4
|
+
it 'should defer to stats' do
|
5
|
+
expect_any_instance_of(PassengerMetrics::Status).to receive(:passenger_status_output).and_return(fixture_string('status.xml'))
|
6
|
+
expect(PassengerMetrics.status.info).to be_a(Hash)
|
7
|
+
end
|
8
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
|
3
|
+
$LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
|
4
|
+
|
5
|
+
require 'passenger-metrics'
|
6
|
+
|
7
|
+
def fixture_path
|
8
|
+
File.expand_path("../fixtures", __FILE__)
|
9
|
+
end
|
10
|
+
|
11
|
+
def fixture(file)
|
12
|
+
File.new(File.join(fixture_path, '/', file))
|
13
|
+
end
|
14
|
+
|
15
|
+
def fixture_string(file)
|
16
|
+
File.read(fixture(file))
|
17
|
+
end
|
data/spec/status_spec.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe PassengerMetrics::Status do
|
4
|
+
it 'should parse with nokigiri' do
|
5
|
+
expect(subject).to receive(:passenger_status_output).and_return(fixture_string('status.xml'))
|
6
|
+
subject.load!
|
7
|
+
expect(subject.info).to be_a(Hash)
|
8
|
+
expect(subject.info['get_wait_list_size']).to eq('0')
|
9
|
+
end
|
10
|
+
end
|
metadata
ADDED
@@ -0,0 +1,182 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: passenger-metrics
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nathan Woodhull
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-03-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: crack
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: aws-sdk
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: jeweler
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 2.0.1
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 2.0.1
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: guard
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: guard-rspec
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: byebug
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
description: Get passenger metrics from passenger-status into the analytics tool of
|
126
|
+
your choice.
|
127
|
+
email: nathan@gcontrolshiftlabs.com
|
128
|
+
executables:
|
129
|
+
- passenger-metrics-cloudwatch
|
130
|
+
extensions: []
|
131
|
+
extra_rdoc_files:
|
132
|
+
- LICENSE
|
133
|
+
- README.md
|
134
|
+
files:
|
135
|
+
- ".rspec"
|
136
|
+
- Gemfile
|
137
|
+
- Gemfile.lock
|
138
|
+
- Guardfile
|
139
|
+
- LICENSE
|
140
|
+
- README.md
|
141
|
+
- Rakefile
|
142
|
+
- VERSION
|
143
|
+
- bin/_guard-core
|
144
|
+
- bin/guard
|
145
|
+
- bin/passenger-metrics-cloudwatch
|
146
|
+
- lib/passenger-metrics.rb
|
147
|
+
- lib/passenger-metrics/cloudwatch.rb
|
148
|
+
- lib/passenger-metrics/metrics/base.rb
|
149
|
+
- lib/passenger-metrics/metrics/queue_length.rb
|
150
|
+
- lib/passenger-metrics/status.rb
|
151
|
+
- passenger-metrics.gemspec
|
152
|
+
- spec/fixtures/status.xml
|
153
|
+
- spec/passenger-metrics/cloudwatch_spec.rb
|
154
|
+
- spec/passenger-metrics/status_spec.rb
|
155
|
+
- spec/passenger_metrics_spec.rb
|
156
|
+
- spec/spec_helper.rb
|
157
|
+
- spec/status_spec.rb
|
158
|
+
homepage: http://github.com/controlshift/passenger-metrics
|
159
|
+
licenses:
|
160
|
+
- MIT
|
161
|
+
metadata: {}
|
162
|
+
post_install_message:
|
163
|
+
rdoc_options: []
|
164
|
+
require_paths:
|
165
|
+
- lib
|
166
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
167
|
+
requirements:
|
168
|
+
- - ">="
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
version: '0'
|
171
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
172
|
+
requirements:
|
173
|
+
- - ">="
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: '0'
|
176
|
+
requirements: []
|
177
|
+
rubyforge_project:
|
178
|
+
rubygems_version: 2.4.8
|
179
|
+
signing_key:
|
180
|
+
specification_version: 4
|
181
|
+
summary: ruby interface to passenger-status
|
182
|
+
test_files: []
|