rboss 0.5.6 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/bin/jboss-profile +5 -1
- data/bin/rboss-cli +142 -0
- data/bin/twiddle +7 -3
- data/lib/rboss.rb +2 -1
- data/lib/rboss/bin/command_actions.rb +6 -7
- data/lib/rboss/cli.rb +22 -0
- data/lib/rboss/cli/colorizers.rb +22 -0
- data/lib/rboss/cli/formatters.rb +17 -0
- data/lib/rboss/cli/health_checkers.rb +43 -0
- data/lib/rboss/cli/jboss_cli.rb +93 -0
- data/lib/rboss/{table_builder.rb → cli/mappings.rb} +32 -47
- data/lib/rboss/cli/mappings/resources/connector.yaml +75 -0
- data/lib/rboss/cli/mappings/resources/datasource.yaml +113 -0
- data/lib/rboss/cli/mappings/resources/jdbc_driver.yaml +13 -0
- data/lib/rboss/cli/mappings/resources/server.yaml +74 -0
- data/lib/rboss/cli/resource.rb +112 -0
- data/lib/rboss/component_processor.rb +1 -1
- data/lib/rboss/components/component.rb +1 -1
- data/lib/rboss/components/datasource.rb +1 -1
- data/lib/rboss/components/deploy_folder.rb +1 -1
- data/lib/rboss/components/hypersonic_replacer.rb +1 -1
- data/lib/rboss/components/jbossweb.rb +1 -1
- data/lib/rboss/components/jmx.rb +1 -1
- data/lib/rboss/components/mod_cluster.rb +1 -1
- data/lib/rboss/components/org/6.0/deploy_folder.rb +1 -1
- data/lib/rboss/components/org/jmx.rb +1 -1
- data/lib/rboss/components/profile_folder.rb +1 -1
- data/lib/rboss/components/resource.rb +1 -1
- data/lib/rboss/components/restore_slimming.rb +1 -1
- data/lib/rboss/components/run_conf.rb +1 -1
- data/lib/rboss/components/service_script.rb +1 -1
- data/lib/rboss/components/slimming.rb +1 -1
- data/lib/rboss/components/soa-p/hypersonic_replacer.rb +1 -1
- data/lib/rboss/components/soa-p/jmx.rb +1 -1
- data/lib/rboss/components/xadatasource.rb +1 -1
- data/lib/rboss/file_processor.rb +1 -1
- data/lib/rboss/jboss_path.rb +1 -1
- data/lib/rboss/jboss_profile.rb +1 -1
- data/lib/rboss/twiddle.rb +1 -1
- data/lib/rboss/twiddle/base_monitor.rb +1 -1
- data/lib/rboss/twiddle/mbean.rb +1 -1
- data/lib/rboss/twiddle/monitor.rb +57 -39
- data/lib/rboss/twiddle/twiddle.rb +1 -1
- data/lib/rboss/utils.rb +80 -1
- data/lib/rboss/version.rb +2 -2
- data/test/datasource_test.rb +1 -1
- data/test/deploy_folder_test.rb +1 -1
- data/test/jbossweb_test.rb +1 -1
- data/test/mbean_test.rb +1 -1
- data/test/test_helper.rb +1 -1
- data/test/test_suite.rb +1 -1
- metadata +16 -4
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License
|
2
2
|
#
|
3
|
-
# Copyright (c) 2011 Marcelo Guimarães <ataxexe@gmail.com>
|
3
|
+
# Copyright (c) 2011-2012 Marcelo Guimarães <ataxexe@gmail.com>
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -20,60 +20,45 @@
|
|
20
20
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
21
|
# THE SOFTWARE.
|
22
22
|
|
23
|
-
require '
|
23
|
+
require 'yaml'
|
24
24
|
|
25
|
-
|
25
|
+
module JBoss
|
26
|
+
module Cli
|
27
|
+
module Mappings
|
26
28
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
@table.header = params[:header]
|
32
|
-
if params[:layout] == :vertical
|
33
|
-
@table.layout = :vertical
|
34
|
-
@table.default_align = :left
|
35
|
-
end
|
36
|
-
if params[:health]
|
37
|
-
@table.row_colorizer HealthColorizer::new params[:health]
|
38
|
-
end
|
39
|
-
if params[:byte_formatter]
|
40
|
-
params[:byte_formatter].each do |column|
|
41
|
-
@table.format column, :using => Yummi::Formatters::byte
|
29
|
+
def resource_mappings
|
30
|
+
@resource_mappings ||= {}
|
31
|
+
load_default_resources if @resource_mappings.empty?
|
32
|
+
@resource_mappings
|
42
33
|
end
|
43
|
-
end
|
44
|
-
end
|
45
34
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
@table.data = data
|
52
|
-
end
|
53
|
-
|
54
|
-
def table
|
55
|
-
@table
|
56
|
-
end
|
57
|
-
|
58
|
-
end
|
35
|
+
def load_resource(file)
|
36
|
+
name = File.basename(file, '.yaml').gsub('_', '-')
|
37
|
+
mapping = YAML::load_file(file).symbolize_keys
|
38
|
+
@resource_mappings[name.to_sym] = mapping
|
39
|
+
end
|
59
40
|
|
60
|
-
|
41
|
+
def load_resources(dir)
|
42
|
+
resource_files = Dir.entries(dir).find_all { |f| f.end_with?('.yaml') }
|
43
|
+
resource_files.each do |file|
|
44
|
+
load_resource File.join(dir, file)
|
45
|
+
end
|
46
|
+
end
|
61
47
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
48
|
+
def load_default_resources
|
49
|
+
load_resources File.join(File.dirname(__FILE__), 'mappings/resources')
|
50
|
+
file = File.expand_path("~/.rboss/rboss-cli/resources")
|
51
|
+
if File.exist? file
|
52
|
+
load_resources file
|
53
|
+
end
|
54
|
+
end
|
67
55
|
|
68
|
-
|
69
|
-
|
70
|
-
|
56
|
+
module_function :load_resources,
|
57
|
+
:load_resource,
|
58
|
+
:resource_mappings,
|
59
|
+
:load_default_resources
|
71
60
|
|
72
|
-
|
61
|
+
end
|
73
62
|
|
74
|
-
return :red if percentage <= 0.15
|
75
|
-
return :brown if percentage <= 0.30
|
76
|
-
:green
|
77
63
|
end
|
78
|
-
|
79
64
|
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
---
|
2
|
+
description: Details Connectors
|
3
|
+
path: /subsystem=web/connector=${NAME}
|
4
|
+
scan: ls ${PATH}
|
5
|
+
print:
|
6
|
+
- title: Connectors
|
7
|
+
command: ${PATH}:read-resource(include-runtime=true)
|
8
|
+
layout: vertical
|
9
|
+
properties:
|
10
|
+
- scheme
|
11
|
+
- socket-binding
|
12
|
+
- protocol
|
13
|
+
- bytesReceived
|
14
|
+
- bytesSent
|
15
|
+
- secure
|
16
|
+
- processingTime
|
17
|
+
- requestCount
|
18
|
+
- errorCount
|
19
|
+
- max-connections
|
20
|
+
- max-post-size
|
21
|
+
- max-save-post-size
|
22
|
+
- enabled
|
23
|
+
|
24
|
+
header:
|
25
|
+
- Scheme
|
26
|
+
- Socket
|
27
|
+
- Protocol
|
28
|
+
- Bytes Received
|
29
|
+
- Bytes Sent
|
30
|
+
- Secure
|
31
|
+
- Processing
|
32
|
+
- Requests
|
33
|
+
- Errors
|
34
|
+
- Max Connnections
|
35
|
+
- Max Post Size
|
36
|
+
- Max Save Post Size
|
37
|
+
- Enabled
|
38
|
+
|
39
|
+
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
|
57
|
+
|
58
|
+
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
|
+
|
@@ -0,0 +1,113 @@
|
|
1
|
+
---
|
2
|
+
description: Detail Datasource Information
|
3
|
+
path: /subsystem=datasources/data-source=${NAME}
|
4
|
+
scan: ls ${PATH}
|
5
|
+
print:
|
6
|
+
- title: Datasource Details
|
7
|
+
command: ${PATH}:read-resource(include-runtime=true)
|
8
|
+
layout: vertical
|
9
|
+
properties:
|
10
|
+
- jndi-name
|
11
|
+
- connection-url
|
12
|
+
- driver-name
|
13
|
+
- user-name
|
14
|
+
- password
|
15
|
+
- jta
|
16
|
+
- min-pool-size
|
17
|
+
- max-pool-size
|
18
|
+
- enabled
|
19
|
+
header:
|
20
|
+
- JNDI Name
|
21
|
+
- Connection URL
|
22
|
+
- Driver Name
|
23
|
+
- User Name
|
24
|
+
- Password
|
25
|
+
- Using JTA
|
26
|
+
- Min Pool Size
|
27
|
+
- Max Pool Size
|
28
|
+
- Enabled
|
29
|
+
format:
|
30
|
+
- column: enabled
|
31
|
+
component: yes_or_no
|
32
|
+
|
33
|
+
- column: using_jta
|
34
|
+
component: yes_or_no
|
35
|
+
|
36
|
+
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
|
47
|
+
|
48
|
+
- title: Datasource Pool Statistics
|
49
|
+
command: ${PATH}/statistics=pool:read-resource(include-runtime=true)
|
50
|
+
layout: vertical
|
51
|
+
properties:
|
52
|
+
- ActiveCount
|
53
|
+
- AvailableCount
|
54
|
+
- AverageBlockingTime
|
55
|
+
- AverageCreationTime
|
56
|
+
- CreatedCount
|
57
|
+
- DestroyedCount
|
58
|
+
- MaxCreationTime
|
59
|
+
- MaxUsedCount
|
60
|
+
- MaxWaitTime
|
61
|
+
- TimedOut
|
62
|
+
- TotalBlockingTime
|
63
|
+
- TotalCreationTime
|
64
|
+
|
65
|
+
header:
|
66
|
+
- Active
|
67
|
+
- Available
|
68
|
+
- Average Blocking
|
69
|
+
- Average Creation
|
70
|
+
- Created
|
71
|
+
- Destroyed
|
72
|
+
- Max Creation
|
73
|
+
- Max Wait
|
74
|
+
- Timed Out
|
75
|
+
- Total Blocking
|
76
|
+
- Total Creation
|
77
|
+
|
78
|
+
health:
|
79
|
+
- column: active
|
80
|
+
component: percentage
|
81
|
+
params:
|
82
|
+
max: available
|
83
|
+
using: active
|
84
|
+
|
85
|
+
- title: Datasource JDBC Statistics
|
86
|
+
command: ${PATH}/statistics=jdbc:read-resource(include-runtime=true)
|
87
|
+
properties:
|
88
|
+
- PreparedStatementCacheCurrentSize
|
89
|
+
- PreparedStatementCacheAccessCount
|
90
|
+
- PreparedStatementCacheAddCount
|
91
|
+
- PreparedStatementCacheDeleteCount
|
92
|
+
- PreparedStatementCacheHitCount
|
93
|
+
- PreparedStatementCacheMissCount
|
94
|
+
header:
|
95
|
+
- Current
|
96
|
+
|
97
|
+
Size
|
98
|
+
- Access
|
99
|
+
|
100
|
+
Count
|
101
|
+
|
102
|
+
- Add
|
103
|
+
|
104
|
+
Count
|
105
|
+
- Delete
|
106
|
+
|
107
|
+
Count
|
108
|
+
- Hit
|
109
|
+
|
110
|
+
Count
|
111
|
+
- Miss
|
112
|
+
|
113
|
+
Count
|
@@ -0,0 +1,13 @@
|
|
1
|
+
---
|
2
|
+
description: Detail JDBC Drivers
|
3
|
+
path: /subsystem=datasources/jdbc-driver=${NAME}
|
4
|
+
scan: ls ${PATH}
|
5
|
+
print:
|
6
|
+
- title: JDBC Drivers
|
7
|
+
command: ${PATH}:read-resource
|
8
|
+
properties:
|
9
|
+
- driver-module-name
|
10
|
+
- driver-xa-datasource-class-name
|
11
|
+
header:
|
12
|
+
- Module Name
|
13
|
+
- XA Datasource Class
|
@@ -0,0 +1,74 @@
|
|
1
|
+
---
|
2
|
+
description: Detail Server Information
|
3
|
+
path:
|
4
|
+
print:
|
5
|
+
- title: Server Runtime Information
|
6
|
+
command: /core-service=server-environment:read-resource(include-runtime=true)
|
7
|
+
properties:
|
8
|
+
- server-name
|
9
|
+
- node-name
|
10
|
+
- host-name
|
11
|
+
- initial-running-mode
|
12
|
+
- launch-type
|
13
|
+
header:
|
14
|
+
- Server Name
|
15
|
+
- Node Name
|
16
|
+
- Host Name
|
17
|
+
- Initial Running Mode
|
18
|
+
- Launch Type
|
19
|
+
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)
|
47
|
+
layout: vertical
|
48
|
+
properties:
|
49
|
+
- server-name
|
50
|
+
- home-dir
|
51
|
+
- base-dir
|
52
|
+
- config-dir
|
53
|
+
- config-file
|
54
|
+
- data-dir
|
55
|
+
- deploy-dir
|
56
|
+
- modules-dir
|
57
|
+
- log-dir
|
58
|
+
- temp-dir
|
59
|
+
header:
|
60
|
+
- Server Name
|
61
|
+
- Home Directory
|
62
|
+
- Base Directory
|
63
|
+
- Config Directory
|
64
|
+
- Config File
|
65
|
+
- Data Directory
|
66
|
+
- Deploy Directory
|
67
|
+
- Modules Directory
|
68
|
+
- Log Directory
|
69
|
+
- Temp Directory
|
70
|
+
color:
|
71
|
+
- column: server_name
|
72
|
+
component: with
|
73
|
+
params:
|
74
|
+
color: white
|
@@ -0,0 +1,112 @@
|
|
1
|
+
# The MIT License
|
2
|
+
#
|
3
|
+
# Copyright (c) 2011-2012 Marcelo Guimarães <ataxexe@gmail.com>
|
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
|
13
|
+
# all 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
|
21
|
+
# THE SOFTWARE.
|
22
|
+
|
23
|
+
require_relative 'formatters'
|
24
|
+
require_relative 'colorizers'
|
25
|
+
require_relative 'health_checkers'
|
26
|
+
|
27
|
+
module JBoss
|
28
|
+
module Cli
|
29
|
+
class Resource
|
30
|
+
|
31
|
+
def initialize(invoker, config)
|
32
|
+
@config = config
|
33
|
+
@invoker = invoker
|
34
|
+
@context = {
|
35
|
+
:name => ''
|
36
|
+
}
|
37
|
+
@context[:path] = parse(@config[:path])
|
38
|
+
@tables = []
|
39
|
+
@count = 0
|
40
|
+
end
|
41
|
+
|
42
|
+
def content(resources)
|
43
|
+
if :all == resources
|
44
|
+
resources = scan
|
45
|
+
end
|
46
|
+
resources = [resources] unless resources.is_a? Array
|
47
|
+
params = @config[:print]
|
48
|
+
params.each do |p|
|
49
|
+
table_builder = TableBuilder::new p
|
50
|
+
table_builder.add_name_column if scannable?
|
51
|
+
@tables << table_builder.build_table
|
52
|
+
end
|
53
|
+
resources.each do |resource|
|
54
|
+
@context[:name] = resource
|
55
|
+
@context[:path] = parse(@config[:path])
|
56
|
+
|
57
|
+
params.each do |p|
|
58
|
+
add_row(p)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
result = ""
|
62
|
+
@tables.each do |table|
|
63
|
+
result << table.to_s
|
64
|
+
end
|
65
|
+
result
|
66
|
+
end
|
67
|
+
|
68
|
+
def add_row(params)
|
69
|
+
data = get_data(params)
|
70
|
+
return unless data
|
71
|
+
data = [@context[:name]] + data if scannable?
|
72
|
+
@tables[@count % @tables.size].data << data
|
73
|
+
@count += 1
|
74
|
+
end
|
75
|
+
|
76
|
+
def parse(value)
|
77
|
+
return nil unless value
|
78
|
+
result = value.scan /\$\{\w+\}/
|
79
|
+
result.each do |matched|
|
80
|
+
key = matched[2...-1].downcase.to_sym
|
81
|
+
value = value.gsub(matched, @context[key])
|
82
|
+
end
|
83
|
+
value
|
84
|
+
end
|
85
|
+
|
86
|
+
def scan
|
87
|
+
result = @invoker.execute(parse @config[:scan])
|
88
|
+
result.split "\n"
|
89
|
+
end
|
90
|
+
|
91
|
+
def scannable?
|
92
|
+
@config[:scan]
|
93
|
+
end
|
94
|
+
|
95
|
+
def get_data(config)
|
96
|
+
result = @invoker.execute(parse config[:command])
|
97
|
+
result = eval_result(result)
|
98
|
+
data = []
|
99
|
+
config[:properties].each do |prop|
|
100
|
+
data << result["result"][prop]
|
101
|
+
end
|
102
|
+
data
|
103
|
+
end
|
104
|
+
|
105
|
+
def eval_result(result)
|
106
|
+
undefined = nil #prevents error because undefined means nil in result object
|
107
|
+
eval(result)
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|