check_passenger 0.1 → 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/TODO.md CHANGED
@@ -1,6 +1,25 @@
1
1
  # Release
2
2
 
3
3
  - README page.
4
+ - Add summary to command help.
5
+
6
+
7
+ # Fix
8
+
9
+ - Handle error:
10
+
11
+ ```
12
+ It appears that multiple Passenger instances are running. Please select a
13
+ specific one by running:
14
+
15
+ passenger-status <PID>
16
+
17
+ The following Passenger instances are running:
18
+ PID: 1394
19
+ PID: 1413
20
+ ```
21
+
22
+ - "1 live processes" should be "1 live process"
4
23
 
5
24
 
6
25
  # Other
@@ -41,7 +41,7 @@ module CheckPassenger
41
41
  counter = parsed_data.send(counter_name.to_sym, app_name)
42
42
  output_data << {
43
43
  text: '%s %s' % [app_name, COUNTER_LABELS[counter_name.to_sym] % counter],
44
- counter: counter_name.to_s, value: counter
44
+ counter: app_name, value: counter
45
45
  }
46
46
  end
47
47
  end
@@ -15,22 +15,29 @@ module CheckPassenger
15
15
  end
16
16
 
17
17
  data = [data] unless data.is_a?(Array)
18
+ main_status = nil
19
+ status_data = []
20
+ perf_data = []
18
21
 
19
22
  data.each do |line|
20
23
  raise ArgumentError, 'No status text provided' unless line.has_key?(:text)
21
24
 
22
- if line[:counter] and line[:value]
23
- puts '%s|%s=%d;%s;%s;%s;%s' % [
24
- line[:text],
25
- line[:counter], line[:value],
26
- line[:warn], line[:crit],
27
- line[:min], line[:max]
28
- ]
25
+ if main_status.nil?
26
+ main_status = line[:text]
29
27
  else
30
- puts line[:text]
28
+ status_data << line[:text]
31
29
  end
30
+
31
+ perf_data << '%s=%d;%s;%s;%s;%s' % [
32
+ line[:counter], line[:value],
33
+ line[:warn], line[:crit],
34
+ line[:min], line[:max]
35
+ ]
32
36
  end
33
37
 
38
+ puts '%s|%s' % [main_status, perf_data.join(' ')]
39
+ status_data.each { |status_datum| puts status_datum }
40
+
34
41
  exit EXIT_CODES[status]
35
42
  end
36
43
 
@@ -1,3 +1,3 @@
1
1
  module CheckPassenger
2
- VERSION = "0.1"
2
+ VERSION = "0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: check_passenger
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: '0.2'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-09-13 00:00:00.000000000 Z
12
+ date: 2014-09-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler