rboss 0.6.0 → 0.6.1

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.
Files changed (53) hide show
  1. data/README.md +2 -2
  2. data/bin/jboss-profile +1 -1
  3. data/bin/rboss-cli +8 -2
  4. data/bin/twiddle +3 -3
  5. data/lib/rboss.rb +6 -2
  6. data/lib/rboss/bin/command_actions.rb +3 -2
  7. data/lib/rboss/cli/jboss_cli.rb +3 -3
  8. data/lib/rboss/cli/mappings.rb +12 -2
  9. data/lib/rboss/cli/mappings/resources/connector.yaml +10 -35
  10. data/lib/rboss/cli/mappings/resources/datasource.yaml +19 -26
  11. data/lib/rboss/cli/mappings/resources/jdbc_driver.yaml +0 -1
  12. data/lib/rboss/cli/mappings/resources/server.yaml +151 -34
  13. data/lib/rboss/cli/resource.rb +18 -10
  14. data/lib/rboss/component_processor.rb +87 -85
  15. data/lib/rboss/components/component.rb +2 -2
  16. data/lib/rboss/components/datasource.rb +1 -1
  17. data/lib/rboss/components/deploy_folder.rb +1 -1
  18. data/lib/rboss/components/hypersonic_replacer.rb +1 -1
  19. data/lib/rboss/components/jbossweb.rb +1 -1
  20. data/lib/rboss/components/jmx.rb +1 -1
  21. data/lib/rboss/components/mod_cluster.rb +1 -1
  22. data/lib/rboss/components/org/6.0/deploy_folder.rb +1 -1
  23. data/lib/rboss/components/org/jmx.rb +1 -1
  24. data/lib/rboss/components/profile_folder.rb +1 -1
  25. data/lib/rboss/components/resource.rb +1 -1
  26. data/lib/rboss/components/restore_slimming.rb +3 -3
  27. data/lib/rboss/components/run_conf.rb +4 -4
  28. data/lib/rboss/components/service_script.rb +1 -1
  29. data/lib/rboss/components/slimming.rb +1 -1
  30. data/lib/rboss/components/soa-p/hypersonic_replacer.rb +1 -1
  31. data/lib/rboss/components/soa-p/jmx.rb +1 -1
  32. data/lib/rboss/components/xadatasource.rb +2 -2
  33. data/lib/rboss/file_processor.rb +70 -66
  34. data/lib/rboss/jboss_path.rb +1 -1
  35. data/lib/rboss/jboss_profile.rb +28 -27
  36. data/lib/rboss/plaftorm.rb +64 -0
  37. data/lib/rboss/resources/run.conf.bat.erb +60 -0
  38. data/lib/rboss/twiddle/base_monitor.rb +2 -2
  39. data/lib/rboss/twiddle/mbean.rb +1 -1
  40. data/lib/rboss/twiddle/monitor.rb +26 -39
  41. data/lib/rboss/twiddle/twiddle.rb +3 -2
  42. data/lib/rboss/utils.rb +0 -62
  43. data/lib/rboss/version.rb +1 -1
  44. data/lib/rboss/view/colorizers.rb +20 -0
  45. data/lib/rboss/view/formatters.rb +21 -0
  46. data/lib/rboss/view/health_checkers.rb +41 -0
  47. data/lib/rboss/view/table_builder.rb +93 -0
  48. data/test/test_helper.rb +1 -1
  49. metadata +8 -6
  50. data/lib/rboss/cli.rb +0 -22
  51. data/lib/rboss/cli/colorizers.rb +0 -22
  52. data/lib/rboss/cli/formatters.rb +0 -17
  53. data/lib/rboss/cli/health_checkers.rb +0 -43
data/README.md CHANGED
@@ -50,7 +50,7 @@ Extending mbeans
50
50
 
51
51
  You can use a file in ~/.rboss/twiddle.rb for mapping new mbeans or overriding the defaults
52
52
 
