@opscompass/opscompass-cli 1.3.2 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/dataGathering/events.js +146 -0
- package/lib/dataGathering/moduleDiscovery.js +62 -0
- package/lib/dataGathering/olmDataParms.js +140 -0
- package/lib/dataGathering/sendDg.js +971 -0
- package/lib/dataGathering/setupWizard.js +826 -0
- package/lib/dataGathering/ui.js +83 -0
- package/lib/dataGathering/validateInstall.js +210 -0
- package/lib/homeInteraction.js +84 -19
- package/lib/maskValues.js +305 -71
- package/lib/pgpTools.js +156 -92
- package/lib/utils.js +122 -39
- package/modules/data-gathering-scripts.js +6 -35
- package/modules/data-gathering.js +732 -0
- package/modules/defaults.js +68 -15
- package/modules/license-manager/importMonitoringConfiguration.js +369 -0
- package/modules/license-manager/microsoft.js +11 -4
- package/modules/license-manager/nutanix.js +10 -4
- package/modules/license-manager/resolveMonitoringConfigId.js +28 -0
- package/modules/license-manager/vcenter.js +10 -4
- package/modules/license-manager.js +89 -9
- package/modules.js +2 -0
- package/package.json +34 -6
- package/updates.js +409 -57
- package/environment/demo.js +0 -30
- package/environment/dev.js +0 -30
- package/environment/local.js +0 -31
- package/environment/production.js +0 -30
|
@@ -58,6 +58,11 @@ import {
|
|
|
58
58
|
updateNutanixConfiguration,
|
|
59
59
|
updateNutanixConfigurations,
|
|
60
60
|
} from "./license-manager/nutanix.js";
|
|
61
|
+
import {
|
|
62
|
+
importMonitoringConfiguration,
|
|
63
|
+
printImportMonitoringConfigurationHelp,
|
|
64
|
+
} from "./license-manager/importMonitoringConfiguration.js";
|
|
65
|
+
import resolveMonitoringConfigId from "./license-manager/resolveMonitoringConfigId.js";
|
|
61
66
|
|
|
62
67
|
/**
|
|
63
68
|
* @module license-manager
|
|
@@ -200,11 +205,17 @@ async function deleteOracleDatabaseConfiguration(args) {
|
|
|
200
205
|
}
|
|
201
206
|
|
|
202
207
|
async function listOracleDatabaseConfigurations(args) {
|
|
208
|
+
const resolved = resolveMonitoringConfigId(args);
|
|
209
|
+
if (resolved === undefined || resolved === null || resolved === "") {
|
|
210
|
+
console.error(
|
|
211
|
+
"ERROR: Monitoring configuration is not set. Use --monitoring-configuration-id <id> or configure a default.",
|
|
212
|
+
);
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
|
|
203
216
|
const client = await getOpsCompassClient();
|
|
204
217
|
const monitoringConfigs =
|
|
205
|
-
await client.licenseManager.listOracleDatabaseConfigurations(
|
|
206
|
-
global.monitoringConfig,
|
|
207
|
-
);
|
|
218
|
+
await client.licenseManager.listOracleDatabaseConfigurations(resolved);
|
|
208
219
|
|
|
209
220
|
console.log(JSON.stringify(monitoringConfigs, null, 2));
|
|
210
221
|
}
|
|
@@ -266,11 +277,15 @@ async function getNetworkDiscoveryConfiguration(args) {
|
|
|
266
277
|
}
|
|
267
278
|
|
|
268
279
|
async function getMonitoringConfiguration(args) {
|
|
280
|
+
let output = console;
|
|
269
281
|
let optionalParams = { asFile: undefined };
|
|
270
282
|
let configId = global.monitoringConfig;
|
|
271
283
|
let saveFile = false;
|
|
272
284
|
for (let i = 0; i < args.length - 1; i++) {
|
|
273
285
|
switch (args[i].toLowerCase()) {
|
|
286
|
+
case "--output-mode":
|
|
287
|
+
output = args[++i] === "silent" ? { log() {}, error() {}, warn() {} } : console;
|
|
288
|
+
break;
|
|
274
289
|
case "--id":
|
|
275
290
|
configId = args[++i];
|
|
276
291
|
break;
|
|
@@ -294,7 +309,7 @@ async function getMonitoringConfiguration(args) {
|
|
|
294
309
|
optionalParams,
|
|
295
310
|
);
|
|
296
311
|
if (!monitoringConfiguration) {
|
|
297
|
-
|
|
312
|
+
output.error("No configuration found for ID: ", configId);
|
|
298
313
|
return;
|
|
299
314
|
}
|
|
300
315
|
|
|
@@ -308,15 +323,74 @@ async function getMonitoringConfiguration(args) {
|
|
|
308
323
|
}
|
|
309
324
|
|
|
310
325
|
if (saveFile) {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
326
|
+
const savedConfiguration = await utils.writeConfigFile(
|
|
327
|
+
args,
|
|
328
|
+
monitoringConfiguration,
|
|
329
|
+
);
|
|
330
|
+
if (!savedConfiguration) {
|
|
331
|
+
output.error("\n\nFailed to save the configuration file.\n");
|
|
332
|
+
output.log(JSON.stringify(monitoringConfiguration, null, 2));
|
|
314
333
|
} else {
|
|
315
|
-
|
|
334
|
+
output.log(savedConfiguration.filePath);
|
|
316
335
|
}
|
|
317
336
|
} else {
|
|
318
|
-
|
|
337
|
+
output.log(JSON.stringify(monitoringConfiguration, null, 2));
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
return monitoringConfiguration;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
async function materializeMonitoringConfiguration(options) {
|
|
344
|
+
const {
|
|
345
|
+
configId,
|
|
346
|
+
saveFile,
|
|
347
|
+
silent = false,
|
|
348
|
+
overwrite = false,
|
|
349
|
+
output,
|
|
350
|
+
} = options;
|
|
351
|
+
const reporter = output || (silent ? { log() {}, error() {}, warn() {} } : console);
|
|
352
|
+
const client = await getOpsCompassClient();
|
|
353
|
+
const monitoringConfiguration =
|
|
354
|
+
await client.licenseManager.getMonitoringConfiguration(
|
|
355
|
+
configId,
|
|
356
|
+
{ asFile: true },
|
|
357
|
+
);
|
|
358
|
+
|
|
359
|
+
if (!monitoringConfiguration) {
|
|
360
|
+
reporter.error("No configuration found for ID: ", configId);
|
|
361
|
+
return undefined;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
await maskValues.unmaskObjValues(monitoringConfiguration);
|
|
365
|
+
|
|
366
|
+
if (!saveFile) {
|
|
367
|
+
return monitoringConfiguration;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
const normalizedSaveFile = saveFile === true ? "true" : saveFile;
|
|
371
|
+
const writeArgs = ["--save-file", normalizedSaveFile];
|
|
372
|
+
if (overwrite) {
|
|
373
|
+
writeArgs.push("--overwrite");
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
const savedConfiguration = await utils.writeConfigFile(
|
|
377
|
+
writeArgs,
|
|
378
|
+
monitoringConfiguration,
|
|
379
|
+
overwrite,
|
|
380
|
+
reporter,
|
|
381
|
+
);
|
|
382
|
+
if (!savedConfiguration) {
|
|
383
|
+
reporter.error("\n\nFailed to save the configuration file.\n");
|
|
384
|
+
if (!silent) {
|
|
385
|
+
reporter.log(JSON.stringify(monitoringConfiguration, null, 2));
|
|
386
|
+
}
|
|
387
|
+
return undefined;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
if (!silent) {
|
|
391
|
+
reporter.log(savedConfiguration.filePath);
|
|
319
392
|
}
|
|
393
|
+
return savedConfiguration;
|
|
320
394
|
}
|
|
321
395
|
|
|
322
396
|
async function readMonitoringConfiguration(args) {
|
|
@@ -844,6 +918,8 @@ async function printHelp() {
|
|
|
844
918
|
console.log("--id [monitoring_configuration_id]");
|
|
845
919
|
console.log("--list-details - return the file metadata");
|
|
846
920
|
console.log();
|
|
921
|
+
printImportMonitoringConfigurationHelp(global.company);
|
|
922
|
+
console.log();
|
|
847
923
|
console.log(
|
|
848
924
|
"get-network-discovery-configuration",
|
|
849
925
|
"Get a single network discovery configuration.",
|
|
@@ -1097,6 +1173,9 @@ const licenseManagerModule = (action, ...args) => {
|
|
|
1097
1173
|
return readMonitoringConfiguration(args);
|
|
1098
1174
|
case "create-monitoring-configuration":
|
|
1099
1175
|
return createMonitoringConfiguration(args);
|
|
1176
|
+
case "import-monitoring-configuration":
|
|
1177
|
+
case "import-monitoring-configuration-file":
|
|
1178
|
+
return importMonitoringConfiguration(args, { materializeMonitoringConfiguration });
|
|
1100
1179
|
case "list-msql-configurations":
|
|
1101
1180
|
case "list-mssql-configurations":
|
|
1102
1181
|
return listMssqlConfigurations(args);
|
|
@@ -1186,4 +1265,5 @@ licenseManagerModule.requiresLogin = true;
|
|
|
1186
1265
|
licenseManagerModule.description =
|
|
1187
1266
|
"Provides access to details about License Management in OpsCompass.";
|
|
1188
1267
|
|
|
1268
|
+
export { materializeMonitoringConfiguration };
|
|
1189
1269
|
export default licenseManagerModule;
|
package/modules.js
CHANGED
|
@@ -4,6 +4,7 @@ import licenseManager from "./modules/license-manager.js";
|
|
|
4
4
|
import compliance from "./modules/compliance.js";
|
|
5
5
|
import expirationInfo from "./modules/expiration-info.js";
|
|
6
6
|
import defaults from "./modules/defaults.js";
|
|
7
|
+
import dataGathering from "./modules/data-gathering.js";
|
|
7
8
|
|
|
8
9
|
// Dynaimcally loaded modules - may be optional
|
|
9
10
|
import fs from "fs";
|
|
@@ -42,6 +43,7 @@ export default {
|
|
|
42
43
|
accounts,
|
|
43
44
|
compliance,
|
|
44
45
|
defaults,
|
|
46
|
+
"data-gathering": dataGathering,
|
|
45
47
|
"license-manager": licenseManager,
|
|
46
48
|
"expiration-info": expirationInfo,
|
|
47
49
|
"data-gathering-scripts": dataGatheringScripts,
|
package/package.json
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opscompass/opscompass-cli",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "Calls OpsCompass's APIs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"
|
|
8
|
+
"ensure-current-environment": "node ./scripts/ensure-current-environment.mjs",
|
|
9
|
+
"check:publish-environment": "node ./scripts/check-publish-environment.mjs",
|
|
10
|
+
"check:pack-contents": "node ./scripts/check-pack-contents.mjs",
|
|
11
|
+
"check:restricted-apis": "node ./scripts/check-restricted-apis.mjs",
|
|
12
|
+
"test": "npm run ensure-current-environment && npm run check:restricted-apis && node --experimental-vm-modules ./node_modules/jest/bin/jest.js --config ./jest.config.js --runInBand",
|
|
13
|
+
"pack:check": "npm run ensure-current-environment && npm run check:pack-contents",
|
|
9
14
|
"build": "cd ../api;npx tsc; cd -"
|
|
10
15
|
},
|
|
11
16
|
"publishConfig": {
|
|
@@ -16,18 +21,41 @@
|
|
|
16
21
|
],
|
|
17
22
|
"author": "opscompass",
|
|
18
23
|
"license": "SEE LICENSE IN license.txt",
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=22 <23 || >=24 <25"
|
|
26
|
+
},
|
|
19
27
|
"dependencies": {
|
|
20
|
-
"@opscompass/opscompass-api": "^1.3.
|
|
28
|
+
"@opscompass/opscompass-api": "^1.3.2",
|
|
21
29
|
"adm-zip": "^0.5.16",
|
|
22
30
|
"axios": "^0.28.1",
|
|
23
|
-
"better-sqlite3": "
|
|
31
|
+
"better-sqlite3": "12.6.2",
|
|
24
32
|
"find-remove": "^5.0.0",
|
|
25
33
|
"fs-extra": "^10.1.0",
|
|
26
34
|
"https-proxy-agent": "^5.0.1",
|
|
27
35
|
"open": "^8.2.1",
|
|
28
|
-
"openpgp": "
|
|
29
|
-
"semver": "^7.3.7"
|
|
36
|
+
"openpgp": "6.2.2",
|
|
37
|
+
"semver": "^7.3.7",
|
|
38
|
+
"tar": "^6.1.11"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"jest": "^29.7.0"
|
|
30
42
|
},
|
|
43
|
+
"files": [
|
|
44
|
+
"index.js",
|
|
45
|
+
"colors.js",
|
|
46
|
+
"credentials.js",
|
|
47
|
+
"error.js",
|
|
48
|
+
"login.js",
|
|
49
|
+
"modules.js",
|
|
50
|
+
"oauth.js",
|
|
51
|
+
"opscompass.js",
|
|
52
|
+
"updates.js",
|
|
53
|
+
"environment/current.js",
|
|
54
|
+
"lib/",
|
|
55
|
+
"modules/",
|
|
56
|
+
"license.txt",
|
|
57
|
+
"README.md"
|
|
58
|
+
],
|
|
31
59
|
"bin": {
|
|
32
60
|
"opscompass": "index.js"
|
|
33
61
|
}
|