Search in sources :

Example 16 with ResourceKey

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

the class BoardBean method convert2Resource.

@Override
public ResourceKey convert2Resource(String id, String adapterKind, Map<ResourceKey, List<MetricData>> metricsByResource) {
    ResourceKey resourceKey = new ResourceKey(this.name, Constant.KIND_BOARD, adapterKind);
    // 设定唯一的标识,保证同名的资源可以正常显示
    ResourceIdentifierConfig dnIdentifier = new ResourceIdentifierConfig(Constant.ATTR_ID, id + this.uuid, true);
    resourceKey.addIdentifier(dnIdentifier);
    long timestamp = System.currentTimeMillis();
    List<MetricData> metricDataList = new ArrayList<>();
    // 写入resource属性
    metricDataList.add(new MetricData(new MetricKey(true).add(Constant.ATTR_NAME), timestamp, this.name));
    metricDataList.add(new MetricData(new MetricKey(true).add(Constant.ATTR_TYPE), timestamp, ConvertUtils.convertBoardType(this.type)));
    metricDataList.add(new MetricData(new MetricKey(true).add(Constant.ATTR_SN), timestamp, this.sn));
    metricDataList.add(new MetricData(new MetricKey(true).add(Constant.ATTR_PART_NUMBER), timestamp, this.partNumber));
    metricDataList.add(new MetricData(new MetricKey(true).add(Constant.ATTR_MANUFACTURE), timestamp, this.manufacture));
    metricDataList.add(new MetricData(new MetricKey(true).add(Constant.ATTR_MANUTIME), timestamp, this.manuTime));
    metricDataList.add(new MetricData(new MetricKey(true).add(Constant.ATTR_UUID), timestamp, this.uuid));
    metricDataList.add(new MetricData(new MetricKey(true).add(Constant.ATTR_MOID), timestamp, this.moId));
    metricDataList.add(new MetricData(new MetricKey(true).add(Constant.ATTR_PRESENTSTATE), timestamp, ConvertUtils.convertPresentState(this.presentState)));
    metricDataList.add(new MetricData(new MetricKey(false).add(Constant.ATTR_HEALTHSTATE), timestamp, ConvertUtils.convertHealthState(this.healthState)));
    metricDataList.add(new MetricData(new MetricKey(true).add(Constant.ATTR_IP_ADDRESS), timestamp, this.ipAddress));
    // 关联key和属性值
    metricsByResource.put(resourceKey, metricDataList);
    return resourceKey;
}
Also used : ResourceIdentifierConfig(com.integrien.alive.common.adapter3.config.ResourceIdentifierConfig) MetricKey(com.integrien.alive.common.adapter3.MetricKey) ArrayList(java.util.ArrayList) ResourceKey(com.integrien.alive.common.adapter3.ResourceKey) MetricData(com.integrien.alive.common.adapter3.MetricData)

Example 17 with ResourceKey

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

the class NetworkCardBean method convert2Resource.

