| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#------------------------------------------------------------------------------------------------------ |
|
2
|
|
|
|
|
|
|
# OBJET : Consultation de Control-M EM 6/7/8 via son SGBD |
|
3
|
|
|
|
|
|
|
# APPLICATION : Control-M EM |
|
4
|
|
|
|
|
|
|
# AUTEUR : Yoann Le Garff |
|
5
|
|
|
|
|
|
|
# DATE DE CREATION : 17/03/2014 |
|
6
|
|
|
|
|
|
|
#------------------------------------------------------------------------------------------------------ |
|
7
|
|
|
|
|
|
|
# USAGE / AIDE |
|
8
|
|
|
|
|
|
|
# perldoc CTM::ReadEM |
|
9
|
|
|
|
|
|
|
#------------------------------------------------------------------------------------------------------ |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
#-> BEGIN |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
#----> ** initialisation ** |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
package CTM::ReadEM; |
|
16
|
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
22943
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
36
|
|
|
18
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
27
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
1
|
|
|
|
|
395
|
use base qw/ |
|
21
|
|
|
|
|
|
|
CTM::Base |
|
22
|
|
|
|
|
|
|
CTM::Base::MainClass |
|
23
|
1
|
|
|
1
|
|
4
|
/; |
|
|
1
|
|
|
|
|
7
|
|
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
use Exporter::Easy ( |
|
26
|
1
|
|
|
|
|
9
|
OK => [qw/ |
|
27
|
|
|
|
|
|
|
$VERSION |
|
28
|
|
|
|
|
|
|
:ctmFunctions |
|
29
|
|
|
|
|
|
|
:sessionFunctions |
|
30
|
|
|
|
|
|
|
:allFunctions |
|
31
|
|
|
|
|
|
|
:all |
|
32
|
|
|
|
|
|
|
getStatusColorForService |
|
33
|
|
|
|
|
|
|
getSeverityForAlarms |
|
34
|
|
|
|
|
|
|
getSeverityForExceptionAlerts |
|
35
|
|
|
|
|
|
|
getExprForStatusColorForService |
|
36
|
|
|
|
|
|
|
getExprForSeverityForAlarms |
|
37
|
|
|
|
|
|
|
getExprForSeverityForExceptionAlerts |
|
38
|
|
|
|
|
|
|
getNbEMSessionsCreated |
|
39
|
|
|
|
|
|
|
getNbEMSessionsConnected |
|
40
|
|
|
|
|
|
|
/], |
|
41
|
|
|
|
|
|
|
TAGS => [ |
|
42
|
|
|
|
|
|
|
ctmFunctions => [qw/ |
|
43
|
|
|
|
|
|
|
getStatusColorForService |
|
44
|
|
|
|
|
|
|
getSeverityForAlarms |
|
45
|
|
|
|
|
|
|
getSeverityForExceptionAlerts |
|
46
|
|
|
|
|
|
|
getExprForStatusColorForService |
|
47
|
|
|
|
|
|
|
getExprForSeverityForAlarms |
|
48
|
|
|
|
|
|
|
getExprForSeverityForExceptionAlerts |
|
49
|
|
|
|
|
|
|
/], |
|
50
|
|
|
|
|
|
|
sessionFunctions => [qw/ |
|
51
|
|
|
|
|
|
|
getNbEMSessionsCreated |
|
52
|
|
|
|
|
|
|
getNbEMSessionsConnected |
|
53
|
|
|
|
|
|
|
/], |
|
54
|
|
|
|
|
|
|
allFunctions => [qw/ |
|
55
|
|
|
|
|
|
|
:ctmFunctions |
|
56
|
|
|
|
|
|
|
:sessionFunctions |
|
57
|
|
|
|
|
|
|
/], |
|
58
|
|
|
|
|
|
|
all => [qw/ |
|
59
|
|
|
|
|
|
|
$VERSION |
|
60
|
|
|
|
|
|
|
:allFunctions |
|
61
|
|
|
|
|
|
|
/] |
|
62
|
|
|
|
|
|
|
] |
|
63
|
1
|
|
|
1
|
|
517
|
); |
|
|
1
|
|
|
|
|
1138
|
|
|
64
|
|
|
|
|
|
|
|
|
65
|
1
|
|
|
1
|
|
663
|
use CTM::ReadEM::WorkOnCurrentBIMServices 0.18; |
|
|
1
|
|
|
|
|
30
|
|
|
|
1
|
|
|
|
|
41
|
|
|
66
|
1
|
|
|
1
|
|
388
|
use CTM::ReadEM::WorkOnAlarms 0.18; |
|
|
1
|
|
|
|
|
17
|
|
|
|
1
|
|
|
|
|
24
|
|
|
67
|
1
|
|
|
1
|
|
315
|
use CTM::ReadEM::WorkOnExceptionAlerts 0.18; |
|
|
1
|
|
|
|
|
23
|
|
|
|
1
|
|
|
|
|
29
|
|
|
68
|
|
|
|
|
|
|
|
|
69
|
1
|
|
|
|
|
39
|
use Sub::Name qw/ |
|
70
|
|
|
|
|
|
|
subname |
|
71
|
1
|
|
|
1
|
|
5
|
/; |
|
|
1
|
|
|
|
|
1
|
|
|
72
|
1
|
|
|
|
|
32
|
use Carp qw/ |
|
73
|
|
|
|
|
|
|
croak |
|
74
|
1
|
|
|
1
|
|
3
|
/; |
|
|
1
|
|
|
|
|
1
|
|
|
75
|
1
|
|
|
|
|
30
|
use String::Util qw/ |
|
76
|
|
|
|
|
|
|
crunch |
|
77
|
1
|
|
|
1
|
|
4
|
/; |
|
|
1
|
|
|
|
|
1
|
|
|
78
|
1
|
|
|
|
|
63
|
use List::MoreUtils qw/ |
|
79
|
|
|
|
|
|
|
uniq |
|
80
|
1
|
|
|
1
|
|
465
|
/; |
|
|
1
|
|
|
|
|
849
|
|
|
81
|
1
|
|
|
|
|
4
|
use Hash::Util qw/ |
|
82
|
|
|
|
|
|
|
lock_hash |
|
83
|
|
|
|
|
|
|
lock_value |
|
84
|
|
|
|
|
|
|
unlock_value |
|
85
|
1
|
|
|
1
|
|
6
|
/; |
|
|
1
|
|
|
|
|
1
|
|
|
86
|
1
|
|
|
|
|
198
|
use Date::Calc 6.0, qw/ |
|
87
|
|
|
|
|
|
|
Date_to_Time |
|
88
|
1
|
|
|
1
|
|
474
|
/; |
|
|
1
|
|
|
|
|
17958
|
|
|
89
|
1
|
|
|
|
|
8
|
use POSIX qw/ |
|
90
|
|
|
|
|
|
|
strftime |
|
91
|
1
|
|
|
1
|
|
9
|
/; |
|
|
1
|
|
|
|
|
1
|
|
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
#----> ** variables de classe ** |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
our $VERSION = 0.181; |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
my %_emSessionsState = ( |
|
98
|
|
|
|
|
|
|
CTM::Base::_nbSessionsInstancedClassProperty => 0, |
|
99
|
|
|
|
|
|
|
CTM::Base::_nbSessionsConnectedClassProperty => 0 |
|
100
|
|
|
|
|
|
|
); |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
#----> ** fonctions privees (mais accessibles a l'utilisateur pour celles qui ne sont pas des references) ** |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub _calculStartEndDayTimeInPosixTimestamp($$) { |
|
105
|
0
|
|
|
0
|
|
0
|
my ($time, $ctmDailyTime) = @_; |
|
106
|
0
|
0
|
|
|
|
0
|
if ($ctmDailyTime =~ /^(\+|\-)\d{4}$/) { |
|
107
|
0
|
|
|
|
|
0
|
my ($ctmDailyHour, $ctmDailyMin) = unpack '(a2)*', substr $ctmDailyTime, 1, 4; |
|
108
|
0
|
|
|
|
|
0
|
my ($minNow, $hoursNow, $dayNow, $monthNow, $yearNow) = split /\s+/, strftime('%M %H %d %m %Y', localtime $time); |
|
109
|
0
|
|
|
|
|
0
|
my ($previousDay, $previousDayMonth, $previousDayYear) = split /\s+/, strftime('%d %m %Y', localtime $time - 86400); |
|
110
|
0
|
|
|
|
|
0
|
my ($nextDay, $nextDayMonth, $nextDayYear) = split /\s+/, strftime('%d %m %Y', localtime $time + 86400); |
|
111
|
0
|
|
|
|
|
0
|
my %time; |
|
112
|
0
|
0
|
0
|
|
|
0
|
if ($hoursNow >= $ctmDailyHour && $minNow >= $ctmDailyMin) { |
|
113
|
0
|
|
|
|
|
0
|
$time{start} = Date_to_Time($yearNow, $monthNow, $dayNow, $ctmDailyHour, $ctmDailyMin, 00); |
|
114
|
0
|
|
|
|
|
0
|
$time{end} = Date_to_Time($nextDayYear, $nextDayMonth, $nextDay, $ctmDailyHour, $ctmDailyMin, 00); |
|
115
|
|
|
|
|
|
|
} else { |
|
116
|
0
|
|
|
|
|
0
|
$time{start} = Date_to_Time($previousDayYear, $previousDayMonth, $previousDay, $ctmDailyHour, $ctmDailyMin, 00); |
|
117
|
0
|
|
|
|
|
0
|
$time{end} = Date_to_Time($yearNow, $monthNow, $dayNow, $ctmDailyHour, $ctmDailyMin, 00); |
|
118
|
|
|
|
|
|
|
} |
|
119
|
0
|
0
|
|
|
|
0
|
unless (grep { ! defined } values %time) { |
|
|
0
|
|
|
|
|
0
|
|
|
120
|
0
|
0
|
|
|
|
0
|
if ($1 eq '-') { |
|
121
|
0
|
|
|
|
|
0
|
$_ += 86400 for (values %time); |
|
122
|
|
|
|
|
|
|
} |
|
123
|
0
|
|
|
|
|
0
|
return 1, $time{start}, $time{end}; |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
} else { |
|
126
|
0
|
|
|
|
|
0
|
return 0, 1; |
|
127
|
|
|
|
|
|
|
} |
|
128
|
|
|
|
|
|
|
} |
|
129
|
0
|
|
|
|
|
0
|
return 0, 0; |
|
130
|
|
|
|
|
|
|
} |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
#----> ** fonctions publiques ** |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
sub getStatusColorForService($) { |
|
135
|
0
|
|
|
0
|
1
|
0
|
my $statusTo = shift; |
|
136
|
0
|
0
|
|
|
|
0
|
$statusTo = $statusTo->{status_to} if (ref $statusTo eq 'HASH'); |
|
137
|
0
|
0
|
0
|
|
|
0
|
if (defined $statusTo && $statusTo =~ /^\d+$/) { |
|
138
|
0
|
|
|
|
|
0
|
for ($statusTo) { |
|
139
|
0
|
0
|
|
|
|
0
|
$_ == 4 && return 'OK'; |
|
140
|
0
|
0
|
|
|
|
0
|
$_ == 8 && return 'Completed OK'; |
|
141
|
0
|
0
|
0
|
|
|
0
|
($_ >= 16 && $_ < 128) && return 'Error'; |
|
142
|
0
|
0
|
0
|
|
|
0
|
($_ >= 128 && $_ < 256) && return 'Warning'; |
|
143
|
0
|
0
|
|
|
|
0
|
($_ >= 256) && return 'Completed Late'; |
|
144
|
|
|
|
|
|
|
} |
|
145
|
|
|
|
|
|
|
} |
|
146
|
0
|
|
|
|
|
0
|
return 0; |
|
147
|
|
|
|
|
|
|
} |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
sub getSeverityForAlarms($) { |
|
150
|
0
|
|
|
0
|
1
|
0
|
my $severity = shift; |
|
151
|
0
|
0
|
|
|
|
0
|
$severity = $severity->{severity} if (ref $severity eq 'HASH'); |
|
152
|
0
|
0
|
|
|
|
0
|
if (defined $severity) { |
|
153
|
0
|
|
|
|
|
0
|
for ($severity) { |
|
154
|
0
|
0
|
|
|
|
0
|
$_ eq 'R' && return 'Regular'; |
|
155
|
0
|
0
|
|
|
|
0
|
$_ eq 'U' && return 'Urgent'; |
|
156
|
0
|
0
|
|
|
|
0
|
$_ eq 'V' && return 'Very Urgent'; |
|
157
|
|
|
|
|
|
|
} |
|
158
|
|
|
|
|
|
|
} |
|
159
|
0
|
|
|
|
|
0
|
return 0; |
|
160
|
|
|
|
|
|
|
} |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
sub getSeverityForExceptionAlerts($) { |
|
163
|
0
|
|
|
0
|
1
|
0
|
my $xSeverity = shift; |
|
164
|
0
|
0
|
|
|
|
0
|
$xSeverity = $xSeverity->{xseverity} if (ref $xSeverity eq 'HASH'); |
|
165
|
0
|
0
|
0
|
|
|
0
|
if (defined $xSeverity && $xSeverity =~ /^\d+$/) { |
|
166
|
0
|
|
|
|
|
0
|
for ($xSeverity) { |
|
167
|
0
|
0
|
|
|
|
0
|
$_ == 3 && return 'Warning'; |
|
168
|
0
|
0
|
|
|
|
0
|
$_ == 2 && return 'Error'; |
|
169
|
0
|
0
|
|
|
|
0
|
$_ == 1 && return 'Severe'; |
|
170
|
|
|
|
|
|
|
} |
|
171
|
|
|
|
|
|
|
} |
|
172
|
0
|
|
|
|
|
0
|
return 0; |
|
173
|
|
|
|
|
|
|
} |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
sub getExprForStatusColorForService($) { |
|
176
|
0
|
|
|
0
|
1
|
0
|
my ($status, $subName) = (shift, (caller 0)[3]); |
|
177
|
0
|
0
|
|
|
|
0
|
croak(CTM::Base::_myErrorMessage($subName, CTM::Base::_myUsageMessage($subName, '$definedStatus'))) unless (defined $status); |
|
178
|
0
|
|
|
|
|
0
|
for ($status) { |
|
179
|
|
|
|
|
|
|
/^OK$/i && return sub { |
|
180
|
0
|
|
|
0
|
|
0
|
shift == 4 |
|
181
|
0
|
0
|
|
|
|
0
|
}; |
|
182
|
|
|
|
|
|
|
/^Completed OK$/i && return sub { |
|
183
|
0
|
|
|
0
|
|
0
|
shift == 8 |
|
184
|
0
|
0
|
|
|
|
0
|
}; |
|
185
|
|
|
|
|
|
|
/^Error$/i && return sub { |
|
186
|
0
|
0
|
|
0
|
|
0
|
$_[0] >= 16 && $_[0] < 128 |
|
187
|
0
|
0
|
|
|
|
0
|
}; |
|
188
|
|
|
|
|
|
|
/^Warning$/i && return sub { |
|
189
|
0
|
0
|
|
0
|
|
0
|
$_[0] >= 128 && $_[0] < 256 |
|
190
|
0
|
0
|
|
|
|
0
|
}; |
|
191
|
|
|
|
|
|
|
/^Completed Late$/i && return sub { |
|
192
|
0
|
|
|
0
|
|
0
|
shift > 256 |
|
193
|
0
|
0
|
|
|
|
0
|
}; |
|
194
|
|
|
|
|
|
|
} |
|
195
|
|
|
|
|
|
|
return sub { |
|
196
|
0
|
|
|
0
|
|
0
|
shift =~ // |
|
197
|
0
|
|
|
|
|
0
|
}; |
|
198
|
|
|
|
|
|
|
} |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
sub getExprForSeverityForAlarms($) { |
|
201
|
0
|
|
|
0
|
1
|
0
|
my ($severity, $subName) = (shift, (caller 0)[3]); |
|
202
|
0
|
0
|
|
|
|
0
|
croak(CTM::Base::_myErrorMessage($subName, CTM::Base::_myUsageMessage($subName, '$definedSeverity'))) unless (defined $severity); |
|
203
|
0
|
|
|
|
|
0
|
for ($severity) { |
|
204
|
|
|
|
|
|
|
/^Regular$/i && return sub { |
|
205
|
0
|
|
|
0
|
|
0
|
shift eq 'R' |
|
206
|
0
|
0
|
|
|
|
0
|
}; |
|
207
|
|
|
|
|
|
|
/^Urgent$/i && return sub { |
|
208
|
0
|
|
|
0
|
|
0
|
shift eq 'U' |
|
209
|
0
|
0
|
|
|
|
0
|
}; |
|
210
|
|
|
|
|
|
|
/^Very Urgent$/i && return sub { |
|
211
|
0
|
|
|
0
|
|
0
|
shift eq 'V' |
|
212
|
0
|
0
|
|
|
|
0
|
}; |
|
213
|
|
|
|
|
|
|
} |
|
214
|
|
|
|
|
|
|
return sub { |
|
215
|
0
|
|
|
0
|
|
0
|
shift =~ // |
|
216
|
0
|
|
|
|
|
0
|
}; |
|
217
|
|
|
|
|
|
|
} |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
sub getExprForSeverityForExceptionAlerts($) { |
|
220
|
0
|
|
|
0
|
1
|
0
|
my ($severity, $subName) = (shift, (caller 0)[3]); |
|
221
|
0
|
0
|
|
|
|
0
|
croak(CTM::Base::_myErrorMessage($subName, CTM::Base::_myUsageMessage($subName, '$definedSeverity'))) unless (defined $severity); |
|
222
|
0
|
|
|
|
|
0
|
for ($severity) { |
|
223
|
|
|
|
|
|
|
/^Warning$/i && return sub { |
|
224
|
0
|
|
|
0
|
|
0
|
shift == 3 |
|
225
|
0
|
0
|
|
|
|
0
|
}; |
|
226
|
|
|
|
|
|
|
/^Error$/i && return sub { |
|
227
|
0
|
|
|
0
|
|
0
|
shift == 2 |
|
228
|
0
|
0
|
|
|
|
0
|
}; |
|
229
|
|
|
|
|
|
|
/^Severe$/i && return sub { |
|
230
|
0
|
|
|
0
|
|
0
|
shift == 1 |
|
231
|
0
|
0
|
|
|
|
0
|
}; |
|
232
|
|
|
|
|
|
|
} |
|
233
|
|
|
|
|
|
|
return sub { |
|
234
|
0
|
|
|
0
|
|
0
|
shift =~ // |
|
235
|
0
|
|
|
|
|
0
|
}; |
|
236
|
|
|
|
|
|
|
} |
|
237
|
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
sub getNbEMSessionsCreated { |
|
239
|
1
|
|
|
1
|
1
|
329
|
return $_emSessionsState{CTM::Base::_nbSessionsInstancedClassProperty}; |
|
240
|
|
|
|
|
|
|
} |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
sub getNbEMSessionsConnected { |
|
243
|
0
|
|
|
0
|
1
|
0
|
return $_emSessionsState{CTM::Base::_nbSessionsConnectedClassProperty}; |
|
244
|
|
|
|
|
|
|
} |
|
245
|
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
#----> ** methodes privees ** |
|
247
|
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
#-> constructeurs/destructeurs |
|
249
|
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
my $_subClassConstructor = sub { |
|
251
|
|
|
|
|
|
|
my ($self, $subClassLastName, $baseMethod, %params) = @_; |
|
252
|
|
|
|
|
|
|
my $subSelf = {}; |
|
253
|
|
|
|
|
|
|
$subSelf->{CTM::Base::_rootClassEMPrivate} = $self; |
|
254
|
|
|
|
|
|
|
$subSelf->{CTM::Base::_workingObjProperty} = 0; |
|
255
|
|
|
|
|
|
|
$subSelf->{CTM::Base::_errorsObjProperty} = []; |
|
256
|
|
|
|
|
|
|
$subSelf->{CTM::Base::_paramsObjProperty} = \%params; |
|
257
|
|
|
|
|
|
|
$subSelf->{CTM::Base::_subClassDatasObjProperty} = $self->$baseMethod(%params); |
|
258
|
|
|
|
|
|
|
return bless $subSelf, __PACKAGE__ . '::' . $subClassLastName; |
|
259
|
|
|
|
|
|
|
}; |
|
260
|
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
#-> directement liees aux actions sur le SGBD |
|
262
|
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
my $_getDatasCentersDownloadInfos = subname '_getDatasCentersDownloadInfos' => sub { |
|
264
|
|
|
|
|
|
|
my $self = shift; |
|
265
|
|
|
|
|
|
|
my $sth = $self->_DBI()->prepare(<
|
|
266
|
|
|
|
|
|
|
SELECT d.data_center, d.netname, TO_CHAR(t.dt, 'YYYY/MM/DD HH:MI:SS') AS download_time_to_char, c.ctm_daily_time |
|
267
|
|
|
|
|
|
|
FROM comm c, ( |
|
268
|
|
|
|
|
|
|
SELECT data_center, MAX(download_time) AS dt |
|
269
|
|
|
|
|
|
|
FROM download |
|
270
|
|
|
|
|
|
|
GROUP by data_center |
|
271
|
|
|
|
|
|
|
) t JOIN download d ON d.data_center = t.data_center AND t.dt = d.download_time |
|
272
|
|
|
|
|
|
|
WHERE c.data_center = d.data_center |
|
273
|
|
|
|
|
|
|
AND c.enabled = '1'; |
|
274
|
|
|
|
|
|
|
SQL |
|
275
|
|
|
|
|
|
|
$self->_invokeVerbose((caller 0)[3], "\n" . $sth->{Statement} . "\n"); |
|
276
|
|
|
|
|
|
|
if ($sth->execute()) { |
|
277
|
|
|
|
|
|
|
my $hashRef = $sth->fetchall_hashref('data_center'); |
|
278
|
|
|
|
|
|
|
for (values %{$hashRef}) { |
|
279
|
|
|
|
|
|
|
($_->{active_net_table_name} = $_->{netname}) =~ s/[^\d]//g; |
|
280
|
|
|
|
|
|
|
$_->{active_net_table_name} = 'a' . $_->{active_net_table_name} . '_ajob'; |
|
281
|
|
|
|
|
|
|
} |
|
282
|
|
|
|
|
|
|
return 1, $hashRef; |
|
283
|
|
|
|
|
|
|
} else { |
|
284
|
|
|
|
|
|
|
return 0, crunch($self->_DBI()->errstr()); |
|
285
|
|
|
|
|
|
|
} |
|
286
|
|
|
|
|
|
|
}; |
|
287
|
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
my $_getCurrentBIMServices = subname 'getCurrentBIMServices' => sub { |
|
289
|
|
|
|
|
|
|
my ($self, $datacenterInfos, $matching, $deleteFlag, $forLastNetName, $serviceStatus, $forDataCenters) = @_; |
|
290
|
|
|
|
|
|
|
if (%{$datacenterInfos}) { |
|
291
|
|
|
|
|
|
|
my $sqlRequest = <
|
|
292
|
|
|
|
|
|
|
SELECT *, TO_CHAR(order_time, 'YYYY/MM/DD HH:MI:SS') AS order_time_to_char |
|
293
|
|
|
|
|
|
|
FROM bim_log |
|
294
|
|
|
|
|
|
|
WHERE log_id IN ( |
|
295
|
|
|
|
|
|
|
SELECT MAX(log_id) |
|
296
|
|
|
|
|
|
|
FROM bim_log |
|
297
|
|
|
|
|
|
|
GROUP BY order_id |
|
298
|
|
|
|
|
|
|
) |
|
299
|
|
|
|
|
|
|
AND service_name LIKE ? |
|
300
|
|
|
|
|
|
|
AND order_id IN ( |
|
301
|
|
|
|
|
|
|
SQL |
|
302
|
|
|
|
|
|
|
$sqlRequest .= join("\n UNION\n", map { ' SELECT order_id FROM ' . $_->{active_net_table_name} . " WHERE appl_type = 'BIM'" . ($deleteFlag ? " AND delete_flag = '0'" : '') } values %{$datacenterInfos}) . "\n)\n"; |
|
303
|
|
|
|
|
|
|
if ($forLastNetName) { |
|
304
|
|
|
|
|
|
|
$sqlRequest .= "AND active_net_name IN ('" . join("', '", map { $_->{netname} } values %{$datacenterInfos}) . "')\n"; |
|
305
|
|
|
|
|
|
|
} |
|
306
|
|
|
|
|
|
|
if (ref $serviceStatus eq 'ARRAY' && @{$serviceStatus}) { |
|
307
|
|
|
|
|
|
|
$sqlRequest .= 'AND (' . join(' OR ', map { |
|
308
|
|
|
|
|
|
|
if ($_ eq 'OK') { |
|
309
|
|
|
|
|
|
|
"status_to = '4'"; |
|
310
|
|
|
|
|
|
|
} elsif ($_ eq 'Completed_OK') { |
|
311
|
|
|
|
|
|
|
"status_to = '8'"; |
|
312
|
|
|
|
|
|
|
} elsif ($_ eq 'Error') { |
|
313
|
|
|
|
|
|
|
"(status_to >= '16' AND status_to < '128')"; |
|
314
|
|
|
|
|
|
|
} elsif ($_ eq 'Warning') { |
|
315
|
|
|
|
|
|
|
"(status_to >= '128' AND status_to < '256')"; |
|
316
|
|
|
|
|
|
|
} elsif ($_ eq 'Completed_Late') { |
|
317
|
|
|
|
|
|
|
"status_to >= '256'"; |
|
318
|
|
|
|
|
|
|
} |
|
319
|
|
|
|
|
|
|
} uniq(@{$serviceStatus})) . ")\n"; |
|
320
|
|
|
|
|
|
|
} |
|
321
|
|
|
|
|
|
|
my $forDataCentersProcess = ref $forDataCenters eq 'ARRAY' && @{$forDataCenters}; |
|
322
|
|
|
|
|
|
|
my @forDataCentersUniq = $forDataCentersProcess ? uniq(@{$forDataCenters}) : (); |
|
323
|
|
|
|
|
|
|
if ($forDataCentersProcess) { |
|
324
|
|
|
|
|
|
|
$sqlRequest .= 'AND data_center IN (' . join(', ', ('?') x @forDataCentersUniq) . ")\n"; |
|
325
|
|
|
|
|
|
|
} |
|
326
|
|
|
|
|
|
|
my $sth = $self->_DBI()->prepare($sqlRequest . "ORDER BY service_name;\n"); |
|
327
|
|
|
|
|
|
|
$self->_invokeVerbose((caller 0)[3], "\n" . $sth->{Statement} . "\n"); |
|
328
|
|
|
|
|
|
|
if ($sth->execute($matching, @forDataCentersUniq)) { |
|
329
|
|
|
|
|
|
|
return 1, $sth->fetchall_hashref('log_id'); |
|
330
|
|
|
|
|
|
|
} else { |
|
331
|
|
|
|
|
|
|
return 0, crunch($sth->errstr()); |
|
332
|
|
|
|
|
|
|
} |
|
333
|
|
|
|
|
|
|
} |
|
334
|
|
|
|
|
|
|
return 0, undef; |
|
335
|
|
|
|
|
|
|
}; |
|
336
|
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
my $_getAlarms = subname 'getAlarms' => sub { |
|
338
|
|
|
|
|
|
|
my ($self, $matching, $severity, $timeSort) = @_; |
|
339
|
|
|
|
|
|
|
my $sqlRequest = <
|
|
340
|
|
|
|
|
|
|
SELECT *, TO_CHAR(upd_time, 'YYYY/MM/DD HH:MI:SS') AS upd_time_to_char |
|
341
|
|
|
|
|
|
|
FROM alarm |
|
342
|
|
|
|
|
|
|
WHERE message LIKE ? |
|
343
|
|
|
|
|
|
|
SQL |
|
344
|
|
|
|
|
|
|
if (ref $severity eq 'ARRAY' && @{$severity}) { |
|
345
|
|
|
|
|
|
|
$sqlRequest .= 'AND (' . join(' OR ', map { |
|
346
|
|
|
|
|
|
|
if ($_ eq 'Regular') { |
|
347
|
|
|
|
|
|
|
"severity = 'R'"; |
|
348
|
|
|
|
|
|
|
} elsif ($_ eq 'Urgent') { |
|
349
|
|
|
|
|
|
|
"severity = 'U'"; |
|
350
|
|
|
|
|
|
|
} elsif ($_ eq 'Very_Urgent') { |
|
351
|
|
|
|
|
|
|
"severity = 'V'"; |
|
352
|
|
|
|
|
|
|
} |
|
353
|
|
|
|
|
|
|
} uniq(@{$severity})) . ")\n"; |
|
354
|
|
|
|
|
|
|
} |
|
355
|
|
|
|
|
|
|
my $sth = $self->_DBI()->prepare($sqlRequest . 'ORDER BY upd_time ' . $timeSort . ";\n"); |
|
356
|
|
|
|
|
|
|
$self->_invokeVerbose((caller 0)[3], "\n" . $sth->{Statement} . "\n"); |
|
357
|
|
|
|
|
|
|
if ($sth->execute($matching)) { |
|
358
|
|
|
|
|
|
|
my $hashRef = $sth->fetchall_hashref('serial'); |
|
359
|
|
|
|
|
|
|
return 1, $hashRef; |
|
360
|
|
|
|
|
|
|
} else { |
|
361
|
|
|
|
|
|
|
return 0, crunch($self->_DBI()->errstr()); |
|
362
|
|
|
|
|
|
|
} |
|
363
|
|
|
|
|
|
|
}; |
|
364
|
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
my $_getExceptionAlerts = subname 'getExceptionAlerts' => sub { |
|
366
|
|
|
|
|
|
|
my ($self, $matching, $severity, $timeSort) = @_; |
|
367
|
|
|
|
|
|
|
my $sqlRequest = <
|
|
368
|
|
|
|
|
|
|
SELECT *, TO_CHAR(xtime, 'YYYY/MM/DD HH:MI:SS') AS xtime_to_char, TO_CHAR(xtime_of_last, 'YYYY/MM/DD HH:MI:SS') AS xtime_of_last_to_char |
|
369
|
|
|
|
|
|
|
FROM exception_alerts |
|
370
|
|
|
|
|
|
|
WHERE message LIKE ? |
|
371
|
|
|
|
|
|
|
SQL |
|
372
|
|
|
|
|
|
|
if (ref $severity eq 'ARRAY' && @{$severity}) { |
|
373
|
|
|
|
|
|
|
$sqlRequest .= 'AND (' . join(' OR ', map { |
|
374
|
|
|
|
|
|
|
if ($_ eq 'Warning') { |
|
375
|
|
|
|
|
|
|
"xseverity = '3'"; |
|
376
|
|
|
|
|
|
|
} elsif ($_ eq 'Error') { |
|
377
|
|
|
|
|
|
|
"xseverity = '2'"; |
|
378
|
|
|
|
|
|
|
} elsif ($_ eq 'Severe') { |
|
379
|
|
|
|
|
|
|
"xseverity = '1'"; |
|
380
|
|
|
|
|
|
|
} |
|
381
|
|
|
|
|
|
|
} uniq(@{$severity})) . ")\n"; |
|
382
|
|
|
|
|
|
|
} |
|
383
|
|
|
|
|
|
|
my $sth = $self->_DBI()->prepare($sqlRequest . 'ORDER BY xtime ' . $timeSort . ";\n"); |
|
384
|
|
|
|
|
|
|
$self->_invokeVerbose((caller 0)[3], "\n" . $sth->{Statement} . "\n"); |
|
385
|
|
|
|
|
|
|
if ($sth->execute($matching)) { |
|
386
|
|
|
|
|
|
|
my $hashRef = $sth->fetchall_hashref('serial'); |
|
387
|
|
|
|
|
|
|
return 1, $hashRef; |
|
388
|
|
|
|
|
|
|
} else { |
|
389
|
|
|
|
|
|
|
return 0, crunch($self->_DBI()->errstr()); |
|
390
|
|
|
|
|
|
|
} |
|
391
|
|
|
|
|
|
|
}; |
|
392
|
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
#----> ** methodes publiques ** |
|
394
|
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
#-> wrappers de constructeurs/destructeurs |
|
396
|
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
sub new { |
|
398
|
1
|
|
|
1
|
1
|
25
|
my $subName = (caller 0)[3]; |
|
399
|
1
|
50
|
|
|
|
5
|
croak(CTM::Base::_myErrorMessage($subName, CTM::Base::_myUsageMessage('$session->' . $subName, "'cle' => 'valeur'"))) unless (@_ % 2); |
|
400
|
1
|
|
|
|
|
13
|
my $self = shift->SUPER::_new(@_); |
|
401
|
1
|
|
|
|
|
2
|
lock_hash(%{$self}); |
|
|
1
|
|
|
|
|
10
|
|
|
402
|
1
|
|
|
|
|
35
|
$_emSessionsState{CTM::Base::_nbSessionsInstancedClassProperty}++; |
|
403
|
1
|
|
|
|
|
2
|
return $self; |
|
404
|
|
|
|
|
|
|
} |
|
405
|
|
|
|
|
|
|
|
|
406
|
|
|
|
|
|
|
*newSession = \&new; |
|
407
|
|
|
|
|
|
|
|
|
408
|
|
|
|
|
|
|
sub connect { |
|
409
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
410
|
0
|
|
|
|
|
0
|
unlock_value(%{$self}, CTM::Base::_DBIObjProperty); |
|
|
0
|
|
|
|
|
0
|
|
|
411
|
0
|
|
|
|
|
0
|
my $return = $self->SUPER::_connect(qw/ |
|
412
|
|
|
|
|
|
|
download |
|
413
|
|
|
|
|
|
|
bim_log |
|
414
|
|
|
|
|
|
|
bim_prob_jobs |
|
415
|
|
|
|
|
|
|
bim_alert |
|
416
|
|
|
|
|
|
|
comm |
|
417
|
|
|
|
|
|
|
alarm |
|
418
|
|
|
|
|
|
|
exception_alerts |
|
419
|
|
|
|
|
|
|
/); |
|
420
|
0
|
|
|
|
|
0
|
lock_value(%{$self}, CTM::Base::_DBIObjProperty); |
|
|
0
|
|
|
|
|
0
|
|
|
421
|
0
|
0
|
|
|
|
0
|
$_emSessionsState{CTM::Base::_nbSessionsConnectedClassProperty}++ if ($self->isSessionSeemAlive()); |
|
422
|
0
|
|
|
|
|
0
|
return $return; |
|
423
|
|
|
|
|
|
|
} |
|
424
|
|
|
|
|
|
|
|
|
425
|
|
|
|
|
|
|
*connectToDB = \&connect; |
|
426
|
|
|
|
|
|
|
|
|
427
|
|
|
|
|
|
|
sub disconnect { |
|
428
|
1
|
|
|
1
|
1
|
1
|
my $self = shift; |
|
429
|
1
|
|
|
|
|
2
|
unlock_value(%{$self}, CTM::Base::_DBIObjProperty); |
|
|
1
|
|
|
|
|
4
|
|
|
430
|
1
|
|
|
|
|
17
|
my $return = $self->_disconnect(); |
|
431
|
1
|
|
|
|
|
2
|
lock_value(%{$self}, CTM::Base::_DBIObjProperty); |
|
|
1
|
|
|
|
|
2
|
|
|
432
|
1
|
50
|
|
|
|
5
|
$_emSessionsState{CTM::Base::_nbSessionsConnectedClassProperty}-- unless ($self->isSessionSeemAlive()); |
|
433
|
1
|
|
|
|
|
2
|
return $return; |
|
434
|
|
|
|
|
|
|
} |
|
435
|
|
|
|
|
|
|
|
|
436
|
|
|
|
|
|
|
*disconnectFromDB = \&disconnect; |
|
437
|
|
|
|
|
|
|
|
|
438
|
|
|
|
|
|
|
#-> methodes liees aux services du BIM (BIM) |
|
439
|
|
|
|
|
|
|
|
|
440
|
|
|
|
|
|
|
sub getCurrentBIMServices { |
|
441
|
0
|
|
|
0
|
1
|
0
|
my $subName = (caller 0)[3]; |
|
442
|
0
|
0
|
|
|
|
0
|
croak(CTM::Base::_myErrorMessage($subName, CTM::Base::_myUsageMessage('$session->' . $subName, "'cle' => 'valeur'"))) unless (@_ % 2); |
|
443
|
0
|
|
|
|
|
0
|
my ($self, %params) = @_; |
|
444
|
0
|
|
|
|
|
0
|
$self->unshiftError(); |
|
445
|
0
|
0
|
|
|
|
0
|
if ($self->isSessionSeemAlive()) { |
|
446
|
0
|
|
|
|
|
0
|
my ($situation, $datacenterInfos) = $self->$_getDatasCentersDownloadInfos(); |
|
447
|
0
|
0
|
|
|
|
0
|
if ($situation) { |
|
448
|
0
|
|
|
|
|
0
|
my $time = time; |
|
449
|
0
|
|
|
|
|
0
|
for my $datacenter (keys %{$datacenterInfos}) { |
|
|
0
|
|
|
|
|
0
|
|
|
450
|
0
|
|
|
|
|
0
|
($situation, my $datacenterOdateStart, my $datacenterOdateEnd) = _calculStartEndDayTimeInPosixTimestamp($time, $datacenterInfos->{$datacenter}->{ctm_daily_time}); |
|
451
|
0
|
0
|
|
|
|
0
|
if ($situation) { |
|
452
|
0
|
0
|
|
|
|
0
|
if (defined (my $downloadTimeInTimestamp = Date_to_Time(split /[\/:\s]+/, $datacenterInfos->{$datacenter}->{download_time_to_char}))) { |
|
453
|
0
|
0
|
0
|
|
|
0
|
delete $datacenterInfos->{$datacenter} unless ($downloadTimeInTimestamp >= $datacenterOdateStart && $downloadTimeInTimestamp <= $datacenterOdateEnd); |
|
454
|
|
|
|
|
|
|
} else { |
|
455
|
0
|
|
|
|
|
0
|
$self->_addError(CTM::Base::_myErrorMessage($subName, "le champ 'download_time_to_char' qui derive de la cle 'download_time' (DATETIME) via la fonction SQL TO_CHAR() (Control-M '" . $datacenterInfos->{$datacenter}->{service_name} . "') n'est pas correct ou n'est pas gere par le module. Il est possible que la base de donnees du Control-M EM soit corrompue ou que la version renseignee (version '" . $self->{_version} . "') ne soit pas correcte.")); |
|
456
|
0
|
|
|
|
|
0
|
return 0; |
|
457
|
|
|
|
|
|
|
} |
|
458
|
|
|
|
|
|
|
} else { |
|
459
|
0
|
0
|
|
|
|
0
|
if ($datacenterOdateStart) { |
|
460
|
0
|
|
|
|
|
0
|
$self->_addError(CTM::Base::_myErrorMessage($subName, "une erreur a eu lieu lors de la generation du timestamp POSIX pour la date de debut et de fin de la derniere montee au plan.")); |
|
461
|
|
|
|
|
|
|
} else { |
|
462
|
0
|
|
|
|
|
0
|
$self->_addError(CTM::Base::_myErrorMessage($subName, "le champ 'ctm_daily_time' du datacenter '" . $datacenterInfos->{$datacenter}->{data_center} . "' n'est pas correct " . '(=~ /^[\+\-]\d{4}$/).')); |
|
463
|
|
|
|
|
|
|
} |
|
464
|
0
|
|
|
|
|
0
|
return 0; |
|
465
|
|
|
|
|
|
|
} |
|
466
|
|
|
|
|
|
|
} |
|
467
|
0
|
0
|
|
|
|
0
|
($situation, my $servicesDatas) = $self->$_getCurrentBIMServices($datacenterInfos, defined $params{matching} ? $params{matching} : '%', defined $params{handleDeletedJobs} ? $params{handleDeletedJobs} : 1, defined $params{forLastNetName} ? $params{forLastNetName} : 0, defined $params{forStatus} ? $params{forStatus} : 0, defined $params{forDataCenters} ? $params{forDataCenters} : 0); |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
468
|
0
|
0
|
|
|
|
0
|
unless ($situation) { |
|
469
|
0
|
0
|
|
|
|
0
|
if (defined $servicesDatas) { |
|
470
|
0
|
|
|
|
|
0
|
$self->_addError(CTM::Base::_myErrorMessage($subName, "erreur lors de la recuperation des services du BIM : la methode DBI 'execute()' a echoue : '" . $servicesDatas . "'.")); |
|
471
|
0
|
|
|
|
|
0
|
return 0; |
|
472
|
|
|
|
|
|
|
} else { |
|
473
|
0
|
|
|
|
|
0
|
return {}; |
|
474
|
|
|
|
|
|
|
} |
|
475
|
|
|
|
|
|
|
} |
|
476
|
0
|
|
|
|
|
0
|
return $servicesDatas; |
|
477
|
|
|
|
|
|
|
} else { |
|
478
|
0
|
|
|
|
|
0
|
$self->_addError(CTM::Base::_myErrorMessage($subName, "erreur lors de la recuperation des informations a propos des Control-M Server : la methode DBI 'execute()' a echoue : '" . $datacenterInfos . "'.")); |
|
479
|
|
|
|
|
|
|
} |
|
480
|
|
|
|
|
|
|
} else { |
|
481
|
0
|
|
|
|
|
0
|
$self->_addError(CTM::Base::_myErrorMessage($subName, "impossible de continuer car la connexion au SGBD n'est pas active.")); |
|
482
|
|
|
|
|
|
|
} |
|
483
|
0
|
|
|
|
|
0
|
return 0; |
|
484
|
|
|
|
|
|
|
} |
|
485
|
|
|
|
|
|
|
|
|
486
|
|
|
|
|
|
|
sub workOnCurrentBIMServices { |
|
487
|
0
|
|
|
0
|
1
|
0
|
my $subName = (caller 0)[3]; |
|
488
|
0
|
0
|
|
|
|
0
|
croak(CTM::Base::_myErrorMessage($subName, CTM::Base::_myUsageMessage('$session->' . $subName, "'cle' => 'valeur'"))) unless (@_ % 2); |
|
489
|
0
|
|
|
|
|
0
|
my $self = shift->$_subClassConstructor(CTM::Base::_currentBIMServicesModuleLastName, CTM::Base::_currentBIMServicesBaseMethod, @_); |
|
490
|
0
|
|
|
|
|
0
|
lock_hash(%{$self}); |
|
|
0
|
|
|
|
|
0
|
|
|
491
|
0
|
|
|
|
|
0
|
return $self; |
|
492
|
|
|
|
|
|
|
} |
|
493
|
|
|
|
|
|
|
|
|
494
|
|
|
|
|
|
|
#-> methodes liees aux alarmes (GAS) |
|
495
|
|
|
|
|
|
|
|
|
496
|
|
|
|
|
|
|
sub getAlarms { |
|
497
|
0
|
|
|
0
|
1
|
0
|
my $subName = (caller 0)[3]; |
|
498
|
0
|
0
|
|
|
|
0
|
croak(CTM::Base::_myErrorMessage($subName, CTM::Base::_myUsageMessage('$session->' . $subName, "'cle' => 'valeur'"))) unless (@_ % 2); |
|
499
|
0
|
|
|
|
|
0
|
my ($self, %params) = @_; |
|
500
|
0
|
|
|
|
|
0
|
$self->unshiftError(); |
|
501
|
0
|
0
|
|
|
|
0
|
if ($self->isSessionSeemAlive()) { |
|
502
|
0
|
0
|
0
|
|
|
0
|
my ($situation, $alarmsData) = $self->$_getAlarms(defined $params{matching} ? $params{matching} : '%', defined $params{severity} ? $params{severity} : 0, defined $params{timeSort} && $params{timeSort} =~ /^(ASC|DESC)$/i ? $params{timeSort} : 'ASC'); |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
503
|
0
|
0
|
|
|
|
0
|
if ($situation) { |
|
504
|
0
|
|
|
|
|
0
|
return $alarmsData; |
|
505
|
|
|
|
|
|
|
} else { |
|
506
|
0
|
|
|
|
|
0
|
$self->_addError(CTM::Base::_myErrorMessage($subName, "erreur lors de la recuperation des informations a propos des exceptions : la methode DBI 'execute()' a echoue : '" . $alarmsData . "'.")); |
|
507
|
|
|
|
|
|
|
} |
|
508
|
|
|
|
|
|
|
} else { |
|
509
|
0
|
|
|
|
|
0
|
$self->_addError(CTM::Base::_myErrorMessage($subName, "impossible de continuer car la connexion au SGBD n'est pas active.")); |
|
510
|
|
|
|
|
|
|
} |
|
511
|
0
|
|
|
|
|
0
|
return 0; |
|
512
|
|
|
|
|
|
|
} |
|
513
|
|
|
|
|
|
|
|
|
514
|
|
|
|
|
|
|
sub workOnAlarms { |
|
515
|
0
|
|
|
0
|
1
|
0
|
my $subName = (caller 0)[3]; |
|
516
|
0
|
0
|
|
|
|
0
|
croak(CTM::Base::_myErrorMessage($subName, CTM::Base::_myUsageMessage('$session->' . $subName, "'cle' => 'valeur'"))) unless (@_ % 2); |
|
517
|
0
|
|
|
|
|
0
|
my $self = shift->$_subClassConstructor(CTM::Base::_alarmsModuleLastName, CTM::Base::_alarmsBaseMethod, @_); |
|
518
|
0
|
|
|
|
|
0
|
lock_hash(%{$self}); |
|
|
0
|
|
|
|
|
0
|
|
|
519
|
0
|
|
|
|
|
0
|
return $self; |
|
520
|
|
|
|
|
|
|
} |
|
521
|
|
|
|
|
|
|
|
|
522
|
|
|
|
|
|
|
#-> methodes liees aux exceptions (CM) |
|
523
|
|
|
|
|
|
|
|
|
524
|
|
|
|
|
|
|
sub getExceptionAlerts { |
|
525
|
0
|
|
|
0
|
1
|
0
|
my $subName = (caller 0)[3]; |
|
526
|
0
|
0
|
|
|
|
0
|
croak(CTM::Base::_myErrorMessage($subName, CTM::Base::_myUsageMessage('$session->' . $subName, "'cle' => 'valeur'"))) unless (@_ % 2); |
|
527
|
0
|
|
|
|
|
0
|
my ($self, %params) = @_; |
|
528
|
0
|
|
|
|
|
0
|
$self->unshiftError(); |
|
529
|
0
|
0
|
|
|
|
0
|
if ($self->isSessionSeemAlive()) { |
|
530
|
0
|
0
|
0
|
|
|
0
|
my ($situation, $exceptionAlertsDatas) = $self->$_getExceptionAlerts(defined $params{matching} ? $params{matching} : '%', defined $params{severity} ? $params{severity} : 0, defined $params{timeSort} && $params{timeSort} =~ /^(ASC|DESC)$/i ? $params{timeSort} : 'ASC'); |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
531
|
0
|
0
|
|
|
|
0
|
if ($situation) { |
|
532
|
0
|
|
|
|
|
0
|
return $exceptionAlertsDatas; |
|
533
|
|
|
|
|
|
|
} else { |
|
534
|
0
|
|
|
|
|
0
|
$self->_addError(CTM::Base::_myErrorMessage($subName, "erreur lors de la recuperation des informations a propos des exceptions : la methode DBI 'execute()' a echoue : '" . $exceptionAlertsDatas . "'.")); |
|
535
|
|
|
|
|
|
|
} |
|
536
|
|
|
|
|
|
|
} else { |
|
537
|
0
|
|
|
|
|
0
|
$self->_addError(CTM::Base::_myErrorMessage($subName, "impossible de continuer car la connexion au SGBD n'est pas active.")); |
|
538
|
|
|
|
|
|
|
} |
|
539
|
0
|
|
|
|
|
0
|
return 0; |
|
540
|
|
|
|
|
|
|
} |
|
541
|
|
|
|
|
|
|
|
|
542
|
|
|
|
|
|
|
sub workOnExceptionAlerts { |
|
543
|
0
|
|
|
0
|
1
|
0
|
my $subName = (caller 0)[3]; |
|
544
|
0
|
0
|
|
|
|
0
|
croak(CTM::Base::_myErrorMessage($subName, CTM::Base::_myUsageMessage('$session->' . $subName, "'cle' => 'valeur'"))) unless (@_ % 2); |
|
545
|
0
|
|
|
|
|
0
|
my $self = shift->$_subClassConstructor(CTM::Base::_exceptionAlertsModuleLastName, CTM::Base::_exceptionAlertsBaseMethod, @_); |
|
546
|
0
|
|
|
|
|
0
|
lock_hash(%{$self}); |
|
|
0
|
|
|
|
|
0
|
|
|
547
|
0
|
|
|
|
|
0
|
return $self; |
|
548
|
|
|
|
|
|
|
} |
|
549
|
|
|
|
|
|
|
|
|
550
|
|
|
|
|
|
|
#-> methodes liees aux composants (CM) |
|
551
|
|
|
|
|
|
|
|
|
552
|
|
|
|
|
|
|
# sub getComponents { |
|
553
|
|
|
|
|
|
|
# my $subName = (caller 0)[3]; |
|
554
|
|
|
|
|
|
|
# croak(CTM::Base::_myErrorMessage($subName, CTM::Base::_myUsageMessage('$session->' . $subName, "'cle' => 'valeur'"))) unless (@_ % 2); |
|
555
|
|
|
|
|
|
|
# my ($self, %params) = @_; |
|
556
|
|
|
|
|
|
|
# $self->unshiftError(); |
|
557
|
|
|
|
|
|
|
# if ($self->isSessionSeemAlive()) { |
|
558
|
|
|
|
|
|
|
# my ($situation, $exceptionAlertsDatas) = $self->$_getComponents()); |
|
559
|
|
|
|
|
|
|
# if ($situation) { |
|
560
|
|
|
|
|
|
|
# return $exceptionAlertsDatas; |
|
561
|
|
|
|
|
|
|
# } else { |
|
562
|
|
|
|
|
|
|
# $self->_addError(CTM::Base::_myErrorMessage($subName, "erreur lors de la recuperation des informations a propos des composants : la methode DBI 'execute()' a echoue : '" . $exceptionAlertsDatas . "'.")); |
|
563
|
|
|
|
|
|
|
# } |
|
564
|
|
|
|
|
|
|
# } else { |
|
565
|
|
|
|
|
|
|
# $self->_addError(CTM::Base::_myErrorMessage($subName, "impossible de continuer car la connexion au SGBD n'est pas active.")); |
|
566
|
|
|
|
|
|
|
# } |
|
567
|
|
|
|
|
|
|
# return 0; |
|
568
|
|
|
|
|
|
|
# } |
|
569
|
|
|
|
|
|
|
|
|
570
|
|
|
|
|
|
|
# sub workOnComponents { |
|
571
|
|
|
|
|
|
|
# my $subName = (caller 0)[3]; |
|
572
|
|
|
|
|
|
|
# croak(CTM::Base::_myErrorMessage($subName, CTM::Base::_myUsageMessage('$session->' . $subName, "'cle' => 'valeur'"))) unless (@_ % 2); |
|
573
|
|
|
|
|
|
|
# my $self = shift->$_subClassConstructor(CTM::Base::_componentsModuleLastName, CTM::Base::_componentsBaseMethod, @_); |
|
574
|
|
|
|
|
|
|
# lock_hash(%{$self}); |
|
575
|
|
|
|
|
|
|
# return $self; |
|
576
|
|
|
|
|
|
|
# } |
|
577
|
|
|
|
|
|
|
|
|
578
|
|
|
|
|
|
|
#-> accesseurs/mutateurs |
|
579
|
|
|
|
|
|
|
|
|
580
|
|
|
|
|
|
|
sub isSessionAlive { |
|
581
|
0
|
|
|
0
|
1
|
0
|
return shift->SUPER::_isSessionAlive(); |
|
582
|
|
|
|
|
|
|
} |
|
583
|
|
|
|
|
|
|
|
|
584
|
|
|
|
|
|
|
sub isSessionSeemAlive { |
|
585
|
|
|
|
|
|
|
return shift->SUPER::_isSessionSeemAlive() |
|
586
|
2
|
|
|
2
|
1
|
13
|
} |
|
587
|
|
|
|
|
|
|
|
|
588
|
|
|
|
|
|
|
#-> Perl BuiltIn |
|
589
|
|
|
|
|
|
|
|
|
590
|
|
|
|
|
|
|
BEGIN { |
|
591
|
1
|
|
|
1
|
|
3255
|
*AUTOLOAD = \&CTM::Base::AUTOLOAD; |
|
592
|
|
|
|
|
|
|
} |
|
593
|
|
|
|
|
|
|
|
|
594
|
|
|
|
|
|
|
sub DESTROY { |
|
595
|
1
|
|
|
1
|
|
2
|
my $self = shift; |
|
596
|
1
|
|
|
|
|
6
|
$self->disconnect(); |
|
597
|
1
|
|
|
|
|
28
|
$_emSessionsState{CTM::Base::_nbSessionsInstancedClassProperty}--; |
|
598
|
|
|
|
|
|
|
} |
|
599
|
|
|
|
|
|
|
|
|
600
|
|
|
|
|
|
|
1; |
|
601
|
|
|
|
|
|
|
|
|
602
|
|
|
|
|
|
|
#-> END |
|
603
|
|
|
|
|
|
|
|
|
604
|
|
|
|
|
|
|
__END__ |