passenger_datadog 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YTIxMTdhMzFjZmVlMzU1NTIyODk4ZGRhNDg5MzU5MTgwM2IwZWRjMg==
5
+ data.tar.gz: !binary |-
6
+ ZGVlOTk4MGM0M2VlNDM2MDg4MTgxNTBkNjA1NmJjNjhlYzFlZWFhMQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ YTY5OGE3NWQ5ZWFiOTIzZDNiN2Q1ODFjMmEwMjdlMTBhZWZjNTQ5ZjFjNTgy
10
+ N2M4OWM4NWRkZDU5ZjI0MjA4MDc4ZjQ4OTk1ZDcwZWZmOWUzMmM3YzFjN2Y5
11
+ ZTMwMTM3ZTgzMDE1MzE4M2ExM2EwOTk3OWNjMTA5NzlkZDBlMWU=
12
+ data.tar.gz: !binary |-
13
+ ZTAzMjFiZTIzNDA4YWYzZWY1YzQ0YTY2NjNkYzQ4ZTk1NDdlZTVhOGRlZGJm
14
+ MTBlODg0ZmUwMjA5MWY1NGZjODM1ZjhkY2E2MTBjZGY5OTk2OWMwZGVjODBh
15
+ ZDRjMTgzMTBjYmMwNjA1YmJjMGE2MzZlYzc1MWUwNDY3YmQ5NWE=
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Ryan
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
+
data/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # passenger-datadog
2
+
3
+ Inspired by [passengeri-datadog-monitor](https://github.com/Sjeanpierre/passenger-datadog-monitor)
4
+
5
+ This gem can be used to send stats from Passenger to Datadog. It makes use of
6
+ the command `passenger-status`, and the Ruby implementation of `statsd`
7
+ provided by [dogstatsd-ruby](https://github.com/DataDog/dogstatsd-ruby))
8
+
9
+ In order to gather stats on all Passenger instances, Passenger recommends
10
+ running `passenger-status` as `root`. Therefore, it is recommended that
11
+ `passenger_datadog` be run as `root` as well.
12
+
13
+ If running `passenger_datadog` as a user other than the user that owns the application
14
+ in Passenger, make sure that same version of Passenger is installed for both users.
15
+
16
+ ## Installation
17
+ ```
18
+ $ gem install passenger_datadog
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ ### Typical Usage
24
+ ```
25
+ $ passenger-datadog [start|stop|restart|status]
26
+ ```
27
+
28
+ ### Help
29
+ ```
30
+ $ passenger-datadog
31
+ ```
32
+ or
33
+ ```
34
+ $ passenger-datadog [-h|--help]
35
+ ```
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+ $LOAD_PATH.unshift(File.dirname(File.expand_path(__FILE__)) + '/../lib')
3
+ require 'daemons'
4
+ require 'passenger_datadog'
5
+
6
+ Daemons.run_proc('passenger-datadog', :dir_mode => :system) do
7
+ loop do
8
+ PassengerDatadog.run
9
+ sleep(30)
10
+ end
11
+ end
@@ -0,0 +1,43 @@
1
+ require 'nokogiri'
2
+ require 'statsd'
3
+
4
+ class PassengerDatadog
5
+ GROUP_STATS = %w(capacity_used processes_being_spawned enabled_process_count disabling_process_count disabled_process_count).freeze
6
+ PROCESS_STATS = %w(processed sessions busyness concurrency cpu rss private_dirty pss swap real_memory vmsize).freeze
7
+
8
+ class << self
9
+ def run
10
+ status = `passenger-status --show=xml`
11
+ return if status.empty?
12
+
13
+ statsd = Statsd.new
14
+
15
+ statsd.batch do |s|
16
+ # Good job Passenger 4.0.10. Return non xml in your xml output.
17
+ status = status.split("\n")[3..-1].join("\n") unless status.start_with?('<?xml')
18
+ parsed = Nokogiri::XML(status)
19
+
20
+ pool_used = parsed.xpath('//process_count').text
21
+ s.gauge('passenger.pool.used', pool_used)
22
+
23
+ pool_max = parsed.xpath('//max').text
24
+ s.gauge('passenger.pool.max', pool_max)
25
+
26
+ request_queue = parsed.xpath('//supergroups/supergroup/group/get_wait_list_size').text
27
+ s.gauge('passenger.request_queue', request_queue)
28
+
29
+ parsed.xpath('//supergroups/supergroup/group').each do |group|
30
+ GROUP_STATS.each do |stat|
31
+ s.gauge("passenger.#{stat}", group.xpath(stat).text)
32
+ end
33
+ end
34
+
35
+ parsed.xpath('//supergroups/supergroup/group/processes/process').each_with_index do |process, index|
36
+ PROCESS_STATS.each do |stat|
37
+ s.gauge("passenger.#{stat}", process.xpath(stat).text, :tags => ["passenger-process:#{index}"])
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
metadata ADDED
@@ -0,0 +1,171 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: passenger_datadog
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - Ryan Rosenblum
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-10-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: daemons
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: dogstatsd-ruby
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.5'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.5'
41
+ - !ruby/object:Gem::Dependency
42
+ name: nokogiri
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - <=
46
+ - !ruby/object:Gem::Version
47
+ version: 1.5.11
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - <=
53
+ - !ruby/object:Gem::Version
54
+ version: 1.5.11
55
+ - !ruby/object:Gem::Dependency
56
+ name: passenger
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 4.0.0
62
+ - - <=
63
+ - !ruby/object:Gem::Version
64
+ version: 6.0.0
65
+ type: :runtime
66
+ prerelease: false
67
+ version_requirements: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ! '>='
70
+ - !ruby/object:Gem::Version
71
+ version: 4.0.0
72
+ - - <=
73
+ - !ruby/object:Gem::Version
74
+ version: 6.0.0
75
+ - !ruby/object:Gem::Dependency
76
+ name: bundler
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ~>
80
+ - !ruby/object:Gem::Version
81
+ version: '1.3'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ~>
87
+ - !ruby/object:Gem::Version
88
+ version: '1.3'
89
+ - !ruby/object:Gem::Dependency
90
+ name: rake
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ~>
94
+ - !ruby/object:Gem::Version
95
+ version: '10.1'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ~>
101
+ - !ruby/object:Gem::Version
102
+ version: '10.1'
103
+ - !ruby/object:Gem::Dependency
104
+ name: rspec
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: '3.3'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ~>
115
+ - !ruby/object:Gem::Version
116
+ version: '3.3'
117
+ - !ruby/object:Gem::Dependency
118
+ name: rubocop
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ~>
122
+ - !ruby/object:Gem::Version
123
+ version: 0.34.2
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ~>
129
+ - !ruby/object:Gem::Version
130
+ version: 0.34.2
131
+ description: ! ' A tool for sending Passenger stats to Datadog.
132
+
133
+ '
134
+ email: passenger_datadog@manheim.com
135
+ executables:
136
+ - passenger-datadog
137
+ extensions: []
138
+ extra_rdoc_files:
139
+ - LICENSE
140
+ - README.md
141
+ files:
142
+ - LICENSE
143
+ - README.md
144
+ - bin/passenger-datadog
145
+ - lib/passenger_datadog.rb
146
+ homepage: https://github.com/rrosenblum/passenger-datadog
147
+ licenses:
148
+ - MIT
149
+ metadata: {}
150
+ post_install_message:
151
+ rdoc_options: []
152
+ require_paths:
153
+ - lib
154
+ required_ruby_version: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - ! '>='
157
+ - !ruby/object:Gem::Version
158
+ version: 1.8.7
159
+ required_rubygems_version: !ruby/object:Gem::Requirement
160
+ requirements:
161
+ - - ! '>='
162
+ - !ruby/object:Gem::Version
163
+ version: '0'
164
+ requirements: []
165
+ rubyforge_project:
166
+ rubygems_version: 2.4.6
167
+ signing_key:
168
+ specification_version: 4
169
+ summary: A tool for sending Passenger stats to Datadog
170
+ test_files: []
171
+ has_rdoc: