line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Siebel::Srvrmgr::Regexes; |
2
|
|
|
|
|
|
|
|
3
|
37
|
|
|
37
|
|
335608
|
use warnings; |
|
37
|
|
|
|
|
103
|
|
|
37
|
|
|
|
|
1557
|
|
4
|
37
|
|
|
37
|
|
352
|
use strict; |
|
37
|
|
|
|
|
97
|
|
|
37
|
|
|
|
|
18891
|
|
5
|
|
|
|
|
|
|
require Exporter; |
6
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
7
|
|
|
|
|
|
|
our @EXPORT_OK = |
8
|
|
|
|
|
|
|
qw(SRVRMGR_PROMPT LOAD_PREF_RESP LOAD_PREF_CMD CONN_GREET SIEBEL_ERROR ROWS_RETURNED SIEBEL_SERVER prompt_slices); |
9
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( all => [@EXPORT_OK] ); |
10
|
|
|
|
|
|
|
our $VERSION = '0.29'; # VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=pod |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 NAME |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Siebel::Srvrmgr::Regexes - common regular expressions to match things in srvrmgr output |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 SYNOPSIS |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
use Siebel::Srvrmgr::Regexes qw(SRVRMGR_PROMPT); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
if($line =~ /SRVRMGR_PROMPT/) { |
23
|
|
|
|
|
|
|
#do something |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 DESCRIPTION |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
This modules exports several pre-compiled regular expressions by demand. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
To get all regular expressions, you can use the tag C<:all>; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 EXPORTS |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head2 SRVRMGR_PROMPT |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Regular expression to match the C<srvrmgr> prompt, with or without the Siebel server name and/or command. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=cut |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# this will be reused by more than one sub |
41
|
|
|
|
|
|
|
my $server_regex = '[[:alpha:]][\w\_]{1,11}'; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# :WARNING:09/22/2016 10:11:10 PM:: be very careful to change SRVRMGR_PROMPT, Siebel::Srvrmgr::ListParser::FSA depends a lot on it! |
44
|
|
|
|
|
|
|
sub SRVRMGR_PROMPT { |
45
|
68586
|
|
|
68586
|
1
|
1050288
|
return qr/^srvrmgr(\:$server_regex)?>(\s.*)?$/; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 prompt_slices |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
This sub will use the SRVRMGR_PROMPT regular expression to try and match all the pieces of information that can be included into the C<srvrmgr> prompt: |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=over |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=item * |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
the Siebel Server name |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=item * |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
the executed command |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=back |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
It expects as parameter the corresponding string of a C<srvrmgr> prompt. It will then return a list of two values: Siebel Server Name and the executed command. |
65
|
|
|
|
|
|
|
Those files can be undefined depending on the string given as parameter, so they should be tested before use. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
This helper function was created because it is a common case to search for both string in the prompt, it should help avoiding impacts to other parts of the |
68
|
|
|
|
|
|
|
API given changes made to the SRVRMGR_PROMPT regular expression, but you can always fetch the values from it directly. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Additionally, this sub will also remove any character that is not part of the slices (colon and spaces). |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
When using this function, be sure to do it like: |
73
|
|
|
|
|
|
|
my ($server,$command) = prompt_slices($my_prompt); |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=cut |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub prompt_slices { |
78
|
277
|
|
|
277
|
1
|
2205
|
my $prompt = shift; |
79
|
277
|
|
|
|
|
742
|
my ( $server, $cmd ); |
80
|
277
|
|
|
|
|
891
|
$prompt =~ SRVRMGR_PROMPT; |
81
|
|
|
|
|
|
|
|
82
|
277
|
100
|
|
|
|
1644
|
if ( defined($1) ) { |
83
|
14
|
|
|
|
|
48
|
$server = $1; |
84
|
14
|
|
|
|
|
65
|
$server =~ tr/://d; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
277
|
100
|
|
|
|
1435
|
if ( defined($2) ) { |
88
|
|
|
|
|
|
|
|
89
|
276
|
100
|
|
|
|
1298
|
if ( $2 eq ' ' ) { |
90
|
38
|
|
|
|
|
120
|
$cmd = undef; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
else { |
93
|
238
|
|
|
|
|
828
|
$cmd = $2; |
94
|
238
|
|
|
|
|
1364
|
$cmd =~ s/^\s+//; |
95
|
238
|
|
|
|
|
1304
|
$cmd =~ s/\s+$//; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
277
|
|
|
|
|
1418
|
return $server, $cmd; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head2 SIEBEL_SERVER |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Regular expression to match a valid Siebel Server name. See L<https://docs.oracle.com/cd/E14004_01/books/SiebInstUNIX/SiebInstCOM_Requirements21.html#wp1333940>. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=cut |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub SIEBEL_SERVER { |
109
|
16
|
|
|
16
|
1
|
1619
|
return qr/^$server_regex$/; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=pod |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head2 LOAD_PREF_RESP |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Regular expression to match the C<load preferences> response once the command is submitted. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=cut |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
sub LOAD_PREF_RESP { |
121
|
54
|
|
|
54
|
1
|
2678
|
return qr/^(srvrmgr(\:$server_regex)?>)?\s?File\:\s.*\.pref$/; |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=pod |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head2 LOAD_PREF_CMD |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Regular expression to match the C<load preferences> command when submitted. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=cut |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
sub LOAD_PREF_CMD { |
133
|
7
|
|
|
7
|
1
|
300
|
return qr/^(srvrmgr(\:$server_regex)?>)?\s?load preferences$/; |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=pod |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head2 CONN_GREET |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Regular expression to match the first line submitted by a Siebel enterprise when the C<srvrmgr> connects to it. It will look like something like this: |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Siebel Enterprise Applications Siebel Server Manager, Version 8.0.0.7 [20426] LANG_INDEPENDENT |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
It is a known issue that UTF-8 data with BOM character will cause this regular expression to B<not> match. |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=cut |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
sub CONN_GREET { |
149
|
|
|
|
|
|
|
return |
150
|
251
|
|
|
251
|
1
|
2041
|
qr/^Siebel\sEnterprise\sApplications\sSiebel\sServer\sManager\,\sVersion.*/; |
151
|
|
|
|
|
|
|
} |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=pod |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head2 ROWS_RETURNED |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
This regular expression should match the last but one line returned by a command, for example: |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
136 rows returned. |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
This line indicated how many rows were returned by a command. |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=cut |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
sub ROWS_RETURNED { |
166
|
1811
|
|
|
1811
|
1
|
18646
|
return qr/^\d+\srows?\sreturned\./; |
167
|
|
|
|
|
|
|
} |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=pod |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head2 SIEBEL_ERROR |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
This regular expression should match errors from Siebel like, for example: |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
SBL-SSM-00003: Error opening SISNAPI connection. |
176
|
|
|
|
|
|
|
SBL-NET-01218: The connection was refused by server foobar. No component is listening on port 49170. |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
The regular expression matches the default error code. |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=cut |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
sub SIEBEL_ERROR { |
183
|
9
|
|
|
9
|
1
|
2771
|
return qr/^SBL\-\w{3}\-\d+/; |
184
|
|
|
|
|
|
|
} |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=head1 AUTHOR |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt> |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
This software is copyright (c) 2012 of Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt> |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
This file is part of Siebel Monitoring Tools. |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
Siebel Monitoring Tools is free software: you can redistribute it and/or modify |
197
|
|
|
|
|
|
|
it under the terms of the GNU General Public License as published by |
198
|
|
|
|
|
|
|
the Free Software Foundation, either version 3 of the License, or |
199
|
|
|
|
|
|
|
(at your option) any later version. |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
Siebel Monitoring Tools is distributed in the hope that it will be useful, |
202
|
|
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
203
|
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
204
|
|
|
|
|
|
|
GNU General Public License for more details. |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License |
207
|
|
|
|
|
|
|
along with Siebel Monitoring Tools. If not, see <http://www.gnu.org/licenses/>. |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=cut |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
1; |