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