line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Siebel::Srvrmgr::ListParser::Output::Enterprise; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=pod |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Siebel::Srvrmgr::ListParser::Output::Enterprise - subclass that represents the initial information from a Siebel server when connected through srvrmgr program. |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 SYNOPSIS |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
See L<Siebel::Srvrmgr::ListParser::Output>. |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=cut |
14
|
|
|
|
|
|
|
|
15
|
6
|
|
|
6
|
|
9248
|
use Moose; |
|
6
|
|
|
|
|
340953
|
|
|
6
|
|
|
|
|
69
|
|
16
|
6
|
|
|
6
|
|
34248
|
use Siebel::Srvrmgr::Regexes qw(CONN_GREET); |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
446
|
|
17
|
6
|
|
|
6
|
|
36
|
use Carp; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
421
|
|
18
|
6
|
|
|
6
|
|
35
|
use List::Util qw(sum); |
|
6
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
9748
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
extends 'Siebel::Srvrmgr::ListParser::Output'; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=pod |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 DESCRIPTION |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
C<Siebel::Srvrmgr::ListParser::Output::Greetings> extends C<Siebel::Srvrmgr::ListParser::Output>. |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Normally this class would be created by L<Siebel::Srvrmgr::ListParser::OutputFactory> C<create> static method. See the automated tests for examples of direct |
29
|
|
|
|
|
|
|
instatiation. |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
It is possible to recover some useful information from the object methods but most of it is simple copyrigh information. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head2 version |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
A string that represents the version of the Siebel enterprise where the connection was stablished. This is a read-only attribute. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=cut |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
has 'version' => ( |
42
|
|
|
|
|
|
|
is => 'ro', |
43
|
|
|
|
|
|
|
isa => 'Str', |
44
|
|
|
|
|
|
|
reader => 'get_version', |
45
|
|
|
|
|
|
|
writer => '_set_version' |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=pod |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 patch |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
A string that represents the patch version of the Siebel enterprise where the connection was stablished. This is a read-only attribute. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=cut |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
has 'patch' => |
57
|
|
|
|
|
|
|
( is => 'ro', isa => 'Int', reader => 'get_patch', writer => '_set_patch' ); |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=pod |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head2 copyright |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
An array reference that represents the copyright information of the Siebel enterprise where the connection was stablished. This is a read-only attribute. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=cut |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
has 'copyright' => ( |
68
|
|
|
|
|
|
|
is => 'ro', |
69
|
|
|
|
|
|
|
isa => 'ArrayRef[Str]', |
70
|
|
|
|
|
|
|
reader => 'get_copyright' |
71
|
|
|
|
|
|
|
); |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=pod |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head2 total_servers |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
A integer that represents the total number of servers configured in the enterprise where the connection was stablished. This is a read-only attribute. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
has 'total_servers' => ( |
82
|
|
|
|
|
|
|
is => 'ro', |
83
|
|
|
|
|
|
|
isa => 'Int', |
84
|
|
|
|
|
|
|
reader => 'get_total_servers', |
85
|
|
|
|
|
|
|
writer => '_set_total_servers' |
86
|
|
|
|
|
|
|
); |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=pod |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head2 total_connected |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
A integer that represents the total number of servers available in the enterprise where the connection was stablished. This is a read-only attribute. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=cut |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
has 'total_connected' => ( |
97
|
|
|
|
|
|
|
is => 'ro', |
98
|
|
|
|
|
|
|
isa => 'Int', |
99
|
|
|
|
|
|
|
reader => 'get_total_conn', |
100
|
|
|
|
|
|
|
writer => '_set_total_conn' |
101
|
|
|
|
|
|
|
); |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=pod |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head2 help |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
A string representing how to invoke online help within C<srvrmgr> program. This is a read-only attribute. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=cut |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
has 'help' => ( |
112
|
|
|
|
|
|
|
is => 'ro', |
113
|
|
|
|
|
|
|
isa => 'Str', |
114
|
|
|
|
|
|
|
reader => 'get_help', |
115
|
|
|
|
|
|
|
writer => '_set_help' |
116
|
|
|
|
|
|
|
); |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=pod |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 METHODS |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
See L<Siebel::Srvrmgr::ListParser::Output> class for inherited methods. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head2 get_version |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Returns a string as the value of version attribute. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head2 get_patch |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
Returns a string as the value of patch attribute. |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head2 get_copyright |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Returns a string as the value of copyright attribute. |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head2 get_total_servers |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Returns a integer as the value of total_servers attribute. |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head2 get_total_conn |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Returns a integer as the value of total_connected attribute. |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head2 parse |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
This method overrides the superclass. |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=cut |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
override 'parse' => sub { |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
my $self = shift; |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
my $data_ref = $self->get_raw_data(); |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
my %data_parsed; |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
#Copyright (c) 2001 Siebel Systems, Inc. All rights reserved. |
159
|
|
|
|
|
|
|
my $copyright_regex = qr/^Copyright\s\(c\)/; |
160
|
|
|
|
|
|
|
my $more_copyright = qr/^[\w\(]+/; |
161
|
|
|
|
|
|
|
my $help_regex = qr/^Type\s\"help\"/; |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
#Connected to 1 server(s) out of a total of 1 server(s) in the enterprise |
164
|
|
|
|
|
|
|
#Connected to 2 server(s) out of a total of 2 server(s) in the enterprise |
165
|
|
|
|
|
|
|
my $connected_regex = qr/^Connected\sto\s\d+\sserver\(s\)/; |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
my %check = ( |
168
|
|
|
|
|
|
|
conn_greet => 0, |
169
|
|
|
|
|
|
|
copyright => 0, |
170
|
|
|
|
|
|
|
help => 0, |
171
|
|
|
|
|
|
|
connected => 0, |
172
|
|
|
|
|
|
|
more_copyright => 0 |
173
|
|
|
|
|
|
|
); |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
foreach my $line ( @{$data_ref} ) { |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
chomp($line); |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
SWITCH: { |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
if ( $line eq '' ) { |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
# do nothing |
184
|
|
|
|
|
|
|
last SWITCH; |
185
|
|
|
|
|
|
|
} |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
if ( $line =~ CONN_GREET ) { |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
#Siebel Enterprise Applications Siebel Server Manager, Version 7.5.3 [16157] LANG_INDEPENDENT |
190
|
|
|
|
|
|
|
my @words = split( /\s/, $line ); |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
$self->_set_version( $words[7] ); |
193
|
|
|
|
|
|
|
$data_parsed{version} = $words[7]; |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
$words[8] =~ tr/[]//d; |
196
|
|
|
|
|
|
|
$self->_set_patch( $words[8] ); |
197
|
|
|
|
|
|
|
$data_parsed{patch} = $words[8]; |
198
|
|
|
|
|
|
|
$check{conn_greet} = 1; |
199
|
|
|
|
|
|
|
last SWITCH; |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
} |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
if ( $line =~ $copyright_regex ) { |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
$self->_set_copyright($line); |
206
|
|
|
|
|
|
|
$data_parsed{copyright} = $line; |
207
|
|
|
|
|
|
|
$check{copyright} = 1; |
208
|
|
|
|
|
|
|
last SWITCH; |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
} |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
if ( $line =~ $help_regex ) { |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
$self->_set_help($line); |
215
|
|
|
|
|
|
|
$data_parsed{help} = $line; |
216
|
|
|
|
|
|
|
$check{help} = 1; |
217
|
|
|
|
|
|
|
last SWITCH; |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
} |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
if ( $line =~ $connected_regex ) { |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
my @words = split( /\s/, $line ); |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
$self->_set_total_servers( $words[9] ); |
226
|
|
|
|
|
|
|
$self->_set_total_conn( $words[2] ); |
227
|
|
|
|
|
|
|
$data_parsed{total_servers} = $words[9]; |
228
|
|
|
|
|
|
|
$data_parsed{total_conn} = $words[2]; |
229
|
|
|
|
|
|
|
$check{connected} = 1; |
230
|
|
|
|
|
|
|
last SWITCH; |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
} |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
if ( $line =~ $more_copyright ) { |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
$self->_set_copyright($line) if ( $check{copyright} ); |
237
|
|
|
|
|
|
|
$data_parsed{copyright} = $line; |
238
|
|
|
|
|
|
|
$check{more_copyright} = 1; |
239
|
|
|
|
|
|
|
last SWITCH; |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
} |
242
|
|
|
|
|
|
|
else { |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
confess 'Do not know how to deal with line content "' . $line |
245
|
|
|
|
|
|
|
. '"'; |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
} |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
} |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
} |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
$self->set_data_parsed( \%data_parsed ); |
254
|
|
|
|
|
|
|
$self->set_raw_data( [] ); |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
if ( ( keys(%check) ) == ( sum( values(%check) ) ) ) { |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
return 1; |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
} |
261
|
|
|
|
|
|
|
else { |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
foreach my $key ( keys(%check) ) { |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
warn "$key was not matched" unless ( $check{$key} ); |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
} |
268
|
|
|
|
|
|
|
return 0; |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
} |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
}; |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
=pod |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
=head2 _set_copyright |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
"Private" method to set the copyright information. |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
=cut |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
sub _set_copyright { |
283
|
|
|
|
|
|
|
|
284
|
115
|
|
|
115
|
|
169
|
my $self = shift; |
285
|
115
|
|
|
|
|
162
|
my $line = shift; |
286
|
|
|
|
|
|
|
|
287
|
115
|
|
|
|
|
131
|
push( @{ $self->{copyright} }, $line ); |
|
115
|
|
|
|
|
275
|
|
288
|
|
|
|
|
|
|
|
289
|
115
|
|
|
|
|
174
|
return 1; |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
} |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
=pod |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
=head1 CAVEATS |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
Beware that the parse method is called automatically as soon as the object is created. |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
=head1 SEE ALSO |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
=over 2 |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
=item * |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
L<Siebel::Srvrmgr::Regexes> |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
=item * |
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
L<Siebel::Srvrmgr::ListParser::Output> |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
=back |
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
=head1 AUTHOR |
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt>. |
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
This software is copyright (c) 2012 of Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt>. |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
This file is part of Siebel Monitoring Tools. |
322
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
Siebel Monitoring Tools is free software: you can redistribute it and/or modify |
324
|
|
|
|
|
|
|
it under the terms of the GNU General Public License as published by |
325
|
|
|
|
|
|
|
the Free Software Foundation, either version 3 of the License, or |
326
|
|
|
|
|
|
|
(at your option) any later version. |
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
Siebel Monitoring Tools is distributed in the hope that it will be useful, |
329
|
|
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
330
|
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
331
|
|
|
|
|
|
|
GNU General Public License for more details. |
332
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License |
334
|
|
|
|
|
|
|
along with Siebel Monitoring Tools. If not, see L<http://www.gnu.org/licenses/>. |
335
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
=cut |
337
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
339
|
6
|
|
|
6
|
|
47
|
no Moose; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
41
|
|