@Override
public ResourceKey convert2Resource(String dn, String adapterKind, Map<ResourceKey, List<MetricData>> metricsByResource) {
    ResourceKey resourceKey = new ResourceKey(this.deviceName, Constant.KIND_NETWORKCATD, adapterKind);
    // 设定唯一的标识,保证同名的资源可以正常显示
    ResourceIdentifierConfig dnIdentifier = new ResourceIdentifierConfig(Constant.ATTR_ID, dn + this.uuid, true);
    resourceKey.addIdentifier(dnIdentifier);
    long timestamp = System.currentTimeMillis();
    List<MetricData> metricDataList = new ArrayList<>();
    // 写入resource属性
    metricDataList.add(new MetricData(new MetricKey(true).add(Constant.ATTR_UUID), timestamp, this.uuid));
    metricDataList.add(new MetricData(new MetricKey(true, "deviceName"), timestamp, this.deviceName));
    metricDataList.add(new MetricData(new MetricKey(true, "cardName"), timestamp, this.cardName));
    metricDataList.add(new MetricData(new MetricKey(true, "cardManufacturer"), timestamp, this.cardManufacturer));
    metricDataList.add(new MetricData(new MetricKey(true, "cardModel"), timestamp, this.cardModel));
    metricDataList.add(new MetricData(new MetricKey(true, "chipManufacturer"), timestamp, this.chipManufacturer));
    metricDataList.add(new MetricData(new MetricKey(true, "chipModel"), timestamp, this.chipModel));
    metricDataList.add(new MetricData(new MetricKey(true, "firmwarePkgVersion"), timestamp, this.firmwarePkgVersion));
    metricDataList.add(new MetricData(new MetricKey(true, "driverName"), timestamp, this.driverName));
    metricDataList.add(new MetricData(new MetricKey(true, "driverVersion"), timestamp, this.driverVersion));
    metricDataList.add(new MetricData(new MetricKey(false).add(Constant.ATTR_HEALTHSTATE), timestamp, ConvertUtils.convertHealthState(this.healthState)));
    // 关联key和属性值
    metricsByResource.put(resourceKey, metricDataList);
    return resourceKey;
}
Also used : ResourceIdentifierConfig(com.integrien.alive.common.adapter3.config.ResourceIdentifierConfig) MetricKey(com.integrien.alive.common.adapter3.MetricKey) ArrayList(java.util.ArrayList) ResourceKey(com.integrien.alive.common.adapter3.ResourceKey) MetricData(com.integrien.alive.common.adapter3.MetricData)

Example 18 with ResourceKey

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

the class PSUBean method convert2Resource.

@Override
public ResourceKey convert2Resource(String id, String adapterKind, Map<ResourceKey, List<MetricData>> metricsByResource) {
    ResourceKey resourceKey = new ResourceKey(this.name, Constant.KIND_PSU, adapterKind);
    // 设定唯一的标识,保证同名的资源可以正常显示
    ResourceIdentifierConfig dnIdentifier = new ResourceIdentifierConfig("id", id + this.uuid, true);
    resourceKey.addIdentifier(dnIdentifier);
    long timestamp = System.currentTimeMillis();
    List<MetricData> metricDataList = new ArrayList<>();
    // 写入resource属性
    metricDataList.add(new MetricData(new MetricKey(true, Constant.ATTR_NAME), timestamp, this.name));
    metricDataList.add(new MetricData(new MetricKey(true, Constant.ATTR_INPUTPOWER), timestamp, ConvertUtils.convertPower(this.inputPower)));
    metricDataList.add(new MetricData(new MetricKey(true, Constant.ATTR_MANUFACTURE), timestamp, this.manufacture));
    metricDataList.add(new MetricData(new MetricKey(true, Constant.ATTR_VERSION), timestamp, this.version));
    metricDataList.add(new MetricData(new MetricKey(false, Constant.ATTR_HEALTHSTATE), timestamp, ConvertUtils.convertHealthState(this.healthState)));
    metricDataList.add(new MetricData(new MetricKey(true, Constant.ATTR_INPUTMODE), timestamp, ConvertUtils.convertInputMode(this.inputMode)));
    metricDataList.add(new MetricData(new MetricKey(true, Constant.ATTR_MOID), timestamp, this.moId));
    metricDataList.add(new MetricData(new MetricKey(true, Constant.ATTR_UUID), timestamp, this.uuid));
    metricDataList.add(new MetricData(new MetricKey(true, Constant.ATTR_PRESENTSTATE), timestamp, ConvertUtils.convertPresentState(this.presentState)));
    metricDataList.add(new MetricData(new MetricKey(true, Constant.ATTR_POWER_PROTOCOL), timestamp, ConvertUtils.convertPowerProtocol(this.powerProtocol)));
    metricDataList.add(new MetricData(new MetricKey(true, Constant.ATTR_RATE_POWER), timestamp, ConvertUtils.convertPower(this.ratePower)));
    metricDataList.add(new MetricData(new MetricKey(true, Constant.ATTR_MODEL), timestamp, this.model));
    // 关联key和属性值
    metricsByResource.put(resourceKey, metricDataList);
    return resourceKey;
}
Also used : ResourceIdentifierConfig(com.integrien.alive.common.adapter3.config.ResourceIdentifierConfig) MetricKey(com.integrien.alive.common.adapter3.MetricKey) ArrayList(java.util.ArrayList) ResourceKey(com.integrien.alive.common.adapter3.ResourceKey) MetricData(com.integrien.alive.common.adapter3.MetricData)

