47
47
' format=s' => \(my $format ),
48
48
' group=s' => \(my $group ),
49
49
' host=s' => \(my $host ),
50
+ ' license' => \(my $license ),
50
51
' envname=s' => \(my $envname ),
51
52
' debug:i' => \(my $debug ),
52
53
' dever=s' => \(my $dever ),
76
77
77
78
my $output = new Formater();
78
79
79
-
80
- $output -> addHeader(
81
- {' Appliance' , 10},
82
- {' Env name' , 20},
83
- {' Group' , 15},
84
- {' Database' , 30},
85
- {' Size [GB]' , 30},
86
- {" Status" , 30},
87
- {" Enabled" , 30}
88
- );
80
+ if ($license ) {
81
+ $output -> addHeader(
82
+ {' Appliance' , 10},
83
+ {' Type' , 40},
84
+ {' Database' , 40},
85
+ {' Size [GB]' , 30}
86
+ );
87
+ } else {
88
+ $output -> addHeader(
89
+ {' Appliance' , 10},
90
+ {' Env name' , 20},
91
+ {' Group' , 15},
92
+ {' Database' , 30},
93
+ {' Size [GB]' , 30},
94
+ {" Status" , 30},
95
+ {" Enabled" , 30}
96
+ );
97
+ }
89
98
90
99
91
100
my $ret = 0;
92
101
102
+ print " # Delphix can automatically calculate the usage for Oracle, SQL Server and ASE databases for each Delphix Engine.\n " ;
103
+ print " # For other databases, and before the source is connected to the Delphix Engine\n " ;
104
+ print " # you will need to run a query on the source system for the relevant data.\n " ;
105
+
93
106
for my $engine ( sort (@{$engine_list }) ) {
94
107
# main loop for all work
95
108
if ($engine_obj -> dlpx_connect($engine )) {
98
111
next ;
99
112
};
100
113
101
- # load objects for current engine
102
- my $databases = new Databases( $engine_obj , $debug );
103
- my $groups = new Group_obj($engine_obj , $debug );
114
+ if ($license ) {
115
+ # use licence API
116
+ if (version-> parse($engine_obj -> getApi()) >= version-> parse(1.10.3)) {
117
+ my $lic = $engine_obj -> getLicenseUsage();
118
+ if (defined ($lic -> {" databases" })) {
119
+ for my $db ( @{$lic -> {" databases" }}) {
120
+ $output -> addLine(
121
+ $engine ,
122
+ $db -> {" type" },
123
+ $db -> {" name" },
124
+ sprintf (" %10.2f" , $db -> {" size" }/1024/1024/1024)
125
+ )
126
+ }
127
+ }
128
+ } else {
129
+ print " There is no license API. Results returned by non license API as using method described in CLI method in the Delphix Pricing Guide.\n " ;
130
+ print " For details please contact your Delphix account manager\n " ;
131
+ exit (1);
132
+ }
133
+
134
+ } else {
135
+
136
+ # load objects for current engine
137
+ my $databases = new Databases( $engine_obj , $debug );
138
+ my $groups = new Group_obj($engine_obj , $debug );
139
+
140
+ # filter implementation
141
+
142
+ my $db_list = Toolkit_helpers::get_dblist_from_filter(' dSource' , $group , $host , $dbname , $databases , $groups , $envname , undef , undef , undef , undef , undef , $debug );
143
+ if (! defined ($db_list )) {
144
+ print " There is no DB selected to process on $engine . Please check filter definitions. \n " ;
145
+ $ret = $ret + 1;
146
+ next ;
147
+ }
148
+
149
+ # for filtered databases on current engine - display status
150
+ for my $dbitem ( @{$db_list } ) {
151
+ my $dbobj = $databases -> getDB($dbitem );
152
+
153
+ $output -> addLine(
154
+ $engine ,
155
+ $dbobj -> getEnvironmentName(),
156
+ $groups -> getName($dbobj -> getGroup()),
157
+ $dbobj -> getName(),
158
+ $dbobj -> getRuntimeSize(),
159
+ $dbobj -> getRuntimeStatus(),
160
+ $dbobj -> getEnabled()
161
+ );
162
+
163
+
164
+ }
104
165
105
- # filter implementation
106
-
107
- my $db_list = Toolkit_helpers::get_dblist_from_filter(' dSource' , $group , $host , $dbname , $databases , $groups , $envname , undef , undef , undef , undef , undef , $debug );
108
- if (! defined ($db_list )) {
109
- print " There is no DB selected to process on $engine . Please check filter definitions. \n " ;
110
- $ret = $ret + 1;
111
- next ;
112
166
}
113
167
114
- # for filtered databases on current engine - display status
115
- for my $dbitem ( @{$db_list } ) {
116
- my $dbobj = $databases -> getDB($dbitem );
117
-
118
- $output -> addLine(
119
- $engine ,
120
- $dbobj -> getEnvironmentName(),
121
- $groups -> getName($dbobj -> getGroup()),
122
- $dbobj -> getName(),
123
- $dbobj -> getRuntimeSize(),
124
- $dbobj -> getRuntimeStatus(),
125
- $dbobj -> getEnabled()
126
- );
127
168
128
169
129
- }
130
-
131
170
}
132
171
133
172
Toolkit_helpers::print_output($output , $format , $nohead );
@@ -146,7 +185,12 @@ =head1 SYNOPSIS
146
185
147
186
=head1 DESCRIPTION
148
187
149
- Get the information about dSource sizes for ingestion model reporting.
188
+ Get the information about dSource sizes. If you want to use those data for ingestion model reporting
189
+ please use -license option of the script.
190
+
191
+ Delphix can automatically calculate the usage for Oracle, SQL Server and ASE databases for each Delphix Engine.
192
+ For other databases, and before the source is connected to the Delphix Engine,
193
+ you will need to run a query on the source system for the relevant data.
150
194
151
195
=head1 ARGUMENTS
152
196
0 commit comments