line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Siebel::Srvrmgr::ListParser::Output::Tabular::ListTasks; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
6150
|
use Moose; |
|
3
|
|
|
|
|
333864
|
|
|
3
|
|
|
|
|
27
|
|
4
|
3
|
|
|
3
|
|
23267
|
use Siebel::Srvrmgr::ListParser::Output::ListTasks::Task; |
|
3
|
|
|
|
|
16748
|
|
|
3
|
|
|
|
|
142
|
|
5
|
3
|
|
|
3
|
|
29
|
use namespace::autoclean; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
29
|
|
6
|
3
|
|
|
3
|
|
269
|
use Siebel::Srvrmgr::Regexes qw(SIEBEL_SERVER); |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
2095
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=pod |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Siebel::Srvrmgr::ListParser::Output::Tabular::ListTasks - subclass to parse list tasks command |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=cut |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
extends 'Siebel::Srvrmgr::ListParser::Output::Tabular'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
with 'Siebel::Srvrmgr::ListParser::Output::Tabular::ByServer'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=pod |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 SYNOPSIS |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
See L<Siebel::Srvrmgr::ListParser::Output::Tabular> for examples. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 DESCRIPTION |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
This subclass of L<Siebel::Srvrmgr::ListParser::Output::Tabular> parses the output of the command C<list tasks>. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
It is expected that the C<srvrmgr> program has a proper configuration for the C<list tasks> command. The default configuration |
31
|
|
|
|
|
|
|
can be seen below: |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
srvrmgr> configure list tasks |
34
|
|
|
|
|
|
|
SV_NAME (31): Server name |
35
|
|
|
|
|
|
|
CC_ALIAS (31): Component alias |
36
|
|
|
|
|
|
|
TK_TASKID (11): Internal task id |
37
|
|
|
|
|
|
|
TK_PID (11): Task process id |
38
|
|
|
|
|
|
|
TK_DISP_RUNSTATE (61): Task run state |
39
|
|
|
|
|
|
|
CC_RUNMODE (31): Task run mode |
40
|
|
|
|
|
|
|
TK_START_TIME (21): Task start time |
41
|
|
|
|
|
|
|
TK_END_TIME (21): Task end time |
42
|
|
|
|
|
|
|
TK_STATUS (251): Task-reported status |
43
|
|
|
|
|
|
|
CG_ALIAS (31): Component group alias |
44
|
|
|
|
|
|
|
TK_PARENT_TASKNUM (11): Parent task id |
45
|
|
|
|
|
|
|
CC_INCARN_NO (23): Incarnation Number |
46
|
|
|
|
|
|
|
TK_LABEL (76): Task Label |
47
|
|
|
|
|
|
|
TK_TASKTYPE (31): Task Type |
48
|
|
|
|
|
|
|
TK_PING_TIME (11): Last ping time for task |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
If you want to use fixed width configuration from C<srvrmgr> this will be the expected configuration: |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
srvrmgr> configure list tasks |
53
|
|
|
|
|
|
|
SV_NAME (31): Server name |
54
|
|
|
|
|
|
|
CC_ALIAS (31): Component alias |
55
|
|
|
|
|
|
|
TK_TASKID (11): Internal task id |
56
|
|
|
|
|
|
|
TK_PID (11): Task process id |
57
|
|
|
|
|
|
|
TK_DISP_RUNSTATE (61): Task run state |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
If you want to use the field delimited output from C<srvrmgr> then this the expected configuration: |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
srvrmgr> configure list tasks |
62
|
|
|
|
|
|
|
SV_NAME (31): Server name |
63
|
|
|
|
|
|
|
CC_ALIAS (31): Component alias |
64
|
|
|
|
|
|
|
TK_TASKID (11): Internal task id |
65
|
|
|
|
|
|
|
TK_PID (11): Task process id |
66
|
|
|
|
|
|
|
TK_DISP_RUNSTATE (61): Task run state |
67
|
|
|
|
|
|
|
CC_RUNMODE (31): Task run mode |
68
|
|
|
|
|
|
|
TK_START_TIME (21): Task start time |
69
|
|
|
|
|
|
|
TK_END_TIME (21): Task end time |
70
|
|
|
|
|
|
|
TK_STATUS (251): Task-reported status |
71
|
|
|
|
|
|
|
CG_ALIAS (31): Component group alias |
72
|
|
|
|
|
|
|
TK_PARENT_TASKNUM (18): Parent task id |
73
|
|
|
|
|
|
|
CC_INCARN_NO (23): Incarnation Number |
74
|
|
|
|
|
|
|
TK_LABEL (76): Task Label |
75
|
|
|
|
|
|
|
TK_TASKTYPE (31): Task Type |
76
|
|
|
|
|
|
|
TK_PING_TIME (12): Last ping time for task |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
The order of the fields is important too: everytime those fields are parsed, if they do not follow the order above an exception |
79
|
|
|
|
|
|
|
will be raised. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub _build_expected { |
84
|
|
|
|
|
|
|
|
85
|
16
|
|
|
16
|
|
32
|
my $self = shift; |
86
|
|
|
|
|
|
|
|
87
|
16
|
100
|
|
|
|
865
|
if ( $self->get_type() eq 'delimited' ) { |
88
|
|
|
|
|
|
|
|
89
|
7
|
|
|
|
|
390
|
$self->_set_expected_fields( |
90
|
|
|
|
|
|
|
[ |
91
|
|
|
|
|
|
|
'SV_NAME', 'CC_ALIAS', |
92
|
|
|
|
|
|
|
'TK_TASKID', 'TK_PID', |
93
|
|
|
|
|
|
|
'TK_DISP_RUNSTATE', 'CC_RUNMODE', |
94
|
|
|
|
|
|
|
'TK_START_TIME', 'TK_END_TIME', |
95
|
|
|
|
|
|
|
'TK_STATUS', 'CG_ALIAS', |
96
|
|
|
|
|
|
|
'TK_PARENT_TASKNUM', 'CC_INCARN_NO', |
97
|
|
|
|
|
|
|
'TK_LABEL', 'TK_TASKTYPE', |
98
|
|
|
|
|
|
|
'TK_PING_TIME' |
99
|
|
|
|
|
|
|
] |
100
|
|
|
|
|
|
|
); |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
else { |
104
|
|
|
|
|
|
|
|
105
|
9
|
|
|
|
|
507
|
$self->_set_expected_fields( |
106
|
|
|
|
|
|
|
[ |
107
|
|
|
|
|
|
|
'SV_NAME', 'CC_ALIAS', 'TK_TASKID', 'TK_PID', |
108
|
|
|
|
|
|
|
'TK_DISP_RUNSTATE' |
109
|
|
|
|
|
|
|
] |
110
|
|
|
|
|
|
|
); |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=pod |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 METHODS |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Some methods from the parent classes are overrided. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head2 count_tasks |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Returns an integer representing the number of tasks recovered from the parsed output. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Expects a string as parameter being the Siebel Server name, so the number of tasks are those related to the |
127
|
|
|
|
|
|
|
server passed as argument. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=cut |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
sub count_tasks { |
132
|
|
|
|
|
|
|
|
133
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
134
|
0
|
|
|
|
|
0
|
my $server = shift; |
135
|
|
|
|
|
|
|
|
136
|
0
|
|
|
|
|
0
|
my $server_ref = $self->val_items_server($server); |
137
|
|
|
|
|
|
|
|
138
|
0
|
|
|
|
|
0
|
return scalar( @{$server_ref} ); |
|
0
|
|
|
|
|
0
|
|
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=pod |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head2 get_tasks |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
Returns an iterator to iterate over the list of tasks of a Siebel Server given as argument. |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
At each invocation of the iterator, a instance of L<Siebel::Srvrmgr::ListParser::Output::ListTasks::Task> is return, |
149
|
|
|
|
|
|
|
or C<undef> in the case that there are no more tasks to return. |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Beware that depending on the type of output parsed, the returned instances will have more or less attributes with |
152
|
|
|
|
|
|
|
values. |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
To be compatible with the role L<Siebel::Srvrmgr::ListParser::Output::Duration>, fixed width output data will have a default |
155
|
|
|
|
|
|
|
value of '2000-00-00 00:00:00' for C<start_datetime> attribute, which is basically useless if you need that of information. |
156
|
|
|
|
|
|
|
You should use delimited data for that. |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=cut |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
sub get_tasks { |
161
|
|
|
|
|
|
|
|
162
|
8
|
|
|
8
|
1
|
197
|
my $self = shift; |
163
|
8
|
|
|
|
|
13
|
my $server = shift; |
164
|
8
|
|
|
|
|
14
|
my $counter = 0; |
165
|
|
|
|
|
|
|
|
166
|
8
|
|
|
|
|
29
|
my $server_ref = $self->val_items_server($server); |
167
|
|
|
|
|
|
|
|
168
|
2
|
|
|
|
|
5
|
my $total = scalar( @{$server_ref} ) - 1; |
|
2
|
|
|
|
|
7
|
|
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
return sub { |
171
|
|
|
|
|
|
|
|
172
|
41
|
100
|
|
41
|
|
1011
|
if ( $counter <= $total ) { |
173
|
|
|
|
|
|
|
|
174
|
39
|
|
|
|
|
94
|
my $fields_ref = $server_ref->[$counter]; |
175
|
|
|
|
|
|
|
|
176
|
39
|
|
|
|
|
53
|
$counter++; |
177
|
|
|
|
|
|
|
|
178
|
39
|
100
|
|
|
|
1971
|
if ( $self->get_type() eq 'fixed' ) { |
179
|
|
|
|
|
|
|
|
180
|
20
|
|
|
|
|
1042
|
return Siebel::Srvrmgr::ListParser::Output::ListTasks::Task |
181
|
|
|
|
|
|
|
->new( |
182
|
|
|
|
|
|
|
{ |
183
|
|
|
|
|
|
|
server_name => $fields_ref->[0], |
184
|
|
|
|
|
|
|
comp_alias => $fields_ref->[1], |
185
|
|
|
|
|
|
|
id => $fields_ref->[2], |
186
|
|
|
|
|
|
|
pid => $fields_ref->[3], |
187
|
|
|
|
|
|
|
run_state => $fields_ref->[4], |
188
|
|
|
|
|
|
|
start_datetime => '2000-00-00 00:00:00' |
189
|
|
|
|
|
|
|
} |
190
|
|
|
|
|
|
|
); |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
} |
193
|
|
|
|
|
|
|
else { |
194
|
|
|
|
|
|
|
|
195
|
19
|
|
|
|
|
298
|
my %params = ( |
196
|
|
|
|
|
|
|
server_name => $fields_ref->[0], |
197
|
|
|
|
|
|
|
comp_alias => $fields_ref->[1], |
198
|
|
|
|
|
|
|
id => $fields_ref->[2], |
199
|
|
|
|
|
|
|
pid => $fields_ref->[3], |
200
|
|
|
|
|
|
|
run_state => $fields_ref->[4], |
201
|
|
|
|
|
|
|
run_mode => $fields_ref->[5], |
202
|
|
|
|
|
|
|
start_datetime => $fields_ref->[6], |
203
|
|
|
|
|
|
|
end_datetime => $fields_ref->[7], |
204
|
|
|
|
|
|
|
status => $fields_ref->[8], |
205
|
|
|
|
|
|
|
group_alias => $fields_ref->[9], |
206
|
|
|
|
|
|
|
label => $fields_ref->[12], |
207
|
|
|
|
|
|
|
type => $fields_ref->[13], |
208
|
|
|
|
|
|
|
ping_time => $fields_ref->[14] |
209
|
|
|
|
|
|
|
); |
210
|
|
|
|
|
|
|
|
211
|
19
|
50
|
|
|
|
60
|
$params{parent_id} = $fields_ref->[10] |
212
|
|
|
|
|
|
|
unless ( $fields_ref->[10] eq '' ); |
213
|
19
|
50
|
|
|
|
73
|
$params{incarn_no} = $fields_ref->[11] |
214
|
|
|
|
|
|
|
unless ( $fields_ref->[11] eq '' ); |
215
|
|
|
|
|
|
|
|
216
|
19
|
|
|
|
|
954
|
return Siebel::Srvrmgr::ListParser::Output::ListTasks::Task |
217
|
|
|
|
|
|
|
->new( \%params ); |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
} |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
} |
222
|
|
|
|
|
|
|
else { |
223
|
|
|
|
|
|
|
|
224
|
2
|
|
|
|
|
8
|
return undef; |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
} |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
} # end of sub block |
229
|
2
|
|
|
|
|
19
|
} |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
sub _consume_data { |
232
|
|
|
|
|
|
|
|
233
|
1478
|
|
|
1478
|
|
2241
|
my $self = shift; |
234
|
1478
|
|
|
|
|
1933
|
my $fields_ref = shift; |
235
|
1478
|
|
|
|
|
1725
|
my $parsed_ref = shift; |
236
|
|
|
|
|
|
|
|
237
|
1478
|
|
|
|
|
2212
|
my $server_name = $fields_ref->[0]; |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
$parsed_ref->{$server_name} = [] |
240
|
1478
|
100
|
|
|
|
3372
|
unless ( exists( $parsed_ref->{$server_name} ) ); |
241
|
|
|
|
|
|
|
|
242
|
1478
|
50
|
|
|
|
1670
|
if ( @{$fields_ref} ) { |
|
1478
|
|
|
|
|
2858
|
|
243
|
|
|
|
|
|
|
|
244
|
1478
|
|
|
|
|
1785
|
push( @{ $parsed_ref->{$server_name} }, $fields_ref ); |
|
1478
|
|
|
|
|
3018
|
|
245
|
|
|
|
|
|
|
|
246
|
1478
|
|
|
|
|
6278
|
return 1; |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
} |
249
|
|
|
|
|
|
|
else { |
250
|
|
|
|
|
|
|
|
251
|
0
|
|
|
|
|
|
return 0; |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
} |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
} |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
=pod |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
=head1 CAVEATS |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
Unfornately the results of C<list tasks> command does not work as expected if a fixed width output type is selected due a bug with |
262
|
|
|
|
|
|
|
the C<srvrmgr> itself in recent versions of Siebel (8 and beyond). |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
Even though a L<Siebel::Srvrmgr::ListParser> instance is capable of identifying a C<list tasks> command output, this class is |
265
|
|
|
|
|
|
|
not being able to properly parse the output from the command. |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
The problem is that the output is not following the expected fixed width as setup with the |
268
|
|
|
|
|
|
|
C<configure list tasks show...> command: with that, the output width is resized depending on the content of each |
269
|
|
|
|
|
|
|
column and thus impossible to predict how to parse it correctly. |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
That said, this class will make all the fields available from C<list tasks> B<only> if a field delimited output was |
272
|
|
|
|
|
|
|
configured within C<srvrmgr>. |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
=head1 SEE ALSO |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
=over |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
=item * |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
L<Siebel::Srvrmgr::ListParser::Output::Tabular> |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
=item * |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
L<Moose> |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
=item * |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
L<Siebel::Srvrmgr::ListParser::Output::ListTasks::Task> |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
=back |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
=head1 AUTHOR |
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt>. |
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
This software is copyright (c) 2013 of Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt>. |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
This file is part of Siebel Monitoring Tools. |
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
Siebel Monitoring Tools is free software: you can redistribute it and/or modify |
303
|
|
|
|
|
|
|
it under the terms of the GNU General Public License as published by |
304
|
|
|
|
|
|
|
the Free Software Foundation, either version 3 of the License, or |
305
|
|
|
|
|
|
|
(at your option) any later version. |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
Siebel Monitoring Tools is distributed in the hope that it will be useful, |
308
|
|
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
309
|
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
310
|
|
|
|
|
|
|
GNU General Public License for more details. |
311
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License |
313
|
|
|
|
|
|
|
along with Siebel Monitoring Tools. If not, see L<http://www.gnu.org/licenses/>. |
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
=cut |
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |