| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Siebel::Srvrmgr::ListParser::Output::Tabular::ListServers; |
|
2
|
3
|
|
|
3
|
|
5768
|
use Moose; |
|
|
3
|
|
|
|
|
340533
|
|
|
|
3
|
|
|
|
|
26
|
|
|
3
|
3
|
|
|
3
|
|
21522
|
use namespace::autoclean; |
|
|
3
|
|
|
|
|
8356
|
|
|
|
3
|
|
|
|
|
28
|
|
|
4
|
3
|
|
|
3
|
|
2439
|
use Siebel::Srvrmgr::ListParser::Output::ListServers::Server; |
|
|
3
|
|
|
|
|
15946
|
|
|
|
3
|
|
|
|
|
1586
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=pod |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Siebel::Srvrmgr::ListParser::Output::Tabular::ListServers - subclass to parse list servers command |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=cut |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
extends 'Siebel::Srvrmgr::ListParser::Output::Tabular'; |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=pod |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
See L<Siebel::Srvrmgr::ListParser::Output::Tabular> for examples. |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
This subclass of L<Siebel::Srvrmgr::ListParser::Output::Tabular> parses the output of the command C<list servers>. |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
This class expectes the following order and configuration of fields from C<list servers> command: |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
srvrmgr> configure list servers |
|
29
|
|
|
|
|
|
|
SBLSRVR_NAME (31): Siebel Server name |
|
30
|
|
|
|
|
|
|
SBLSRVR_GROUP_NAME (46): Siebel server Group name |
|
31
|
|
|
|
|
|
|
HOST_NAME (31): Host name of server machine |
|
32
|
|
|
|
|
|
|
INSTALL_DIR (256): Server install directory name |
|
33
|
|
|
|
|
|
|
SBLMGR_PID (16): O/S process/thread ID of Siebel Server Manager |
|
34
|
|
|
|
|
|
|
SV_DISP_STATE (61): Server state (started, stopped, etc.) |
|
35
|
|
|
|
|
|
|
SBLSRVR_STATE (31): Server state internal (started, stopped, etc.) |
|
36
|
|
|
|
|
|
|
START_TIME (21): Time the server was started |
|
37
|
|
|
|
|
|
|
END_TIME (21): Time the server was stopped |
|
38
|
|
|
|
|
|
|
SBLSRVR_STATUS (101): Server status |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Anything different from that will generate exceptions when parsing |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
All from parent class. |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 METHODS |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
All methods from superclass plus some additional ones described below. |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 get_data_parsed |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
The hash reference returned by C<get_data_parsed> will look like that: |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
siebfoobar' => HASH |
|
55
|
|
|
|
|
|
|
'END_TIME' => '' |
|
56
|
|
|
|
|
|
|
'HOST_NAME' => 'siebfoobar' |
|
57
|
|
|
|
|
|
|
'INSTALL_DIR' => '/app/siebel/siebsrvr' |
|
58
|
|
|
|
|
|
|
'SBLMGR_PID' => 20452 |
|
59
|
|
|
|
|
|
|
'SBLSRVR_GROUP_NAME' => '' |
|
60
|
|
|
|
|
|
|
'SBLSRVR_STATE' => 'Running' |
|
61
|
|
|
|
|
|
|
'SBLSRVR_STATUS' => '8.1.1.7 [21238] LANG_INDEPENDENT' |
|
62
|
|
|
|
|
|
|
'START_TIME' => '2013-04-22 15:32:25' |
|
63
|
|
|
|
|
|
|
'SV_DISP_STATE' => 'Running' |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
where the keys are the Siebel servers names, each one holding a reference to another hash with the keys shown above. |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=cut |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub _build_expected { |
|
70
|
|
|
|
|
|
|
|
|
71
|
9
|
|
|
9
|
|
24
|
my $self = shift; |
|
72
|
|
|
|
|
|
|
|
|
73
|
9
|
|
|
|
|
501
|
$self->_set_expected_fields( |
|
74
|
|
|
|
|
|
|
[ |
|
75
|
|
|
|
|
|
|
'SBLSRVR_NAME', 'SBLSRVR_GROUP_NAME', |
|
76
|
|
|
|
|
|
|
'HOST_NAME', 'INSTALL_DIR', |
|
77
|
|
|
|
|
|
|
'SBLMGR_PID', 'SV_DISP_STATE', |
|
78
|
|
|
|
|
|
|
'SBLSRVR_STATE', 'START_TIME', |
|
79
|
|
|
|
|
|
|
'END_TIME', 'SBLSRVR_STATUS' |
|
80
|
|
|
|
|
|
|
] |
|
81
|
|
|
|
|
|
|
); |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head2 get_servers |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Returns a iterator in a form of a sub reference. |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Which dereference of anonymous sub reference will return a L<Siebel::Srvrmgr::ListParser::Output::ListServers::Server> object |
|
90
|
|
|
|
|
|
|
until the list of servers is exausted. In this case the sub reference will return C<undef>. |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=cut |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub get_servers { |
|
95
|
|
|
|
|
|
|
|
|
96
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
97
|
0
|
|
|
|
|
0
|
my $counter = 0; |
|
98
|
|
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
0
|
my $servers_ref = $self->get_data_parsed; |
|
100
|
|
|
|
|
|
|
|
|
101
|
0
|
|
|
|
|
0
|
my @servers = sort( keys( %{$servers_ref} ) ); |
|
|
0
|
|
|
|
|
0
|
|
|
102
|
0
|
|
|
|
|
0
|
my $total = scalar(@servers) - 1; |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
return sub { |
|
105
|
|
|
|
|
|
|
|
|
106
|
0
|
0
|
|
0
|
|
0
|
if ( $counter <= $total ) { |
|
107
|
|
|
|
|
|
|
|
|
108
|
0
|
|
|
|
|
0
|
my $server_ref = $servers_ref->{ $servers[$counter] }; |
|
109
|
0
|
|
|
|
|
0
|
$counter++; |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
my %attribs = ( |
|
112
|
|
|
|
|
|
|
name => $server_ref->{SBLSRVR_NAME}, |
|
113
|
|
|
|
|
|
|
group => $server_ref->{SBLSRVR_GROUP_NAME}, |
|
114
|
|
|
|
|
|
|
host => $server_ref->{HOST_NAME}, |
|
115
|
|
|
|
|
|
|
install_dir => $server_ref->{INSTALL_DIR}, |
|
116
|
|
|
|
|
|
|
disp_state => $server_ref->{SV_DISP_STATE}, |
|
117
|
|
|
|
|
|
|
state => $server_ref->{SBLSRVR_STATE}, |
|
118
|
|
|
|
|
|
|
start_datetime => $server_ref->{START_TIME}, |
|
119
|
|
|
|
|
|
|
end_datetime => $server_ref->{END_TIME}, |
|
120
|
|
|
|
|
|
|
status => $server_ref->{SBLSRVR_STATUS} |
|
121
|
0
|
|
|
|
|
0
|
); |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
# the server can be stopped, so no PID associated with it |
|
124
|
0
|
0
|
|
|
|
0
|
if ( defined( $server_ref->{SBLMGR_PID} ) ) { |
|
125
|
|
|
|
|
|
|
|
|
126
|
0
|
|
|
|
|
0
|
$attribs{pid} = $server_ref->{SBLMGR_PID}; |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
} |
|
129
|
|
|
|
|
|
|
|
|
130
|
0
|
|
|
|
|
0
|
return Siebel::Srvrmgr::ListParser::Output::ListServers::Server |
|
131
|
|
|
|
|
|
|
->new( \%attribs ); |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
} |
|
134
|
|
|
|
|
|
|
else { |
|
135
|
|
|
|
|
|
|
|
|
136
|
0
|
|
|
|
|
0
|
return undef; |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
} |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
} # end of sub block |
|
141
|
0
|
|
|
|
|
0
|
} |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
sub _consume_data { |
|
144
|
|
|
|
|
|
|
|
|
145
|
16
|
|
|
16
|
|
28
|
my $self = shift; |
|
146
|
16
|
|
|
|
|
28
|
my $fields_ref = shift; |
|
147
|
16
|
|
|
|
|
21
|
my $parsed_ref = shift; |
|
148
|
|
|
|
|
|
|
|
|
149
|
16
|
|
|
|
|
22
|
my $list_len = scalar( @{$fields_ref} ); |
|
|
16
|
|
|
|
|
29
|
|
|
150
|
16
|
|
|
|
|
31
|
my $server_name = $fields_ref->[0]; |
|
151
|
|
|
|
|
|
|
|
|
152
|
16
|
|
|
|
|
791
|
my $columns_ref = $self->get_expected_fields; |
|
153
|
|
|
|
|
|
|
|
|
154
|
16
|
50
|
|
|
|
27
|
if ( @{$fields_ref} ) { |
|
|
16
|
|
|
|
|
42
|
|
|
155
|
|
|
|
|
|
|
|
|
156
|
16
|
|
|
|
|
50
|
for ( my $i = 1 ; $i < $list_len ; $i++ ) { |
|
157
|
|
|
|
|
|
|
|
|
158
|
144
|
|
|
|
|
497
|
$parsed_ref->{$server_name}->{ $columns_ref->[$i] } = |
|
159
|
|
|
|
|
|
|
$fields_ref->[$i]; |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
} |
|
162
|
|
|
|
|
|
|
|
|
163
|
16
|
|
|
|
|
105
|
return 1; |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
} |
|
166
|
|
|
|
|
|
|
else { |
|
167
|
|
|
|
|
|
|
|
|
168
|
0
|
|
|
|
|
|
return 0; |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
} |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
} |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=pod |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=over |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=item * |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
L<Siebel::Srvrmgr::ListParser::Output::ListServers::Server> |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=item * |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
L<Siebel::Srvrmgr::ListParser::Output::Tabular> |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=item * |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
L<Moose> |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=back |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=head1 AUTHOR |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt>. |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
This software is copyright (c) 2012 of Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt>. |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
This file is part of Siebel Monitoring Tools. |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
Siebel Monitoring Tools is free software: you can redistribute it and/or modify |
|
205
|
|
|
|
|
|
|
it under the terms of the GNU General Public License as published by |
|
206
|
|
|
|
|
|
|
the Free Software Foundation, either version 3 of the License, or |
|
207
|
|
|
|
|
|
|
(at your option) any later version. |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
Siebel Monitoring Tools is distributed in the hope that it will be useful, |
|
210
|
|
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
211
|
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
212
|
|
|
|
|
|
|
GNU General Public License for more details. |
|
213
|
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License |
|
215
|
|
|
|
|
|
|
along with Siebel Monitoring Tools. If not, see L<http://www.gnu.org/licenses/>. |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=cut |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
220
|
|
|
|
|
|
|
1; |