Search in sources :

Example 1 with ResourceKey

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;
}
Also used : ArrayList(java.util.ArrayList) MezzBean(com.huawei.esight.service.bean.MezzBean) ResourceKey(com.integrien.alive.common.adapter3.ResourceKey)

Example 2 with ResourceKey

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;
}
Also used : PSUBean(com.huawei.esight.service.bean.PSUBean) ArrayList(java.util.ArrayList) ResourceKey(com.integrien.alive.common.adapter3.ResourceKey)

Example 3 with ResourceKey

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;
}
Also used : ResourceIdentifierConfig(com.integrien.alive.common.adapter3.config.ResourceIdentifierConfig) ServerDeviceBean(com.huawei.esight.service.bean.ServerDeviceBean) ArrayList(java.util.ArrayList) ResourceKey(com.integrien.alive.common.adapter3.ResourceKey) MetricKey(com.integrien.alive.common.adapter3.MetricKey) MetricData(com.integrien.alive.common.adapter3.MetricData)

Example 4 with ResourceKey

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;
}
Also used : ArrayList(java.util.ArrayList) MemoryBean(com.huawei.esight.service.bean.MemoryBean) ResourceKey(com.integrien.alive.common.adapter3.ResourceKey)

Example 5 with ResourceKey

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;
}
Also used : ArrayList(java.util.ArrayList) BoardBean(com.huawei.esight.service.bean.BoardBean) ResourceKey(com.integrien.alive.common.adapter3.ResourceKey)

Aggregations

ResourceKey (com.integrien.alive.common.adapter3.ResourceKey)27 ArrayList (java.util.ArrayList)26 MetricData (com.integrien.alive.common.adapter3.MetricData)14 MetricKey (com.integrien.alive.common.adapter3.MetricKey)14 ResourceIdentifierConfig (com.integrien.alive.common.adapter3.config.ResourceIdentifierConfig)13 ChildBladeBean (com.huawei.esight.service.bean.ChildBladeBean)2 DiscoveryResult (com.integrien.alive.common.adapter3.DiscoveryResult)2 Relationships (com.integrien.alive.common.adapter3.Relationships)2 ResourceConfig (com.integrien.alive.common.adapter3.config.ResourceConfig)2 EsightException (com.huawei.esight.exception.EsightException)1 BoardBean (com.huawei.esight.service.bean.BoardBean)1 CPUBean (com.huawei.esight.service.bean.CPUBean)1 DiskBean (com.huawei.esight.service.bean.DiskBean)1 FanBean (com.huawei.esight.service.bean.FanBean)1 MemoryBean (com.huawei.esight.service.bean.MemoryBean)1 MezzBean (com.huawei.esight.service.bean.MezzBean)1 NetworkCardBean (com.huawei.esight.service.bean.NetworkCardBean)1 PCIEBean (com.huawei.esight.service.bean.PCIEBean)1 PSUBean (com.huawei.esight.service.bean.PSUBean)1 RAIDBean (com.huawei.esight.service.bean.RAIDBean)1