diff --git a/application/src/main/java/org/thingsboard/server/service/system/DefaultSystemInfoService.java b/application/src/main/java/org/thingsboard/server/service/system/DefaultSystemInfoService.java index 0c0f74a199..41d2f6cdbf 100644 --- a/application/src/main/java/org/thingsboard/server/service/system/DefaultSystemInfoService.java +++ b/application/src/main/java/org/thingsboard/server/service/system/DefaultSystemInfoService.java @@ -111,12 +111,22 @@ public class DefaultSystemInfoService implements SystemInfoService { return systemInfo; } - private void saveCurrentSystemInfo() { + protected void saveCurrentSystemInfo() { long ts = System.currentTimeMillis(); List tsList = new ArrayList<>(); - tsList.add(new BasicTsKvEntry(ts, new LongDataEntry("memoryUsage", getMemoryUsage()))); - tsList.add(new BasicTsKvEntry(ts, new DoubleDataEntry("cpuUsage", getCpuUsage()))); - tsList.add(new BasicTsKvEntry(ts, new LongDataEntry("freeDiscSpace", getFreeDiscSpace()))); + + Long memoryUsage = getMemoryUsage(); + if (memoryUsage != null) { + tsList.add(new BasicTsKvEntry(ts, new LongDataEntry("memoryUsage", memoryUsage))); + } + Double cpuUsage = getCpuUsage(); + if (cpuUsage != null) { + tsList.add(new BasicTsKvEntry(ts, new DoubleDataEntry("cpuUsage", cpuUsage))); + } + Long freeDiscSpace = getFreeDiscSpace(); + if (freeDiscSpace != null) { + tsList.add(new BasicTsKvEntry(ts, new LongDataEntry("freeDiscSpace", freeDiscSpace))); + } telemetryService.saveAndNotifyInternal(TenantId.SYS_TENANT_ID, TenantId.SYS_TENANT_ID, tsList, CALLBACK); }