Browse Source

saveCUrrentSystemInfo improvements

pull/8212/head
YevhenBondarenko 4 years ago
parent
commit
d13a458eb0
  1. 18
      application/src/main/java/org/thingsboard/server/service/system/DefaultSystemInfoService.java

18
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<TsKvEntry> 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);
}

Loading…
Cancel
Save