use of com.integrien.alive.common.adapter3.ResourceKey in project Server_Management_Plugin_vRealize by Huawei.
the class ESightAdapter method setMezz.
private List<ResourceKey> setMezz(String host, List<ResourceKey> allResourceList, ServerDeviceBean deviceBean, ServerDeviceDetailBean device) {
List<ResourceKey> deviceChildKeys = new ArrayList<>();
List<MezzBean> mezzBeans = device.getMezz();
if (!mezzBeans.isEmpty()) {
List<ResourceKey> mezzResourceKey = new ArrayList<>();
List<String> childHealthList = new ArrayList<>();
for (MezzBean bean : mezzBeans) {
ResourceKey key = bean.convert2Resource(host + deviceBean.getDn(), getAdapterKind(), metricsByResource);
mezzResourceKey.add(key);
allResourceList.add(key);
childHealthList.add(ConvertUtils.convertHealthState(bean.getMezzHealthStatus()));
}
// Mezz Group
ResourceKey mezzGroup = device.createGroupKey(Constant.TREE_MEZZ_GROUP, Constant.KIND_MEZZ_GROUP, mezzResourceKey, relationshipsByResource, getAdapterKind());
deviceChildKeys.add(mezzGroup);
// add health state here
setHealStatus4GroupObject(mezzGroup, Constant.ATTR_MEZZ_HEALTH_STATUS, childHealthList);
}
return deviceChildKeys;
}
use of com.integrien.alive.common.adapter3.ResourceKey in project Server_Management_Plugin_vRealize by Huawei.
the class ESightAdapter method setPsu.
private List<ResourceKey> setPsu(String host, List<ResourceKey> allResourceList, ServerDeviceBean deviceBean, ServerDeviceDetailBean device, List<ChildBladeBean> childBladeBeans) {
List<ResourceKey> deviceChildKeys = new ArrayList<>();
List<PSUBean> psuBeans = device.getPSU();
if (!psuBeans.isEmpty()) {
List<ResourceKey> psuResourceKey = new ArrayList<>();
List<String> childHealthList = new ArrayList<>();
for (PSUBean psu : psuBeans) {
ResourceKey key = psu.convert2Resource(host + deviceBean.getDn(), getAdapterKind(), metricsByResource);
psuResourceKey.add(key);
allResourceList.add(key);
if (childBladeBeans.isEmpty()) {
childHealthList.add(ConvertUtils.convertHealthState(psu.getHealthState()));
}
}
// PSU Group
ResourceKey psuGroup = device.createGroupKey(Constant.TREE_PSU_GROUP, Constant.KIND_PSU_GROUP, psuResourceKey, relationshipsByResource, getAdapterKind());
deviceChildKeys.add(psuGroup);
// add health state here
if (!childBladeBeans.isEmpty()) {
String groupHealth = ConvertUtils.convertHealthState(device.getPemHealth());
childHealthList.add(groupHealth);
}
setHealStatus4GroupObject(psuGroup, Constant.ATTR_HEALTHSTATE, childHealthList);
}
return deviceChildKeys;
}
use of com.integrien.alive.common.adapter3.ResourceKey in project Server_Management_Plugin_vRealize by Huawei.
the class ESightAdapter method collectResourceDataFromESight.
/**
* 调用eSight REST API采集数据.
*
* @param host eSight服务器IP
* @return ResourceKey列表
*/
private List<ResourceKey> collectResourceDataFromESight(String host) {
List<ResourceKey> allResourceList = new ArrayList<>();
String[] serverTypes = new String[] { Constant.TREE_SERVER_TYPE_RACK, Constant.TREE_SERVER_TYPE_BLADE, Constant.TREE_SERVER_TYPE_HIGHDENSITY, Constant.TREE_SERVER_TYPE_KUNLUN };
// 服务器类型keyList
List<ResourceKey> serverTypeKeyList = new ArrayList<>();
for (String serverType : serverTypes) {
List<ServerDeviceBean> serverList = service.getServerDeviceList(serverType);
if (serverList.isEmpty()) {
continue;
}
// 收集 devices key
List<ResourceKey> serverDeviceKeyList = new ArrayList<>();
// 服务器分类
ResourceKey serverTypeKey = new ResourceKey(serverType, Constant.KIND_SERVER_TYPES, getAdapterKind());
ResourceIdentifierConfig ipIdentifier = new ResourceIdentifierConfig(Constant.ATTR_ID, host + serverType, true);
serverTypeKey.addIdentifier(ipIdentifier);
List<String> serverTypeChildHealthList = new ArrayList<>();
allResourceList.add(serverTypeKey);
serverTypeKeyList.add(serverTypeKey);
for (ServerDeviceBean deviceBean : serverList) {
setConfig(host, allResourceList, serverDeviceKeyList, serverTypeChildHealthList, deviceBean);
}
// 设置服务器类型(如rack, blade)和server device关联关系
relationshipsByResource.put(serverTypeKey, serverDeviceKeyList);
setHealStatus4GroupObject(serverTypeKey, Constant.ATTR_HEALTHSTATE, serverTypeChildHealthList);
logger.error(serverList.size() + " servers of type = " + serverType + " created.");
}
ResourceKey serverGroupKey = new ResourceKey(host, Constant.KIND_HOST_INSTANCE, getAdapterKind());
long timestamp = System.currentTimeMillis();
List<MetricData> metricDataList = new ArrayList<>();
// 设置healthState为正常状态
metricDataList.add(new MetricData(new MetricKey(false, Constant.ATTR_HEALTHSTATE), timestamp, ConvertUtils.convertHealthState(0)));
metricsByResource.put(serverGroupKey, metricDataList);
// eSight server IP和serverTypes的对应关系
relationshipsByResource.put(serverGroupKey, serverTypeKeyList);
allResourceList.add(serverGroupKey);
return allResourceList;
}
use of com.integrien.alive.common.adapter3.ResourceKey in project Server_Management_Plugin_vRealize by Huawei.
the class ESightAdapter method setMemory.
private List<ResourceKey> setMemory(String host, List<ResourceKey> allResourceList, ServerDeviceBean deviceBean, ServerDeviceDetailBean device) {
List<ResourceKey> deviceChildKeys = new ArrayList<>();
List<MemoryBean> memoryBeans = device.getMemory();
if (!memoryBeans.isEmpty()) {
List<ResourceKey> memoryResourceKey = new ArrayList<>();
List<String> childHealthList = new ArrayList<>();
for (MemoryBean memory : memoryBeans) {
ResourceKey key = memory.convert2Resource(host + deviceBean.getDn(), getAdapterKind(), metricsByResource);
memoryResourceKey.add(key);
allResourceList.add(key);
childHealthList.add(ConvertUtils.convertHealthState(memory.getHealthState()));
}
// memory Group
ResourceKey memoryGroup = device.createGroupKey(Constant.TREE_MEMORY_GROUP, Constant.KIND_MEMORY_GROUP, memoryResourceKey, relationshipsByResource, getAdapterKind());
deviceChildKeys.add(memoryGroup);
// add health state here
setHealStatus4GroupObject(memoryGroup, Constant.ATTR_HEALTHSTATE, childHealthList);
}
return deviceChildKeys;
}
use of com.integrien.alive.common.adapter3.ResourceKey in project Server_Management_Plugin_vRealize by Huawei.
the class ESightAdapter method setBoard.
private List<ResourceKey> setBoard(String host, List<ResourceKey> allResourceList, ServerDeviceBean deviceBean, ServerDeviceDetailBean device) {
List<ResourceKey> deviceChildKeys = new ArrayList<>();
List<BoardBean> boardBeans = device.getBoard();
if (!boardBeans.isEmpty()) {
List<ResourceKey> boardResourceKey = new ArrayList<>();
List<String> childHealthList = new ArrayList<>();
for (BoardBean board : boardBeans) {
ResourceKey boardKey = board.convert2Resource(host + deviceBean.getDn(), getAdapterKind(), metricsByResource);
boardResourceKey.add(boardKey);
allResourceList.add(boardKey);
childHealthList.add(ConvertUtils.convertHealthState(board.getHealthState()));
}
// board Group
ResourceKey boardGroup = device.createGroupKey(Constant.TREE_BOARD_GROUP, Constant.KIND_BOARD_GROUP, boardResourceKey, relationshipsByResource, getAdapterKind());
deviceChildKeys.add(boardGroup);
// add health state here
setHealStatus4GroupObject(boardGroup, Constant.ATTR_HEALTHSTATE, childHealthList);
}
return deviceChildKeys;
}
Aggregations