public void execute()

in src/main/java/co/elastic/support/diagnostics/commands/RetrieveSystemDigest.java [35:89]


    public void execute(DiagnosticContext context) {
        try {
            SystemInfo si = new SystemInfo();
            File sysFileJson = new File(context.tempDir + SystemProperties.fileSeparator + "system-digest.json");

            try (
                    OutputStream outputStreamJson = new FileOutputStream(sysFileJson);
                    BufferedWriter jsonWriter = new BufferedWriter(new OutputStreamWriter(outputStreamJson));) {
                jsonWriter.write(si.toPrettyJSON());
            } catch (Exception | Error e) {
                logger.info("Failed saving [system-digest.json] file.", e);
            }

            File sysFile = new File(context.tempDir + SystemProperties.fileSeparator + "system-digest.txt");

            try (
                    OutputStream outputStream = new FileOutputStream(sysFile);
                    BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(outputStream));) {
                HardwareAbstractionLayer hal = si.getHardware();
                OperatingSystem os = si.getOperatingSystem();

                printComputerSystem(writer, hal.getComputerSystem());
                writer.newLine();

                printProcessor(writer, hal.getProcessor());
                writer.newLine();

                printMemory(writer, hal.getMemory());
                writer.newLine();

                printCpu(writer, hal.getProcessor());
                writer.newLine();

                printProcesses(writer, os, hal.getMemory());
                writer.newLine();

                printDisks(writer, hal.getDiskStores());
                writer.newLine();

                printFileSystem(writer, os.getFileSystem());
                writer.newLine();

                printNetworkInterfaces(writer, hal.getNetworkIFs());
                writer.newLine();

                printNetworkParameters(writer, os.getNetworkParams());
                writer.newLine();
            }

            logger.info("Finished querying SysInfo.");
        } catch (final Exception | Error e) {
            logger.info("Failed saving system-digest.txt file.", e);
        }

    }