53
- JBoss::Twiddle::Monitor.defaults[:http_request] = {
53
+ RBoss::Twiddle::Monitor.defaults[:http_request] = {
54
54
  :description => 'Request for http protocol',
55
55
  :pattern => 'jboss.web:type=GlobalRequestProcessor,name=http-127.0.0.1-8080',
56
56
  :properties => %W(requestCount errorCount maxTime)
@@ -77,7 +77,7 @@ And used with -c or --config
77
77
  Every time you run the twiddle command, this gem will load the ~/.rboss/twiddle.rb file,
78
78
  which can be used to customize the mbeans.
79
79
 
80
- defaults = JBoss::Twiddle::Monitor.defaults
80
+ defaults = RBoss::Twiddle::Monitor.defaults
81
81
  defaults[:logger] = {
82
82
  :description => 'Logger Service',
83
83
  :pattern => 'jboss.system:service=Logging,type=Logger'
@@ -93,7 +93,7 @@ if params.empty?
93
93
  end
94
94
 
95
95
  params[:jboss_home] ||= Dir.pwd unless ENV["JBOSS_HOME"]
96
- profile = JBoss::Profile::new params
96
+ profile = RBoss::Profile::new params
97
97
 
98
98
  if params[:slimming]
99
99
  profile.slim *params[:slimming]
@@ -86,7 +86,7 @@ opts.on('-v', '--verbose', 'Displays jboss-cli commands before execution') do
86
86
  params[:log_level] = Logger::DEBUG
87
87
  end
88
88
 
89
- JBoss::Cli::Mappings.resource_mappings.each do |name, config|
89
+ RBoss::Cli::Mappings.resource_mappings.each do |name, config|
90
90
  if config[:scan]
91
91
  opts.on("--#{name} [NAMES]", Array, config[:description]) do |resources|
92
92
  @components[name] = resources || :all
@@ -98,12 +98,18 @@ JBoss::Cli::Mappings.resource_mappings.each do |name, config|
98
98
  end
99
99
  end
100
100
 
101
+ opts.on('--all', 'Display all available info') do
102
+ RBoss::Cli::Mappings.resource_mappings.each do |name, config|
103
+ @components[name] = :all unless config[:derived]
104
+ end
105
+ end
106
+
101
107
  opts.on("-h", "--help", "Shows this help message") do
102
108
  puts opts; exit
103
109
  end
104
110
  opts.parse!(ARGV) rescue abort 'Invalid Option! Use --help or -h for usage help.'
105
111
 
106
- @jboss_cli = JBoss::Cli::Invoker::new params
112
+ @jboss_cli = RBoss::Cli::Invoker::new params
107
113
 
108
114
  unless $stdout.isatty
109
115
  require 'yummi/no_colors'
@@ -39,7 +39,7 @@ servers_file = "#{@conf_dir}/twiddle.yaml"
39
39
  save = false
40
40
  params[:jboss_home] = (ENV["JBOSS_HOME"] or ENV["TWIDDLE_HOME"] or Dir.pwd)
41
41
 
42
- defaults = JBoss::Twiddle::Monitor::defaults
42
+ defaults = RBoss::Twiddle::Monitor::defaults
43
43
 
44
44
  def load_yaml
45
45
  return Hash::new unless File.exist?(@servers_file)
@@ -156,7 +156,7 @@ opts.on("-h", "--help", "Shows this help message") do
156
156
  end
157
157
  opts.parse!(ARGV) #rescue abort 'Invalid Option! Use --help or -h for usage help.'
158
158
 
159
- @twiddle = JBoss::Twiddle::Invoker::new params
159
+ @twiddle = RBoss::Twiddle::Invoker::new params
160
160
 
161
161
  if save
162
162
  config = load_yaml
@@ -182,7 +182,7 @@ end
182
182
 
183
183
  puts opts if @mbeans.empty? and @commands.empty?
184
184
 
185
- @actions = JBoss::CommandActions::Twiddle::new @twiddle,
185
+ @actions = RBoss::CommandActions::Twiddle::new @twiddle,
186
186
  :no_details => no_details,
187
187
  :mbeans => defaults
188
188
 
@@ -21,8 +21,12 @@
21
21
  # THE SOFTWARE.
22
22
 
23
23
  require_relative "rboss/version"
24
+ require_relative "rboss/plaftorm"
24
25
  require_relative "rboss/jboss_profile"
25
26
  require_relative "rboss/twiddle"
26
- require_relative "rboss/cli"
27
+ require_relative "rboss/cli/jboss_cli"
27
28
  require_relative "rboss/bin/command_actions"
28
-
29
+ require_relative "rboss/view/colorizers"
30
+ require_relative "rboss/view/formatters"
31
+ require_relative "rboss/view/health_checkers"
32
+ require_relative "rboss/view/table_builder"
@@ -20,7 +20,7 @@
20
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
21
  # THE SOFTWARE.
22
22
 
23
- module JBoss
23
+ module RBoss
24
24
  module CommandActions
25
25
  class Twiddle
26
26
 
@@ -88,7 +88,7 @@ module JBoss
88
88
  def detail mbeans
89
89
  buff = ""
90
90
  mbeans.each do |mbean_id, resources|
91
- builder = TableBuilder::new @opts[:mbeans][mbean_id]
91
+ builder = RBoss::TableBuilder::new @opts[:mbeans][mbean_id]
92
92
  rows = []
93
93
  if resources.is_a? TrueClass
94
94
  row = []
@@ -113,6 +113,7 @@ module JBoss
113
113
  table = builder.build_table
114
114
  table.data = rows
115
115
  buff << table.to_s
116
+ buff << $/
116
117
  end
117
118
  buff
118
119
  end
@@ -25,12 +25,12 @@ require_relative 'mappings'
25
25
 
26
26
  require 'logger'
27
27
 
28
- module JBoss
28
+ module RBoss
29
29
 
30
30
  module Cli
31
31
 
32
32
  class Invoker
33
- include JBoss::Cli::Mappings
33
+ include RBoss::Cli::Mappings, RBoss::Platform
34
34
 
35
35
  attr_reader :server, :host, :port, :user, :password
36
36
 
@@ -73,7 +73,7 @@ module JBoss
73
73
  components.each do |key, resources|
74
74
  if resource_mappings.has_key? key
75
75
  mapping = resource_mappings[key]
76
- component = JBoss::Cli::Resource::new(self, mapping)
76
+ component = RBoss::Cli::Resource::new(self, mapping)
77
77
  buff << component.content(resources)
78
78
  end
79
79
  end
@@ -22,7 +22,7 @@
22
22
 
23
23
  require 'yaml'
24
24
 
25
- module JBoss
25
+ module RBoss
26
26
  module Cli
27
27
  module Mappings
28
28
 
@@ -35,7 +35,17 @@ module JBoss
35
35
  def load_resource(file)
36
36
  name = File.basename(file, '.yaml').gsub('_', '-')
37
37
  mapping = YAML::load_file(file).symbolize_keys
38
- @resource_mappings[name.to_sym] = mapping
38
+ @resource_mappings[name] = mapping
39
+ mapping[:print].each do |table|
40
+ if table[:id]
41
+ new_mapping = mapping.dup
42
+ new_mapping[:print] = [table]
43
+ new_mapping[:description] = table[:title]
44
+ new_mapping[:derived] = true
45
+ new_key = "#{name}-#{table[:id]}"
46
+ @resource_mappings[new_key] = new_mapping
47
+ end
48
+ end
39
49
  end
40
50
 
41
51
  def load_resources(dir)
@@ -4,7 +4,6 @@ path: /subsystem=web/connector=${NAME}
4
4
  scan: ls ${PATH}
5
5
  print:
6
6
  - title: Connectors
7
- command: ${PATH}:read-resource(include-runtime=true)
8
7
  layout: vertical
9
8
  properties:
10
9
  - scheme
@@ -37,39 +36,15 @@ print:
37
36
  - Enabled
38
37
 
39
38
  format:
40
- - column: bytes_received
41
- component: byte
42
-
43
- - column: bytes_sent
44
- component: byte
45
-
46
- - column: max_post_size
47
- component: byte
48
-
49
- - column: max_save_post_size
50
- component: byte
51
-
52
- - column: enabled
53
- component: yes_or_no
54
-
55
- - column: secure
56
- component: yes_or_no
39
+ bytes_received: byte
40
+ bytes_sent: byte
41
+ max_post_size: byte
42
+ max_save_post_size: byte
43
+ enabled: yes_or_no
44
+ secure: yes_or_no
57
45
 
58
46
  color:
59
- - column: scheme
60
- component: with
61
- params:
62
- color: purple
63
-
64
- - column: enabled
65
- component: boolean
66
- params:
67
- if_true: green
68
- if_false: red
69
-
70
- - column: secure
71
- component: boolean
72
- params:
73
- if_true: green
74
- if_false: brown
75
-
47
+ scheme:
48
+ with: purple
49
+ enabled: boolean
50
+ secure: boolean
@@ -3,8 +3,8 @@ description: Detail Datasource Information
3
3
  path: /subsystem=datasources/data-source=${NAME}
4
4
  scan: ls ${PATH}
5
5
  print:
6
- - title: Datasource Details
7
- command: ${PATH}:read-resource(include-runtime=true)
6
+ - id: config
7
+ title: Datasource Details
8
8
  layout: vertical
9
9
  properties:
10
10
  - jndi-name
@@ -27,26 +27,19 @@ print:
27
27
  - Max Pool Size
28
28
  - Enabled
29
29
  format:
30
- - column: enabled
31
- component: yes_or_no
32
-
33
- - column: using_jta
34
- component: yes_or_no
30
+ enabled: yes_or_no
31
+ using_jta: yes_or_no
35
32
 
36
33
  color:
37
- - column: jndi_name
38
- component: with
39
- params:
40
- color: purple
41
-
42
- - column: enabled
43
- component: boolean
44
- params:
45
- if_true: green
46
- if_false: red
34
+ jndi_name:
35
+ with: purple
36
+ enabled: boolean
37
+ connection_url:
38
+ with: brown
47
39
 
48
- - title: Datasource Pool Statistics
49
- command: ${PATH}/statistics=pool:read-resource(include-runtime=true)
40
+ - id: pool
41
+ title: Datasource Pool Statistics
42
+ command: ${PATH}/statistics=pool:${READ_RESOURCE}
50
43
  layout: vertical
51
44
  properties:
52
45
  - ActiveCount
@@ -76,14 +69,14 @@ print:
76
69
  - Total Creation
77
70
 
78
71
  health:
79
- - column: active
80
- component: percentage
81
- params:
82
- max: available
83
- using: active
72
+ active:
73
+ percentage:
74
+ max: available
75
+ using: active
84
76
 
85
- - title: Datasource JDBC Statistics
86
- command: ${PATH}/statistics=jdbc:read-resource(include-runtime=true)
77
+ - id: jdbc
78
+ title: Datasource JDBC Statistics
79
+ command: ${PATH}/statistics=jdbc:${READ_RESOURCE}
87
80
  properties:
88
81
  - PreparedStatementCacheCurrentSize
89
82
  - PreparedStatementCacheAccessCount
@@ -4,7 +4,6 @@ path: /subsystem=datasources/jdbc-driver=${NAME}
4
4
  scan: ls ${PATH}
5
5
  print:
6
6
  - title: JDBC Drivers
7
- command: ${PATH}:read-resource
8
7
  properties:
9
8
  - driver-module-name
10
9
  - driver-xa-datasource-class-name
@@ -1,9 +1,28 @@
1
1
  ---
2
2
  description: Detail Server Information
3
- path:
3
+ path: /core-service=
4
4
  print:
5
- - title: Server Runtime Information
6
- command: /core-service=server-environment:read-resource(include-runtime=true)
5
+ - id: platform
6
+ title: Operating System Information
7
+ command: ${PATH}platform-mbean/type=operating-system:${READ_RESOURCE}
8
+ properties:
9
+ - name
10
+ - arch
11
+ - version
12
+ - available-processors
13
+ - system-load-average
14
+ header:
15
+ - Name
16
+ - Arch
17
+ - Version
18
+ - Processors
19
+ - System Load
20
+ format:
21
+ system_load: percentage
22
+
23
+ - id: env
24
+ title: Server Environment Information
25
+ command: ${PATH}server-environment:${READ_RESOURCE}
7
26
  properties:
8
27
  - server-name
9
28
  - node-name
@@ -17,33 +36,133 @@ print:
17
36
  - Initial Running Mode
18
37
  - Launch Type
19
38
  color:
20
- - column: server_name
21
- component: with
22
- params:
23
- color: white
24
-
25
- - column: node_name
26
- component: with
27
- params:
28
- color: blue
29
-
30
- - column: host_name
31
- component: with
32
- params:
33
- color: brown
34
-
35
- - column: initial_running_mode
36
- component: with
37
- params:
38
- color: purple
39
-
40
- - column: launch_type
41
- component: with
42
- params:
43
- color: cyan
44
-
45
- - title: Server Configuration Resources
46
- command: /core-service=server-environment:read-resource(include-runtime=true)
39
+ server_name:
40
+ with: white
41
+
42
+ node_name:
43
+ with: blue
44
+
45
+ host_name:
46
+ with: brown
47
+
48
+ initial_running_mode:
49
+ with: purple
50
+
51
+ launch_type:
52
+ with: cyan
53
+
54
+ - id: memory
55
+ title: Server Memory Usage
56
+ layout: vertical
57
+ command: ${PATH}platform-mbean/type=memory:${READ_RESOURCE}
58
+ properties:
59
+ - heap-memory-usage -> init
60
+ - heap-memory-usage -> used
61
+ - heap-memory-usage -> committed
62
+ - heap-memory-usage -> max
63
+ - non-heap-memory-usage -> init
64
+ - non-heap-memory-usage -> used
65
+ - non-heap-memory-usage -> committed
66
+ - non-heap-memory-usage -> max
67
+ - object-pending-finalization-count
68
+ header:
69
+ - Initial Heap
70
+ - Used Heap
71
+ - Committed Heap
72
+ - Max Heap
73
+ - Initial Non Heap
74
+ - Used Non Heap
75
+ - Committed Non Heap
76
+ - Max Non Heap
77
+ - Objects Pending Finalization
78
+ format:
79
+ initial_heap: byte
80
+ used_heap: byte
81
+ committed_heap: byte
82
+ max_heap: byte
83
+ initial_non_heap: byte
84
+ used_non_heap: byte
85
+ committed_non_heap: byte
86
+ max_non_heap: byte
87
+
88
+ color:
89
+ max_heap:
90
+ with: intense_purple
91
+
92
+ max_non_heap:
93
+ with: intense_purple
94
+
95
+ committed_heap:
96
+ with: purple
97
+
98
+ committed_non_heap:
99
+ with: purple
100
+
101
+ health:
102
+ used_heap:
103
+ percentage:
104
+ max: max_heap
105
+ using: used_heap
106
+
107
+ used_non_heap:
108
+ percentage:
109
+ max: max_non_heap
110
+ using: used_non_heap
111
+
112
+ - id: thread
113
+ title: Server Thread Info
114
+ command: ${PATH}platform-mbean/type=threading:${READ_RESOURCE}
115
+ layout: vertical
116
+ properties:
117
+ - thread-contention-monitoring-supported
118
+ - thread-cpu-time-supported
119
+ - current-thread-cpu-time-supported
120
+ - object-monitor-usage-supported
121
+ - synchronizer-usage-supported
122
+ - thread-contention-monitoring-enabled
123
+ - thread-cpu-time-enabled
124
+ - thread-count
125
+ - peak-thread-count
126
+ - total-started-thread-count
127
+ - daemon-thread-count
128
+ - current-thread-cpu-time
129
+ - current-thread-user-time
130
+ header:
131
+ - Thread Contention Monitoring Supported
132
+ - Thread CPU Time Supported
133
+ - Current Thread CPU Time Supported
134
+ - Object Monitor Usage Supported
135
+ - Synchronizer Usage Supported
136
+ - Thread Contention Monitoring Enabled
137
+ - Thread CPU Time Enabled
138
+ - Thread Count
139
+ - Peak Thread Count
140
+ - Total Started Thread Count
141
+ - Daemon Thread Count
142
+ - Current Thread CPU Time
143
+ - CUrrent Thread User Time
144
+
145
+ format:
146
+ thread_contention_monitoring_supported: yes_or_no
147
+ thread_cpu_time_supported: yes_or_no
148
+ current_thread_cpu_time_supported: yes_or_no
149
+ object_monitor_usage_supported: yes_or_no
150
+ synchronizer_usage_supported: yes_or_no
151
+ thread_contention_monitoring_enabled: yes_or_no
152
+ thread_cpu_time_enabled: yes_or_no
153
+
154
+ color:
155
+ thread_contention_monitoring_supported: boolean
156
+ thread_cpu_time_supported: boolean
157
+ current_thread_cpu_time_supported: boolean
158
+ object_monitor_usage_supported: boolean
159
+ synchronizer_usage_supported: boolean
160
+ thread_contention_monitoring_enabled: boolean
161
+ thread_cpu_time_enabled: boolean
162
+
163
+ - id: config
164
+ title: Server Configuration Resources
165
+ command: ${PATH}server-environment:${READ_RESOURCE}
47
166
  layout: vertical
48
167
  properties:
49
168
  - server-name
@@ -68,7 +187,5 @@ print:
68
187
  - Log Directory
69
188
  - Temp Directory
70
189
  color:
71
- - column: server_name
72
- component: with
73
- params:
74
- color: white
190
+ server_name:
191
+ with: white