...
|
...
|
@@ -41,7 +41,7 @@ public class ZabbixTask implements Callable { |
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public Object call() throws Exception {
|
|
|
public Object call() {
|
|
|
List<String> HostIps = new ArrayList<>();
|
|
|
|
|
|
Map<String, String> hostIptoIds = new HashMap<>();
|
...
|
...
|
@@ -49,20 +49,27 @@ public class ZabbixTask implements Callable { |
|
|
if (queryHostByType(HostIps, hostIptoIds)) {
|
|
|
return null;
|
|
|
}
|
|
|
//根据ip找到hostid
|
|
|
queryHostIdByIp(HostIps, hostIptoIds);
|
|
|
try {
|
|
|
//根据ip找到hostid
|
|
|
queryHostIdByIp(HostIps, hostIptoIds);
|
|
|
|
|
|
//根据hostid找到items
|
|
|
Map<String, List<ItemResponse.Item>> hostIdtoItems = new HashMap<>();
|
|
|
|
|
|
queryItemByHostId(HostIps, hostIptoIds, hostIdtoItems);
|
|
|
|
|
|
//根据hostid找到items
|
|
|
Map<String, List<ItemResponse.Item>> hostIdtoItems = new HashMap<>();
|
|
|
//根据 hostid itemid 取值
|
|
|
Map<String, List<HistoryResponse.HistoryItem>> historyItemMap = new HashMap<>();
|
|
|
|
|
|
queryItemByHostId(HostIps, hostIptoIds, hostIdtoItems);
|
|
|
queryHistory(hostIdtoItems, historyItemMap);
|
|
|
|
|
|
//根据 hostid itemid 取值
|
|
|
Map<String, List<HistoryResponse.HistoryItem>> historyItemMap = new HashMap<>();
|
|
|
buildBatchPoints(hostIptoIds, hostIdtoItems, historyItemMap);
|
|
|
|
|
|
queryHistory(hostIdtoItems, historyItemMap);
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
DEBUG.error("Failed to execute zabbix task...error {}", e);
|
|
|
}
|
|
|
|
|
|
buildBatchPoints(hostIptoIds, hostIdtoItems, historyItemMap);
|
|
|
|
|
|
return null;
|
|
|
}
|
...
|
...
|
@@ -178,8 +185,7 @@ public class ZabbixTask implements Callable { |
|
|
for (Map.Entry<String, String> entry : hostIpToIds.entrySet()) {
|
|
|
|
|
|
//zabbix中未找到hostid
|
|
|
if(StringUtils.isBlank(entry.getValue()))
|
|
|
{
|
|
|
if (StringUtils.isBlank(entry.getValue())) {
|
|
|
continue;
|
|
|
}
|
|
|
for (String key : keys) {
|
...
|
...
|
|