...
|
...
|
@@ -23,10 +23,17 @@ public class PointBuilder { |
|
|
|
|
|
public static Point buildCpuPoint(String type, String ip, List<ItemResponse.Item> items, List<HistoryResponse.HistoryItem> historyItems) {
|
|
|
Random random = new Random();
|
|
|
String net = "aws";
|
|
|
|
|
|
if (StringUtils.startsWith(ip, "10")) {
|
|
|
|
|
|
net = "qcloud";
|
|
|
}
|
|
|
|
|
|
Point point = Point.measurement(Constants.CPU_MEASUREMENTS)
|
|
|
.tag("type", type)
|
|
|
.tag("ip", ip)
|
|
|
.tag("net", net)
|
|
|
.addField(SystemCpuEnum.CPU_LOAD_AVG1.name(), findValueByKey(SystemCpuEnum.CPU_LOAD_AVG1.key(), items, historyItems))
|
|
|
.addField(SystemCpuEnum.CPU_LOAD_AVG5.name(), findValueByKey(SystemCpuEnum.CPU_LOAD_AVG5.key(), items, historyItems))
|
|
|
.addField(SystemCpuEnum.CPU_LOAD_AVG15.name(), findValueByKey(SystemCpuEnum.CPU_LOAD_AVG15.key(), items, historyItems))
|
...
|
...
|
@@ -45,10 +52,16 @@ public class PointBuilder { |
|
|
|
|
|
public static Point buildMemPoint(String type, String ip, List<ItemResponse.Item> items, List<HistoryResponse.HistoryItem> historyItems) {
|
|
|
Random random = new Random();
|
|
|
String net = "aws";
|
|
|
|
|
|
if (StringUtils.startsWith(ip, "10")) {
|
|
|
|
|
|
net = "qcloud";
|
|
|
}
|
|
|
Point point = Point.measurement(Constants.MEM_MEASUREMENTS)
|
|
|
.tag("type", type)
|
|
|
.tag("ip", ip)
|
|
|
.tag("net", net)
|
|
|
.addField(VmMemoryEnum.MEMORY_SIZE_AVAILABLE.name(), findValueByKey(VmMemoryEnum.MEMORY_SIZE_AVAILABLE.key(), items, historyItems))
|
|
|
.addField(VmMemoryEnum.MEMORY_SIZE_TOTAL.name(), findValueByKey(VmMemoryEnum.MEMORY_SIZE_TOTAL.key(), items, historyItems))
|
|
|
.time(System.currentTimeMillis() * 1000000 + random.nextInt(999999), TimeUnit.NANOSECONDS)
|
...
|
...
|
@@ -58,10 +71,16 @@ public class PointBuilder { |
|
|
|
|
|
public static Point buildNetPoint(String type, String ip, List<ItemResponse.Item> items, List<HistoryResponse.HistoryItem> historyItems) {
|
|
|
Random random = new Random();
|
|
|
String net = "aws";
|
|
|
|
|
|
if (StringUtils.startsWith(ip, "10")) {
|
|
|
|
|
|
net = "qcloud";
|
|
|
}
|
|
|
Point point = Point.measurement(Constants.NET_MEASUREMENTS)
|
|
|
.tag("type", type)
|
|
|
.tag("ip", ip)
|
|
|
.tag("net", net)
|
|
|
.addField(NetIfEnum.NET_IF_IN.name(), findValueByKey(NetIfEnum.NET_IF_IN.key(), items, historyItems))
|
|
|
.addField(NetIfEnum.NET_IF_OUT.name(), findValueByKey(NetIfEnum.NET_IF_OUT.key(), items, historyItems))
|
|
|
.time(System.currentTimeMillis() * 1000000 + random.nextInt(999999), TimeUnit.NANOSECONDS)
|
...
|
...
|
|