passenger_status 0.0.2

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.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in passenger_status.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,3 @@
1
+ module PassengerStatus
2
+ VERSION = "0.0.2"
3
+ end
@@ -0,0 +1,88 @@
1
+ module PassengerStatus
2
+ #Passenger Status
3
+ def self.passenger_stat
4
+ pass_stat = Hash.new
5
+ status = `rvmsudo passenger-status`
6
+ unless $?.success?
7
+ return("Error executing commmand")
8
+ exit 1
9
+ end
10
+
11
+ status =~ /max\s+=\s+(\d+)/
12
+ pass_stat[:max] = $1
13
+
14
+ status =~ /count\s+=\s+(\d+)/
15
+ pass_stat[:count] = $1
16
+
17
+ status =~ /active\s+=\s+(\d+)/
18
+ pass_stat[:active] = $1
19
+
20
+ status =~ /inactive\s+=\s+(\d+)/
21
+ pass_stat[:inactive] = $1
22
+
23
+ status =~ /(Waiting on global queue:)\s+(\d+)/
24
+ pass_stat[:queued] = $2
25
+
26
+ status =~ /\Sessions:\s+(\d+)/
27
+ pass_stat[:sessions] = $1
28
+
29
+ status =~ /\Processed:\s+(\d+)/
30
+ pass_stat[:processed] = $1
31
+
32
+ return(pass_stat)
33
+ end
34
+
35
+ #Passenger Memory Stats
36
+ def self.passenger_memory
37
+
38
+ pass_mem = Hash.new
39
+ mem_status = `rvmsudo passenger-memory-stats`
40
+ unless $?.success?
41
+ return("Error executing commmand")
42
+ exit 1
43
+ end
44
+ #There must be a better way
45
+
46
+ #PassengerWatchdog
47
+ mem_status =~ /(^.*?PassengerWatchdog)/
48
+ watch_dog = $1.scan(/([0-9]+.[0-9])+/)
49
+ watch_vm = watch_dog[1]
50
+ watch_private = watch_dog[2]
51
+ pass_mem[:PassengerWatchdog] = {:vm_size=>watch_vm,:private=>watch_private}
52
+
53
+ #PassengerHelperAgent
54
+ mem_status =~ /(^.*?PassengerHelperAgent)/
55
+ helper_agent = $1.scan(/([0-9]+.[0-9])+/)
56
+ helper_vm = helper_agent[1]
57
+ helper_private = helper_agent[2]
58
+ pass_mem[:PassengerHelperAgent] = {:vm_size=>helper_vm,:private=>helper_private}
59
+ #Passenger spawn server
60
+ mem_status =~ /(^.*?Passenger spawn server)/
61
+ spawn_server = $1.scan(/([0-9]+.[0-9])+/)
62
+ spawn_vm = spawn_server[1]
63
+ spawn_private = spawn_server[2]
64
+ pass_mem[:PassengerSpawnServer] = {:vm_size=>spawn_vm,:private=>spawn_private}
65
+
66
+ #PassengerLoggingAgent
67
+ mem_status =~ /(^.*?PassengerLoggingAgent)/
68
+ logging_agent = $1.scan(/([0-9]+.[0-9])+/)
69
+ logging_vm = logging_agent[1]
70
+ logging_private = logging_agent[2]
71
+ pass_mem[:PassengerSpawnServer] = {:vm_size=>spawn_vm,:private=>spawn_private}
72
+
73
+ #Rack
74
+ #Assume only one application is running
75
+ mem_status =~ /(^.*?Rack)/
76
+ rack = $1.scan(/([0-9]+.[0-9])+/)
77
+ rack_vm = rack[1]
78
+ rack_private = rack[2]
79
+ pass_mem[:Rack] = {:vm_size=>rack_vm,:private=>rack_private}
80
+ return(pass_mem)
81
+
82
+ end
83
+ end
84
+
85
+
86
+
87
+
88
+
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "passenger_status/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "passenger_status"
7
+ s.version = PassengerStatus::VERSION
8
+ s.authors = ["Dwayne Campbell"]
9
+ s.email = ["dwaynecampbell13@gmail.com"]
10
+ s.homepage = "https://github.com/skillachie/passenger_status"
11
+ s.summary = %q{Obtains Phusion Passenger Status}
12
+ s.description = %q{Obtains the current status of Passenger by parsing results from passenger-status & passenger-memory-stats}
13
+
14
+ s.rubyforge_project = "passenger_status"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ end
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: passenger_status
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 2
10
+ version: 0.0.2
11
+ platform: ruby
12
+ authors:
13
+ - Dwayne Campbell
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-04-08 00:00:00 Z
19
+ dependencies: []
20
+
21
+ description: Obtains the current status of Passenger by parsing results from passenger-status & passenger-memory-stats
22
+ email:
23
+ - dwaynecampbell13@gmail.com
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files: []
29
+
30
+ files:
31
+ - .gitignore
32
+ - Gemfile
33
+ - Rakefile
34
+ - lib/passenger_status.rb
35
+ - lib/passenger_status/version.rb
36
+ - passenger_status.gemspec
37
+ homepage: https://github.com/skillachie/passenger_status
38
+ licenses: []
39
+
40
+ post_install_message:
41
+ rdoc_options: []
42
+
43
+ require_paths:
44
+ - lib
45
+ required_ruby_version: !ruby/object:Gem::Requirement
46
+ none: false
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ hash: 3
51
+ segments:
52
+ - 0
53
+ version: "0"
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ hash: 3
60
+ segments:
61
+ - 0
62
+ version: "0"
63
+ requirements: []
64
+
65
+ rubyforge_project: passenger_status
66
+ rubygems_version: 1.8.17
67
+ signing_key:
68
+ specification_version: 3
69
+ summary: Obtains Phusion Passenger Status
70
+ test_files: []
71
+