This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push:
new fdd7ffc0bd6 [branch-2.1][Fix](http)Ignore exceptions when getting
system information errors #39671 (#41106)
fdd7ffc0bd6 is described below
commit fdd7ffc0bd6e430fccc907889d27a74ae2864d8d
Author: Calvin Kirs <[email protected]>
AuthorDate: Mon Sep 23 18:35:35 2024 +0800
[branch-2.1][Fix](http)Ignore exceptions when getting system information
errors #39671 (#41106)
bp #39671
---
.../httpv2/controller/HardwareInfoController.java | 351 ++++++++++++---------
1 file changed, 199 insertions(+), 152 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/httpv2/controller/HardwareInfoController.java
b/fe/fe-core/src/main/java/org/apache/doris/httpv2/controller/HardwareInfoController.java
index 08751165481..d751f72f719 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/httpv2/controller/HardwareInfoController.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/httpv2/controller/HardwareInfoController.java
@@ -20,6 +20,8 @@ package org.apache.doris.httpv2.controller;
import org.apache.doris.common.Version;
import org.apache.doris.httpv2.entity.ResponseEntityBuilder;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@@ -51,6 +53,8 @@ import java.util.Map;
@RequestMapping("/rest/v1")
public class HardwareInfoController {
+ private static final Logger LOG =
LogManager.getLogger(HardwareInfoController.class);
+
@RequestMapping(path = "/hardware_info/fe", method = RequestMethod.GET)
public Object index() {
Map<String, Map<String, String>> map = new HashMap<>();
@@ -69,136 +73,163 @@ public class HardwareInfoController {
}
private void appendHardwareInfo(Map<String, Map<String, String>> content) {
- SystemInfo si = new SystemInfo();
- OperatingSystem os = si.getOperatingSystem();
- HardwareAbstractionLayer hal = si.getHardware();
- CentralProcessor processor = hal.getProcessor();
- GlobalMemory memory = hal.getMemory();
Map<String, String> map = new HashMap<>();
- map.put("OS", String.join("<br>", getOperatingSystem(os)));
- map.put("Processor", String.join("<br>", getProcessor(processor)));
- map.put("Memory", String.join("<br>", getMemory(memory)));
- map.put("Processes", String.join("<br>", getProcesses(os, memory)));
- map.put("Disk", String.join("<br>", getDisks(hal.getDiskStores())));
- map.put("FileSystem", String.join("<br>",
getFileSystem(os.getFileSystem())));
- map.put("NetworkInterface", String.join("<br>",
getNetworkInterfaces(hal.getNetworkIFs())));
- map.put("NetworkParameter", String.join("<br>",
getNetworkParameters(os.getNetworkParams())));
+ try {
+ SystemInfo si = new SystemInfo();
+ OperatingSystem os = si.getOperatingSystem();
+ HardwareAbstractionLayer hal = si.getHardware();
+ CentralProcessor processor = hal.getProcessor();
+ GlobalMemory memory = hal.getMemory();
+
+ map.put("OS", String.join("<br>", getOperatingSystem(os)));
+ map.put("Processor", String.join("<br>", getProcessor(processor)));
+ map.put("Memory", String.join("<br>", getMemory(memory)));
+ map.put("Processes", String.join("<br>", getProcesses(os,
memory)));
+ map.put("Disk", String.join("<br>",
getDisks(hal.getDiskStores())));
+ map.put("FileSystem", String.join("<br>",
getFileSystem(os.getFileSystem())));
+ map.put("NetworkInterface", String.join("<br>",
getNetworkInterfaces(hal.getNetworkIFs())));
+ map.put("NetworkParameter", String.join("<br>",
getNetworkParameters(os.getNetworkParams())));
+ } catch (Exception e) {
+ // If we can't get hardware info, we should not throw exception
+ // don't use log.warn
+ LOG.info("Failed to get hardware info", e);
+ }
content.put("HardwareInfo", map);
+
}
private List<String> getOperatingSystem(OperatingSystem os) {
- List<String> osInfo = new ArrayList<>();
- osInfo.add(String.valueOf(os));
- osInfo.add("Booted: " + Instant.ofEpochSecond(os.getSystemBootTime()));
- osInfo.add("Uptime: " +
FormatUtil.formatElapsedSecs(os.getSystemUptime()));
- osInfo.add("Running with" + (os.isElevated() ? "" : "out") + "
elevated permissions.");
- return osInfo;
+ try {
+ List<String> osInfo = new ArrayList<>();
+ osInfo.add(String.valueOf(os));
+ osInfo.add("Booted: " +
Instant.ofEpochSecond(os.getSystemBootTime()));
+ osInfo.add("Uptime: " +
FormatUtil.formatElapsedSecs(os.getSystemUptime()));
+ osInfo.add("Running with" + (os.isElevated() ? "" : "out") + "
elevated permissions.");
+ return osInfo;
+ } catch (Exception e) {
+ LOG.info("Failed to get operating system info", e);
+ }
+ return new ArrayList<>();
}
private List<String> getProcessor(CentralProcessor processor) {
List<String> processorInfo = new ArrayList<>();
- processorInfo.add(String.valueOf(processor));
- processorInfo.add(" " + processor.getPhysicalPackageCount() + "
physical CPU package(s)");
- processorInfo.add(" " + processor.getPhysicalProcessorCount() + "
physical CPU core(s)");
- processorInfo.add(" " + processor.getLogicalProcessorCount() + "
logical CPU(s)");
+ try {
+ processorInfo.add(String.valueOf(processor));
+ processorInfo.add(" " + processor.getPhysicalPackageCount() + "
physical CPU package(s)");
+ processorInfo.add(" " + processor.getPhysicalProcessorCount() + "
physical CPU core(s)");
+ processorInfo.add(" " + processor.getLogicalProcessorCount() + "
logical CPU(s)");
- processorInfo.add("Identifier: " +
processor.getProcessorIdentifier().getIdentifier());
- processorInfo.add("ProcessorID: " +
processor.getProcessorIdentifier().getProcessorID());
- processorInfo.add("Context Switches/Interrupts: " +
processor.getContextSwitches()
- + " / " + processor.getInterrupts() + "<br>");
+ processorInfo.add("Identifier: " +
processor.getProcessorIdentifier().getIdentifier());
+ processorInfo.add("ProcessorID: " +
processor.getProcessorIdentifier().getProcessorID());
+ processorInfo.add("Context Switches/Interrupts: " +
processor.getContextSwitches()
+ + " / " + processor.getInterrupts() + "<br>");
- long[] prevTicks = processor.getSystemCpuLoadTicks();
- long[][] prevProcTicks = processor.getProcessorCpuLoadTicks();
- processorInfo.add("CPU, IOWait, and IRQ ticks @ 0 sec: " +
Arrays.toString(prevTicks));
- // Wait a second...
- Util.sleep(1000);
- long[] ticks = processor.getSystemCpuLoadTicks();
- processorInfo.add("CPU, IOWait, and IRQ ticks @ 1 sec: " +
Arrays.toString(ticks));
- long user = ticks[CentralProcessor.TickType.USER.getIndex()]
- - prevTicks[CentralProcessor.TickType.USER.getIndex()];
- long nice = ticks[CentralProcessor.TickType.NICE.getIndex()]
- - prevTicks[CentralProcessor.TickType.NICE.getIndex()];
- long sys = ticks[CentralProcessor.TickType.SYSTEM.getIndex()]
- - prevTicks[CentralProcessor.TickType.SYSTEM.getIndex()];
- long idle = ticks[CentralProcessor.TickType.IDLE.getIndex()]
- - prevTicks[CentralProcessor.TickType.IDLE.getIndex()];
- long iowait = ticks[CentralProcessor.TickType.IOWAIT.getIndex()]
- - prevTicks[CentralProcessor.TickType.IOWAIT.getIndex()];
- long irq = ticks[CentralProcessor.TickType.IRQ.getIndex()]
- - prevTicks[CentralProcessor.TickType.IRQ.getIndex()];
- long softirq = ticks[CentralProcessor.TickType.SOFTIRQ.getIndex()]
- - prevTicks[CentralProcessor.TickType.SOFTIRQ.getIndex()];
- long steal = ticks[CentralProcessor.TickType.STEAL.getIndex()]
- - prevTicks[CentralProcessor.TickType.STEAL.getIndex()];
- long totalCpu = user + nice + sys + idle + iowait + irq + softirq +
steal;
+ long[] prevTicks = processor.getSystemCpuLoadTicks();
+ long[][] prevProcTicks = processor.getProcessorCpuLoadTicks();
+ processorInfo.add("CPU, IOWait, and IRQ ticks @ 0
sec: " + Arrays.toString(prevTicks));
+ // Wait a second...
+ Util.sleep(1000);
+ long[] ticks = processor.getSystemCpuLoadTicks();
+ processorInfo.add("CPU, IOWait, and IRQ ticks @ 1
sec: " + Arrays.toString(ticks));
+ long user = ticks[CentralProcessor.TickType.USER.getIndex()]
+ - prevTicks[CentralProcessor.TickType.USER.getIndex()];
+ long nice = ticks[CentralProcessor.TickType.NICE.getIndex()]
+ - prevTicks[CentralProcessor.TickType.NICE.getIndex()];
+ long sys = ticks[CentralProcessor.TickType.SYSTEM.getIndex()]
+ - prevTicks[CentralProcessor.TickType.SYSTEM.getIndex()];
+ long idle = ticks[CentralProcessor.TickType.IDLE.getIndex()]
+ - prevTicks[CentralProcessor.TickType.IDLE.getIndex()];
+ long iowait = ticks[CentralProcessor.TickType.IOWAIT.getIndex()]
+ - prevTicks[CentralProcessor.TickType.IOWAIT.getIndex()];
+ long irq = ticks[CentralProcessor.TickType.IRQ.getIndex()]
+ - prevTicks[CentralProcessor.TickType.IRQ.getIndex()];
+ long softirq = ticks[CentralProcessor.TickType.SOFTIRQ.getIndex()]
+ - prevTicks[CentralProcessor.TickType.SOFTIRQ.getIndex()];
+ long steal = ticks[CentralProcessor.TickType.STEAL.getIndex()]
+ - prevTicks[CentralProcessor.TickType.STEAL.getIndex()];
+ long totalCpu = user + nice + sys + idle + iowait + irq + softirq
+ steal;
- processorInfo.add(String.format(
- "User: %.1f%% Nice: %.1f%% System: %.1f%% Idle:"
- + " %.1f%% IOwait: %.1f%% IRQ: %.1f%% SoftIRQ: %.1f%%
Steal: %.1f%%",
- 100d * user / totalCpu, 100d * nice / totalCpu, 100d * sys /
totalCpu, 100d * idle / totalCpu,
- 100d * iowait / totalCpu, 100d * irq / totalCpu, 100d *
softirq / totalCpu, 100d * steal / totalCpu));
- processorInfo.add(String.format("CPU load: %.1f%%",
- processor.getSystemCpuLoadBetweenTicks(prevTicks) * 100));
- double[] loadAverage = processor.getSystemLoadAverage(3);
- processorInfo.add("CPU load averages: "
- + (loadAverage[0] < 0 ? " N/A" : String.format(" %.2f",
loadAverage[0]))
- + (loadAverage[1] < 0 ? " N/A" : String.format(" %.2f",
loadAverage[1]))
- + (loadAverage[2] < 0 ? " N/A" : String.format(" %.2f",
loadAverage[2])));
- // per core CPU
- StringBuilder procCpu = new StringBuilder("CPU load per
processor: ");
- double[] load =
processor.getProcessorCpuLoadBetweenTicks(prevProcTicks);
- for (double avg : load) {
- procCpu.append(String.format(" %.1f%%", avg * 100));
- }
- processorInfo.add(procCpu.toString());
- long freq = processor.getProcessorIdentifier().getVendorFreq();
- if (freq > 0) {
- processorInfo.add("Vendor Frequency: " +
FormatUtil.formatHertz(freq));
- }
- freq = processor.getMaxFreq();
- if (freq > 0) {
- processorInfo.add("Max Frequency: " +
FormatUtil.formatHertz(freq));
- }
- long[] freqs = processor.getCurrentFreq();
- if (freqs[0] > 0) {
- StringBuilder sb = new StringBuilder("Current
Frequencies: ");
- for (int i = 0; i < freqs.length; i++) {
- if (i > 0) {
- sb.append(", ");
+ processorInfo.add(String.format(
+ "User: %.1f%% Nice: %.1f%% System: %.1f%% Idle:"
+ + " %.1f%% IOwait: %.1f%% IRQ: %.1f%% SoftIRQ:
%.1f%% Steal: %.1f%%",
+ 100d * user / totalCpu, 100d * nice / totalCpu, 100d * sys
/ totalCpu, 100d * idle / totalCpu,
+ 100d * iowait / totalCpu, 100d * irq / totalCpu, 100d *
softirq
+ / totalCpu, 100d * steal / totalCpu));
+ processorInfo.add(String.format("CPU load: %.1f%%",
+ processor.getSystemCpuLoadBetweenTicks(prevTicks) * 100));
+ double[] loadAverage = processor.getSystemLoadAverage(3);
+ processorInfo.add("CPU load averages: "
+ + (loadAverage[0] < 0 ? " N/A" : String.format(" %.2f",
loadAverage[0]))
+ + (loadAverage[1] < 0 ? " N/A" : String.format(" %.2f",
loadAverage[1]))
+ + (loadAverage[2] < 0 ? " N/A" : String.format(" %.2f",
loadAverage[2])));
+ // per core CPU
+ StringBuilder procCpu = new StringBuilder("CPU load per
processor: ");
+ double[] load =
processor.getProcessorCpuLoadBetweenTicks(prevProcTicks);
+ for (double avg : load) {
+ procCpu.append(String.format(" %.1f%%", avg * 100));
+ }
+ processorInfo.add(procCpu.toString());
+ long freq = processor.getProcessorIdentifier().getVendorFreq();
+ if (freq > 0) {
+ processorInfo.add("Vendor Frequency: " +
FormatUtil.formatHertz(freq));
+ }
+ freq = processor.getMaxFreq();
+ if (freq > 0) {
+ processorInfo.add("Max Frequency: " +
FormatUtil.formatHertz(freq));
+ }
+ long[] freqs = processor.getCurrentFreq();
+ if (freqs[0] > 0) {
+ StringBuilder sb = new StringBuilder("Current
Frequencies: ");
+ for (int i = 0; i < freqs.length; i++) {
+ if (i > 0) {
+ sb.append(", ");
+ }
+ sb.append(FormatUtil.formatHertz(freqs[i]));
}
- sb.append(FormatUtil.formatHertz(freqs[i]));
+ processorInfo.add(sb.toString());
}
- processorInfo.add(sb.toString());
+ } catch (Exception e) {
+ LOG.info("Failed to get processor info", e);
}
return processorInfo;
}
private List<String> getMemory(GlobalMemory memory) {
List<String> memoryInfo = new ArrayList<>();
- memoryInfo.add("Memory: " +
FormatUtil.formatBytes(memory.getAvailable()) + "/"
- + FormatUtil.formatBytes(memory.getTotal()));
- VirtualMemory vm = memory.getVirtualMemory();
- memoryInfo.add("Swap used: " +
FormatUtil.formatBytes(vm.getSwapUsed()) + "/"
- + FormatUtil.formatBytes(vm.getSwapTotal()));
+ try {
+ memoryInfo.add("Memory: " +
FormatUtil.formatBytes(memory.getAvailable()) + "/"
+ + FormatUtil.formatBytes(memory.getTotal()));
+ VirtualMemory vm = memory.getVirtualMemory();
+ memoryInfo.add("Swap used: " +
FormatUtil.formatBytes(vm.getSwapUsed()) + "/"
+ + FormatUtil.formatBytes(vm.getSwapTotal()));
+ } catch (Exception e) {
+ LOG.info("Failed to get memory info", e);
+ }
return memoryInfo;
}
private List<String> getProcesses(OperatingSystem os, GlobalMemory memory)
{
List<String> processInfo = new ArrayList<>();
- processInfo.add("Processes: " + os.getProcessCount()
- + ", Threads: " + os.getThreadCount());
- // Sort by highest CPU
+ try {
+ processInfo.add("Processes: " + os.getProcessCount()
+ + ", Threads: " + os.getThreadCount());
+ // Sort by highest CPU
- List<OSProcess> procs = os.getProcesses((osProcess) -> true,
ProcessSorting.CPU_DESC, 5);
+ List<OSProcess> procs = os.getProcesses((osProcess) -> true,
ProcessSorting.CPU_DESC, 5);
- processInfo.add(" PID
%CPU %MEM VSZ RSS Name");
- for (int i = 0; i < procs.size() && i < 5; i++) {
- OSProcess p = procs.get(i);
-
processInfo.add(String.format("
%5d %5.1f %4.1f %9s %9s %s",
- p.getProcessID(),
- 100d * (p.getKernelTime() + p.getUserTime()) /
p.getUpTime(),
- 100d * p.getResidentSetSize() / memory.getTotal(),
FormatUtil.formatBytes(p.getVirtualSize()),
- FormatUtil.formatBytes(p.getResidentSetSize()),
p.getName()));
+ processInfo.add("
PID %CPU %MEM VSZ RSS Name");
+ for (int i = 0; i < procs.size() && i < 5; i++) {
+ OSProcess p = procs.get(i);
+
processInfo.add(String.format("
"
+ + "%5d %5.1f %4.1f %9s %9s %s",
+ p.getProcessID(),
+ 100d * (p.getKernelTime() + p.getUserTime()) /
p.getUpTime(),
+ 100d * p.getResidentSetSize() / memory.getTotal(),
FormatUtil.formatBytes(p.getVirtualSize()),
+ FormatUtil.formatBytes(p.getResidentSetSize()),
p.getName()));
+ }
+ } catch (Exception e) {
+ LOG.info("Failed to get process info", e);
}
return processInfo;
}
@@ -229,69 +260,85 @@ public class HardwareInfoController {
private List<String> getFileSystem(FileSystem fileSystem) {
List<String> fsInfo = new ArrayList<>();
- fsInfo.add("File System: ");
+ try {
+ fsInfo.add("File System: ");
- fsInfo.add(String.format(" File Descriptors:
%d/%d", fileSystem.getOpenFileDescriptors(),
- fileSystem.getMaxFileDescriptors()));
+ fsInfo.add(String.format(" File
Descriptors: %d/%d",
+ fileSystem.getOpenFileDescriptors(),
+ fileSystem.getMaxFileDescriptors()));
- List<OSFileStore> fsList = fileSystem.getFileStores();
- for (OSFileStore fs : fsList) {
- long usable = fs.getUsableSpace();
- long total = fs.getTotalSpace();
-
fsInfo.add(String.format(" "
- + "%s (%s) [%s] %s of %s free (%.1f%%), %s of %s
files free (%.1f%%) is %s "
- + (fs.getLogicalVolume() != null &&
!fs.getLogicalVolume().isEmpty() ? "[%s]" : "%s")
- + " and is mounted at %s",
- fs.getName(), fs.getDescription().isEmpty() ? "file
system" : fs.getDescription(), fs.getType(),
- FormatUtil.formatBytes(usable),
FormatUtil.formatBytes(fs.getTotalSpace()), 100d * usable / total,
- FormatUtil.formatValue(fs.getFreeInodes(), ""),
FormatUtil.formatValue(fs.getTotalInodes(), ""),
- 100d * fs.getFreeInodes() / fs.getTotalInodes(),
fs.getVolume(), fs.getLogicalVolume(),
- fs.getMount()));
+ List<OSFileStore> fsList = fileSystem.getFileStores();
+ for (OSFileStore fs : fsList) {
+ long usable = fs.getUsableSpace();
+ long total = fs.getTotalSpace();
+
fsInfo.add(String.format(" "
+ + "%s (%s) [%s] %s of %s free (%.1f%%), %s of
%s files free (%.1f%%) is %s "
+ + (fs.getLogicalVolume() != null &&
!fs.getLogicalVolume().isEmpty() ? "[%s]" : "%s")
+ + " and is mounted at %s",
+ fs.getName(), fs.getDescription().isEmpty() ? "file
system" : fs.getDescription(), fs.getType(),
+ FormatUtil.formatBytes(usable),
FormatUtil.formatBytes(fs.getTotalSpace()),
+ 100d * usable / total,
+ FormatUtil.formatValue(fs.getFreeInodes(), ""),
+ FormatUtil.formatValue(fs.getTotalInodes(), ""),
+ 100d * fs.getFreeInodes() / fs.getTotalInodes(),
fs.getVolume(), fs.getLogicalVolume(),
+ fs.getMount()));
+ }
+ } catch (Exception e) {
+ LOG.info("Failed to get file system info", e);
}
+
return fsInfo;
}
private List<String> getNetworkInterfaces(List<NetworkIF> networkIFs) {
List<String> getNetwork = new ArrayList<>();
- getNetwork.add("Network interfaces: ");
- for (NetworkIF net : networkIFs) {
- getNetwork.add(String.format(" Name: %s
(%s)",
- net.getName(), net.getDisplayName()));
-
getNetwork.add(String.format(" MAC
Address: %s",
- net.getMacaddr()));
-
getNetwork.add(String.format(" MTU:
%s, Speed: %s",
- net.getMTU(), FormatUtil.formatValue(net.getSpeed(),
"bps")));
-
getNetwork.add(String.format(" IPv4:
%s",
- Arrays.toString(net.getIPv4addr())));
-
getNetwork.add(String.format(" IPv6:
%s",
- Arrays.toString(net.getIPv6addr())));
- boolean hasData = net.getBytesRecv() > 0 || net.getBytesSent() > 0
|| net.getPacketsRecv() > 0
- || net.getPacketsSent() > 0;
-
getNetwork.add(String.format(" Traffic:"
- + " received %s/%s%s; transmitted %s/%s%s",
- hasData ? net.getPacketsRecv() + " packets" : "?",
- hasData ? FormatUtil.formatBytes(net.getBytesRecv()) : "?",
- hasData ? " (" + net.getInErrors() + " err)" : "",
- hasData ? net.getPacketsSent() + " packets" : "?",
- hasData ? FormatUtil.formatBytes(net.getBytesSent()) : "?",
- hasData ? " (" + net.getOutErrors() + " err)" : ""));
+ try {
+ getNetwork.add("Network interfaces: ");
+ for (NetworkIF net : networkIFs) {
+ getNetwork.add(String.format(" Name: %s
(%s)",
+ net.getName(), net.getDisplayName()));
+
getNetwork.add(String.format(" MAC
Address: %s",
+ net.getMacaddr()));
+
getNetwork.add(String.format(" MTU:
%s, Speed: %s",
+ net.getMTU(), FormatUtil.formatValue(net.getSpeed(),
"bps")));
+
getNetwork.add(String.format(" IPv4:
%s",
+ Arrays.toString(net.getIPv4addr())));
+
getNetwork.add(String.format(" IPv6:
%s",
+ Arrays.toString(net.getIPv6addr())));
+ boolean hasData = net.getBytesRecv() > 0 || net.getBytesSent()
> 0 || net.getPacketsRecv() > 0
+ || net.getPacketsSent() > 0;
+
getNetwork.add(String.format(" Traffic:"
+ + " received %s/%s%s; transmitted %s/%s%s",
+ hasData ? net.getPacketsRecv() + " packets" : "?",
+ hasData ? FormatUtil.formatBytes(net.getBytesRecv()) :
"?",
+ hasData ? " (" + net.getInErrors() + " err)" : "",
+ hasData ? net.getPacketsSent() + " packets" : "?",
+ hasData ? FormatUtil.formatBytes(net.getBytesSent()) :
"?",
+ hasData ? " (" + net.getOutErrors() + " err)" : ""));
+ }
+ } catch (Exception e) {
+ LOG.info("Failed to get network info", e);
}
return getNetwork;
}
private List<String> getNetworkParameters(NetworkParams networkParams) {
List<String> networkParameterInfo = new ArrayList<>();
- networkParameterInfo.add("Network
parameters: ");
-
networkParameterInfo.add(String.format(" Host
name: %s",
- networkParams.getHostName()));
-
networkParameterInfo.add(String.format("
Domain name: %s",
- networkParams.getDomainName()));
-
networkParameterInfo.add(String.format("
DNS servers: %s",
- Arrays.toString(networkParams.getDnsServers())));
-
networkParameterInfo.add(String.format("
IPv4 Gateway: %s",
- networkParams.getIpv4DefaultGateway()));
-
networkParameterInfo.add(String.format("
IPv6 Gateway: %s",
- networkParams.getIpv6DefaultGateway()));
+ try {
+ networkParameterInfo.add("Network
parameters: ");
+
networkParameterInfo.add(String.format(" Host
name: %s",
+ networkParams.getHostName()));
+
networkParameterInfo.add(String.format("
Domain name: %s",
+ networkParams.getDomainName()));
+
networkParameterInfo.add(String.format("
DNS servers: %s",
+ Arrays.toString(networkParams.getDnsServers())));
+
networkParameterInfo.add(String.format("
IPv4 Gateway: %s",
+ networkParams.getIpv4DefaultGateway()));
+
networkParameterInfo.add(String.format("
IPv6 Gateway: %s",
+ networkParams.getIpv6DefaultGateway()));
+ } catch (Exception e) {
+ LOG.info("Failed to get network parameters info", e);
+ }
return networkParameterInfo;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]