Search in sources :

Example 26 with ResourceKey

use of com.integrien.alive.common.adapter3.ResourceKey in project Server_Management_Plugin_vRealize by Huawei.

the class ESightAdapter method setPcie.

private List<ResourceKey> setPcie(String host, List<ResourceKey> allResourceList, ServerDeviceBean deviceBean, ServerDeviceDetailBean device) {
    List<ResourceKey> deviceChildKeys = new ArrayList<>();
    List<PCIEBean> pcieBeans = device.getPCIE();
    if (!pcieBeans.isEmpty()) {
        List<ResourceKey> pcieResourceKey = new ArrayList<>();
        List<String> childHealthList = new ArrayList<>();
        for (PCIEBean pcie : pcieBeans) {
            ResourceKey key = pcie.convert2Resource(host + deviceBean.getDn(), getAdapterKind(), metricsByResource);
            pcieResourceKey.add(key);
            allResourceList.add(key);
            childHealthList.add(ConvertUtils.convertHealthState(pcie.getPcieSsdCardHealthStatus()));
        }
        // PCIE Group
        ResourceKey pcieGroup = device.createGroupKey(Constant.TREE_PCIE_GROUP, Constant.KIND_PCIE_GROUP, pcieResourceKey, relationshipsByResource, getAdapterKind());
        deviceChildKeys.add(pcieGroup);
        // add health state here
        setHealStatus4GroupObject(pcieGroup, Constant.ATTR_PCIESSDCARD_HEALTHSTATUS, childHealthList);
    }
    return deviceChildKeys;
}
Also used : PCIEBean(com.huawei.esight.service.bean.PCIEBean) ArrayList(java.util.ArrayList) ResourceKey(com.integrien.alive.common.adapter3.ResourceKey)

Example 27 with ResourceKey

use of com.integrien.alive.common.adapter3.ResourceKey in project Server_Management_Plugin_vRealize by Huawei.

the class ESightAdapter method setDeviceGroup.

private List<ResourceKey> setDeviceGroup(ServerDeviceDetailBean device, List<ResourceKey> childBladeDeviceKeyList, List<ChildBladeBean> childBladeBeans) {
    List<ResourceKey> deviceChildKeys = new ArrayList<>();
    if (!childBladeDeviceKeyList.isEmpty()) {
        List<String> childHealthList = new ArrayList<>();
        for (ChildBladeBean childBean : childBladeBeans) {
            childHealthList.add(deviceHealthMap.get(childBean.getDn()));
        }
        ResourceKey devicesGroup = device.createGroupKey(Constant.TREE_DEVICES_GROUP, Constant.KIND_DEVICES_GROUP, childBladeDeviceKeyList, relationshipsByResource, getAdapterKind());
        deviceChildKeys.add(devicesGroup);
        setHealStatus4GroupObject(devicesGroup, Constant.ATTR_STATUS, childHealthList);
    }
    return deviceChildKeys;
}
Also used : ArrayList(java.util.ArrayList) ChildBladeBean(com.huawei.esight.service.bean.ChildBladeBean) ResourceKey(com.integrien.alive.common.adapter3.ResourceKey)

Example 28 with ResourceKey

use of com.integrien.alive.common.adapter3.ResourceKey in project Server_Management_Plugin_vRealize by Huawei.

the class ESightAdapter method setRaid.

private List<ResourceKey> setRaid(String host, List<ResourceKey> allResourceList, ServerDeviceBean deviceBean, ServerDeviceDetailBean device) {
    List<ResourceKey> deviceChildKeys = new ArrayList<>();
    List<RAIDBean> raidBeans = device.getRAID();
    if (!raidBeans.isEmpty()) {
        List<ResourceKey> raidResourceKey = new ArrayList<>();
        List<String> childHealthList = new ArrayList<>();
        for (RAIDBean raid : raidBeans) {
            ResourceKey key = raid.convert2Resource(host + deviceBean.getDn(), getAdapterKind(), metricsByResource);
            raidResourceKey.add(key);
            allResourceList.add(key);
            childHealthList.add(ConvertUtils.convertHealthState(raid.getHealthState()));
        }
        // RAID Group
        ResourceKey raidGroup = device.createGroupKey(Constant.TREE_RAID_GROUP, Constant.KIND_RAID_GROUP, raidResourceKey, relationshipsByResource, getAdapterKind());
        deviceChildKeys.add(raidGroup);
        // add health state here
        setHealStatus4GroupObject(raidGroup, Constant.ATTR_HEALTHSTATE, childHealthList);
    }
    return deviceChildKeys;
}
Also used : ArrayList(java.util.ArrayList) RAIDBean(com.huawei.esight.service.bean.RAIDBean) ResourceKey(com.integrien.alive.common.adapter3.ResourceKey)

Example 29 with ResourceKey

use of com.integrien.alive.common.adapter3.ResourceKey in project Server_Management_Plugin_vRealize by Huawei.

the class ESightAdapter method configEsight.

private void configEsight(String hostIp) {
    ResourceKey resourceKey = new ResourceKey(hostIp, Constant.KIND_HOST_INSTANCE, getAdapterKind());
    long timestamp = System.currentTimeMillis();
    List<MetricData> metricDataList = new ArrayList<>();
    // 设置eSight服务器的状态为离线状态
    metricDataList.add(new MetricData(new MetricKey(false, Constant.ATTR_HEALTHSTATE), timestamp, ConvertUtils.convertHealthState(-1)));
    metricsByResource.put(resourceKey, metricDataList);
    DiscoveryResult discoveryResult = collectResult.getDiscoveryResult(true);
    if (isNewResource(resourceKey)) {
        discoveryResult.addResource(new ResourceConfig(resourceKey));
    }
    // Check if resource is part of monitored set, otherwise continue
    ResourceConfig resourceConfig = getMonitoringResource(resourceKey);
    if (resourceConfig == null) {
        return;
    }
    // Add metrics
    addMetricData(resourceConfig, metricsByResource.get(resourceKey));
    // Add relationships
    Relationships rel = new Relationships();
    rel.setRelationships(resourceKey, relationshipsByResource.get(resourceKey), Collections.singleton(getAdapterKind()));
    discoveryResult.addRelationships(rel);
    return;
}
Also used : DiscoveryResult(com.integrien.alive.common.adapter3.DiscoveryResult) MetricKey(com.integrien.alive.common.adapter3.MetricKey) Relationships(com.integrien.alive.common.adapter3.Relationships) ArrayList(java.util.ArrayList) ResourceConfig(com.integrien.alive.common.adapter3.config.ResourceConfig) ResourceKey(com.integrien.alive.common.adapter3.ResourceKey) MetricData(com.integrien.alive.common.adapter3.MetricData)

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