1
- #
1
+ #
2
2
# Licensed under the Apache License, Version 2.0 (the "License");
3
3
# you may not use this file except in compliance with the License.
4
4
# You may obtain a copy of the License at
5
- #
5
+ #
6
6
# http://www.apache.org/licenses/LICENSE-2.0
7
- #
7
+ #
8
8
# Unless required by applicable law or agreed to in writing, software
9
9
# distributed under the License is distributed on an "AS IS" BASIS,
10
10
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,7 +32,7 @@ use JSON;
32
32
use Toolkit_helpers qw ( logger) ;
33
33
34
34
# constructor
35
- # parameters
35
+ # parameters
36
36
# - dlpxObject - connection to DE
37
37
# - debug - debug flag (debug on if defined)
38
38
@@ -48,9 +48,9 @@ sub new {
48
48
_dlpxObject => $dlpxObject ,
49
49
_debug => $debug
50
50
};
51
-
51
+
52
52
bless ($self ,$classname );
53
-
53
+
54
54
$self -> LoadSystem();
55
55
return $self ;
56
56
}
@@ -60,7 +60,7 @@ sub new {
60
60
# parameters: none
61
61
# Return an Engine SSH key
62
62
63
- sub getSSHPublicKey
63
+ sub getSSHPublicKey
64
64
{
65
65
my $self = shift ;
66
66
logger($self -> {_debug }, " Entering System_obj::getSSHPublicKey" ,1);
@@ -71,15 +71,15 @@ sub getSSHPublicKey
71
71
# parameters: none
72
72
# Return an Engine storage hash (Used, Free, Total, pct used) GB
73
73
74
- sub getStorage
74
+ sub getStorage
75
75
{
76
76
my $self = shift ;
77
77
logger($self -> {_debug }, " Entering System_obj::getStorage" ,1);
78
78
my %stor = (
79
79
Total => sprintf (" %2 .2f" ,$self -> {_system }-> {storageTotal }/1024/1024/1024),
80
80
Used => sprintf (" %2 .2f" ,$self -> {_system }-> {storageUsed }/1024/1024/1024),
81
81
Free => sprintf (" %2 .2f" ,($self -> {_system }-> {storageTotal } - $self -> {_system }-> {storageUsed })/1024/1024/1024),
82
- pctused => sprintf (" %2 .2f" ,$self -> {_system }-> {storageUsed } / $self -> {_system }-> {storageTotal })
82
+ pctused => sprintf (" %2 .2f" ,$self -> {_system }-> {storageUsed } / $self -> {_system }-> {storageTotal } * 100 )
83
83
);
84
84
return \%stor ;
85
85
}
@@ -88,7 +88,7 @@ sub getStorage
88
88
# parameters: none
89
89
# Return an Engine version
90
90
91
- sub getVersion
91
+ sub getVersion
92
92
{
93
93
my $self = shift ;
94
94
logger($self -> {_debug }, " Entering System_obj::getVersion" ,1);
@@ -135,7 +135,7 @@ sub getvMem {
135
135
# parameters: none
136
136
# Load a list of System objects from Delphix Engine
137
137
138
- sub LoadSystem
138
+ sub LoadSystem
139
139
{
140
140
my $self = shift ;
141
141
logger($self -> {_debug }, " Entering System_obj::LoadSystem" ,1);
@@ -146,7 +146,7 @@ sub LoadSystem
146
146
$self -> {_system } = $result -> {result };
147
147
} else {
148
148
print " No data returned for $operation . Try to increase timeout \n " ;
149
- }
149
+ }
150
150
}
151
151
152
152
# Procedure getDNS
@@ -157,22 +157,22 @@ sub getDNS
157
157
{
158
158
my $self = shift ;
159
159
logger($self -> {_debug }, " Entering System_obj::getDNS" ,1);
160
-
160
+
161
161
if (!defined ($self -> {_dns })) {
162
-
162
+
163
163
my $operation = " resources/json/delphix/service/dns" ;
164
164
my ($result , $result_fmt ) = $self -> {_dlpxObject }-> getJSONResult($operation );
165
-
165
+
166
166
if (defined ($result -> {status }) && ($result -> {status } eq ' OK' )) {
167
167
$self -> {_dns } = $result -> {result };
168
168
} else {
169
169
print " No data returned for $operation . Try to increase timeout \n " ;
170
170
}
171
-
171
+
172
172
}
173
173
174
174
return $self -> {_dns };
175
-
175
+
176
176
}
177
177
178
178
# Procedure getDNSServers
@@ -207,22 +207,22 @@ sub getSNMP
207
207
{
208
208
my $self = shift ;
209
209
logger($self -> {_debug }, " Entering System_obj::getSNMP" ,1);
210
-
210
+
211
211
if (!defined ($self -> {_snmp })) {
212
-
212
+
213
213
my $operation = " resources/json/delphix/service/snmp" ;
214
214
my ($result , $result_fmt ) = $self -> {_dlpxObject }-> getJSONResult($operation );
215
-
215
+
216
216
if (defined ($result -> {status }) && ($result -> {status } eq ' OK' )) {
217
217
$self -> {_snmp } = $result -> {result };
218
218
} else {
219
219
print " No data returned for $operation . Try to increase timeout \n " ;
220
220
}
221
-
221
+
222
222
}
223
223
224
224
return $self -> {_snmp };
225
-
225
+
226
226
}
227
227
228
228
# Procedure getSNMPStatus
@@ -257,21 +257,21 @@ sub getSNMPManager
257
257
{
258
258
my $self = shift ;
259
259
logger($self -> {_debug }, " Entering System_obj::getSNMPManager" ,1);
260
-
260
+
261
261
if (!defined ($self -> {_snmpmanager })) {
262
-
262
+
263
263
my $operation = " resources/json/delphix/service/snmp/manager" ;
264
264
my ($result , $result_fmt ) = $self -> {_dlpxObject }-> getJSONResult($operation );
265
-
265
+
266
266
if (defined ($result -> {status }) && ($result -> {status } eq ' OK' )) {
267
267
$self -> {_snmpmanager } = $result -> {result };
268
268
} else {
269
269
print " No data returned for $operation . Try to increase timeout \n " ;
270
270
}
271
-
271
+
272
272
}
273
273
274
- return $self -> {_snmpmanager };
274
+ return $self -> {_snmpmanager };
275
275
}
276
276
277
277
# Procedure getSNMPStatus
@@ -290,7 +290,7 @@ sub getSNMPServers
290
290
$serhash {communityString } = $seritem -> {communityString };
291
291
push (@retarray , \%serhash );
292
292
}
293
-
293
+
294
294
return \@retarray ;
295
295
}
296
296
@@ -302,22 +302,22 @@ sub getNTP
302
302
{
303
303
my $self = shift ;
304
304
logger($self -> {_debug }, " Entering System_obj::getNTP" ,1);
305
-
305
+
306
306
if (!defined ($self -> {_time })) {
307
-
307
+
308
308
my $operation = " resources/json/delphix/service/time" ;
309
309
my ($result , $result_fmt ) = $self -> {_dlpxObject }-> getJSONResult($operation );
310
-
310
+
311
311
if (defined ($result -> {status }) && ($result -> {status } eq ' OK' )) {
312
312
$self -> {_time } = $result -> {result };
313
313
} else {
314
314
print " No data returned for $operation . Try to increase timeout \n " ;
315
315
}
316
-
316
+
317
317
}
318
318
319
319
return $self -> {_time };
320
-
320
+
321
321
}
322
322
323
323
# Procedure getNTPServer
@@ -352,22 +352,22 @@ sub getSMTP
352
352
{
353
353
my $self = shift ;
354
354
logger($self -> {_debug }, " Entering System_obj::getSMTP" ,1);
355
-
355
+
356
356
if (!defined ($self -> {_smtp })) {
357
-
357
+
358
358
my $operation = " resources/json/delphix/service/smtp" ;
359
359
my ($result , $result_fmt ) = $self -> {_dlpxObject }-> getJSONResult($operation );
360
-
360
+
361
361
if (defined ($result -> {status }) && ($result -> {status } eq ' OK' )) {
362
362
$self -> {_smtp } = $result -> {result };
363
363
} else {
364
364
print " No data returned for $operation . Try to increase timeout \n " ;
365
365
}
366
-
366
+
367
367
}
368
368
369
369
return $self -> {_smtp };
370
-
370
+
371
371
}
372
372
373
373
# Procedure getSMTPServer
@@ -402,22 +402,22 @@ sub getSyslog
402
402
{
403
403
my $self = shift ;
404
404
logger($self -> {_debug }, " Entering System_obj::getSyslog" ,1);
405
-
405
+
406
406
if (!defined ($self -> {_syslog })) {
407
-
407
+
408
408
my $operation = " resources/json/delphix/service/syslog" ;
409
409
my ($result , $result_fmt ) = $self -> {_dlpxObject }-> getJSONResult($operation );
410
-
410
+
411
411
if (defined ($result -> {status }) && ($result -> {status } eq ' OK' )) {
412
412
$self -> {_syslog } = $result -> {result };
413
413
} else {
414
414
print " No data returned for $operation . Try to increase timeout \n " ;
415
415
}
416
-
416
+
417
417
}
418
418
419
419
return $self -> {_syslog };
420
-
420
+
421
421
}
422
422
423
423
# Procedure getSyslogServers
@@ -464,22 +464,22 @@ sub getLDAP
464
464
{
465
465
my $self = shift ;
466
466
logger($self -> {_debug }, " Entering System_obj::getLDAP" ,1);
467
-
467
+
468
468
if (!defined ($self -> {_ldap })) {
469
-
469
+
470
470
my $operation = " resources/json/delphix/service/ldap" ;
471
471
my ($result , $result_fmt ) = $self -> {_dlpxObject }-> getJSONResult($operation );
472
-
472
+
473
473
if (defined ($result -> {status }) && ($result -> {status } eq ' OK' )) {
474
474
$self -> {_ldap } = $result -> {result };
475
475
} else {
476
476
print " No data returned for $operation . Try to increase timeout \n " ;
477
477
}
478
-
478
+
479
479
}
480
480
481
481
return $self -> {_ldap };
482
-
482
+
483
483
}
484
484
485
485
# Procedure getLDAPStatus
@@ -502,22 +502,22 @@ sub getLDAPServerConf
502
502
{
503
503
my $self = shift ;
504
504
logger($self -> {_debug }, " Entering System_obj::getLDAPServerConf" ,1);
505
-
505
+
506
506
if (!defined ($self -> {_ldapserver })) {
507
-
507
+
508
508
my $operation = " resources/json/delphix/service/ldap/server" ;
509
509
my ($result , $result_fmt ) = $self -> {_dlpxObject }-> getJSONResult($operation );
510
-
510
+
511
511
if (defined ($result -> {status }) && ($result -> {status } eq ' OK' )) {
512
512
$self -> {_ldapserver } = $result -> {result };
513
513
} else {
514
514
print " No data returned for $operation . Try to increase timeout \n " ;
515
515
}
516
-
516
+
517
517
}
518
-
518
+
519
519
return $self -> {_ldapserver };
520
-
520
+
521
521
}
522
522
523
523
# Procedure getLDAPServers
@@ -530,19 +530,19 @@ sub getLDAPServers
530
530
logger($self -> {_debug }, " Entering System_obj::getLDAPServers" ,1);
531
531
my $servers = $self -> getLDAPServerConf();
532
532
my @retarray ;
533
- # it's one server for now
533
+ # it's one server for now
534
534
for my $seritem (@{$servers }) {
535
535
my %serhash ;
536
536
$serhash {address } = $seritem -> {host };
537
537
$serhash {port } = $seritem -> {port };
538
538
$serhash {authMethod } = $seritem -> {authMethod };
539
- $serhash {useSSL } = $seritem -> {useSSL };
539
+ $serhash {useSSL } = $seritem -> {useSSL };
540
540
push (@retarray , \%serhash );
541
541
}
542
-
542
+
543
543
return \@retarray ;
544
544
}
545
545
546
546
547
547
548
- 1;
548
+ 1;
0 commit comments