Example 19 with ResourceKey

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

the class CPUBean method convert2Resource.

@Override
public ResourceKey convert2Resource(String id, String adapterKind, Map<ResourceKey, List<MetricData>> metricsByResource) {
    ResourceKey resourceKey = new ResourceKey(this.name, Constant.KIND_CPU, adapterKind);
    // 设定唯一的标识,保证同名的资源可以正常显示
    ResourceIdentifierConfig dnIdentifier = new ResourceIdentifierConfig(Constant.ATTR_ID, id + this.uuid, true);
    resourceKey.addIdentifier(dnIdentifier);
    long timestamp = System.currentTimeMillis();
    List<MetricData> metricDataList = new ArrayList<>();
    // 写入resource属性
    metricDataList.add(new MetricData(new MetricKey(true, Constant.ATTR_NAME), timestamp, this.name));
    metricDataList.add(new MetricData(new MetricKey(false, Constant.ATTR_HEALTHSTATE), timestamp, ConvertUtils.convertHealthState(this.healthState)));
    metricDataList.add(new MetricData(new MetricKey(true, Constant.ATTR_FREQUENCY), timestamp, this.frequency));
    metricDataList.add(new MetricData(new MetricKey(true, Constant.ATTR_MANUFACTURE), timestamp, this.manufacture));
    metricDataList.add(new MetricData(new MetricKey(true, Constant.ATTR_MODEL), timestamp, this.model));
    metricDataList.add(new MetricData(new MetricKey(true, Constant.ATTR_MOID), timestamp, this.moId));
    metricDataList.add(new MetricData(new MetricKey(true, Constant.ATTR_UUID), timestamp, this.uuid));
    metricDataList.add(new MetricData(new MetricKey(true, Constant.ATTR_PRESENTSTATE), timestamp, ConvertUtils.convertPresentState(this.presentState)));
    // 关联key和属性值
    metricsByResource.put(resourceKey, metricDataList);
    return resourceKey;
}
Also used : ResourceIdentifierConfig(com.integrien.alive.common.adapter3.config.ResourceIdentifierConfig) MetricKey(com.integrien.alive.common.adapter3.MetricKey) ArrayList(java.util.ArrayList) ResourceKey(com.integrien.alive.common.adapter3.ResourceKey) MetricData(com.integrien.alive.common.adapter3.MetricData)

Example 20 with ResourceKey

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

the class ESightAdapter method setHealStatus4GroupObject.

/**
 * 设置健康状态
 *
 * @param resourceKey     ResourceKey
 * @param attrName        String
 * @param childStatusList Optional values are {OK, Unknown, Warning, Immediate, Critical}
 *                        Level from High to low is:  OK, Unknown, Warning, Immediate, Critical
 */
private void setHealStatus4GroupObject(ResourceKey resourceKey, String attrName, List<String> childStatusList) {
    String defaultStatus = "OK";
    for (String status : childStatusList) {
        switch(defaultStatus) {
            case "OK":
                {
                    defaultStatus = status;
                }
                break;
            case "Unknown":
                {
                    if ("Warning".equals(status) || "Immediate".equals(status) || "Critical".equals(status)) {
                        defaultStatus = status;
                    }
                }
                break;
            case "Warning":
                {
                    if ("Immediate".equals(status) || "Critical".equals(status)) {
                        defaultStatus = status;
                    }
                }
                break;
            case "Immediate":
                {
                    if ("Critical".equals(status)) {
                        defaultStatus = status;
                    }
                }
                break;
            case "Critical":
                {
                    break;
                }
            default:
                {
                    break;
                }
        }
    }
    if ("Unknown".equals(defaultStatus)) {
        defaultStatus = "Warning";
    }
    List<MetricData> metricDataList = new ArrayList<>();
    long timestamp = System.currentTimeMillis();
    metricDataList.add(new MetricData(new MetricKey(false, attrName), timestamp, defaultStatus));
    metricsByResource.put(resourceKey, metricDataList);
}
Also used : MetricKey(com.integrien.alive.common.adapter3.MetricKey) ArrayList(java.util.ArrayList) 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