Search in sources :

Example 6 with MetricData

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

the class DiskBean method convert2Resource.

@Override
public ResourceKey convert2Resource(String id, String adapterKind, Map<ResourceKey, List<MetricData>> metricsByResource) {
    ResourceKey resourceKey = new ResourceKey(this.name, Constant.KIND_DISK, 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(true, Constant.ATTR_LOCATION), timestamp, this.location));
    metricDataList.add(new MetricData(new MetricKey(false, Constant.ATTR_HEALTHSTATE), timestamp, ConvertUtils.convertHealthState(this.healthState)));
    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 7 with MetricData

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

the class MemoryBean method convert2Resource.

@Override
public ResourceKey convert2Resource(String id, String adapterKind, Map<ResourceKey, List<MetricData>> metricsByResource) {
    ResourceKey resourceKey = new ResourceKey(this.name, Constant.KIND_MEMORY, 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(true, Constant.ATTR_CAPACITY), timestamp, this.capacity));
    metricDataList.add(new MetricData(new MetricKey(true, Constant.ATTR_MANUFACTURE), timestamp, this.manufacture));
    metricDataList.add(new MetricData(new MetricKey(true, Constant.ATTR_FREQUENCY), timestamp, this.frequency));
    metricDataList.add(new MetricData(new MetricKey(false, Constant.ATTR_HEALTHSTATE), timestamp, ConvertUtils.convertHealthState(this.healthState)));
    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 8 with MetricData

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

the class FanBean method convert2Resource.

@Override
public ResourceKey convert2Resource(String id, String adapterKind, Map<ResourceKey, List<MetricData>> metricsByResource) {
    ResourceKey resourceKey = new ResourceKey(this.name, Constant.KIND_FAN, 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_ROTATE), timestamp, this.rotate));
    metricDataList.add(new MetricData(new MetricKey(true, Constant.ATTR_ROTATEPERCENT), timestamp, ConvertUtils.convertRotatePercent(this.controlModel, this.rotatePercent)));
    metricDataList.add(new MetricData(new MetricKey(true, Constant.ATTR_CONTROLMODEL), timestamp, ConvertUtils.convertControlModel(this.controlModel)));
    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 9 with MetricData

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

the class ServerDeviceDetailBean method convert2Resource.

@Override
public ResourceKey convert2Resource(String id, String adapterKind, Map<ResourceKey, List<MetricData>> metricsByResource) {
    String resourceName = this.name;
    if (resourceName == null || resourceName.isEmpty()) {
        resourceName = this.ipAddress;
    }
    ResourceKey resourceKey = new ResourceKey(resourceName, Constant.KIND_SERVER_DEVICE, adapterKind);
    ResourceIdentifierConfig dnIdentifier = new ResourceIdentifierConfig(Constant.ATTR_ID, id + this.uuid, true);
    resourceKey.addIdentifier(dnIdentifier);
    long timestamp = System.currentTimeMillis();
    List<MetricData> metricDataList = new ArrayList<>();
    // 写入资源属性
    metricDataList.add(new MetricData(new MetricKey(true, Constant.ATTR_DN), timestamp, this.dn));
    metricDataList.add(new MetricData(new MetricKey(true, Constant.ATTR_IP_ADDRESS), timestamp, this.ipAddress));
    metricDataList.add(new MetricData(new MetricKey(true, Constant.ATTR_NAME), timestamp, this.name));
    metricDataList.add(new MetricData(new MetricKey(true, Constant.ATTR_TYPE), timestamp, this.type));
    metricDataList.add(new MetricData(new MetricKey(true, Constant.ATTR_UUID), timestamp, this.uuid));
    metricDataList.add(new MetricData(new MetricKey(false, Constant.ATTR_STATUS), timestamp, ConvertUtils.convertHealthState(this.status)));
    metricDataList.add(new MetricData(new MetricKey(true, Constant.ATTR_DESC), timestamp, this.desc));
    metricDataList.add(new MetricData(new MetricKey(true, Constant.ATTR_PRODUCT_SN), timestamp, this.productSn));
    metricDataList.add(new MetricData(new MetricKey(true, Constant.ATTR_MANUFACTURE), timestamp, this.manufacturer));
    metricDataList.add(new MetricData(new MetricKey(true, Constant.ATTR_VERSION), timestamp, this.version));
    metricDataList.add(new MetricData(new MetricKey(true, Constant.ATTR_LOCATION), timestamp, this.location));
    // 非机框服务器不需要写入以下属性
    if (this.memoryCapacity != null) {
        metricDataList.add(new MetricData(new MetricKey(true, Constant.ATTR_MEMORY_CAPACITY), timestamp, this.memoryCapacity));
        metricDataList.add(new MetricData(new MetricKey(true, Constant.ATTR_MODEL), timestamp, this.mode));
        metricDataList.add(new MetricData(new MetricKey(true, Constant.ATTR_BMC_MAC_ADDR), timestamp, this.bmcMacAddr));
        metricDataList.add(new MetricData(new MetricKey(true, Constant.ATTR_CPU_NUMS), timestamp, this.cpuNums));
        metricDataList.add(new MetricData(new MetricKey(true, Constant.ATTR_CPU_CORES), timestamp, this.cpuCores));
    }
    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 10 with MetricData

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

the class MezzBean method convert2Resource.

@Override
public ResourceKey convert2Resource(String id, String adapterKind, Map<ResourceKey, List<MetricData>> metricsByResource) {
    ResourceKey resourceKey = new ResourceKey(this.name, Constant.KIND_MEZZ, adapterKind);
    // 设定唯一的标识,保证同名的资源可以正常显示
    ResourceIdentifierConfig dnIdentifier = new ResourceIdentifierConfig(Constant.ATTR_ID, id + this.uuid, true);
    resourceKey.addIdentifier(dnIdentifier);
    long timestamp = System.currentTimeMillis();
    List<MetricData> metricData = new ArrayList<>();
    // 写入resource属性
    metricData.add(new MetricData(new MetricKey(true).add(Constant.ATTR_NAME), timestamp, this.name));
    metricData.add(new MetricData(new MetricKey(false).add(Constant.ATTR_MEZZ_HEALTH_STATUS), timestamp, ConvertUtils.convertHealthState(this.getMezzHealthStatus())));
    metricData.add(new MetricData(new MetricKey(true).add(Constant.ATTR_PRESENTSTATE), timestamp, ConvertUtils.convertPresentState(this.presentState)));
    metricData.add(new MetricData(new MetricKey(true).add(Constant.ATTR_MEZZ_INFO), timestamp, this.mezzInfo));
    metricData.add(new MetricData(new MetricKey(true).add(Constant.ATTR_MEZZ_LOCATION), timestamp, this.mezzLocation));
    metricData.add(new MetricData(new MetricKey(true).add(Constant.ATTR_MEZZ_ETH_MAC), timestamp, this.mezzETHMac));
    metricData.add(new MetricData(new MetricKey(true).add(Constant.ATTR_MEZZ_IB_MAC), timestamp, this.mezzIBMac));
    metricData.add(new MetricData(new MetricKey(true).add(Constant.ATTR_MEZZ_FCWWPN), timestamp, this.mezzFCWWPN));
    metricData.add(new MetricData(new MetricKey(true).add(Constant.ATTR_MOID), timestamp, this.moId));
    metricData.add(new MetricData(new MetricKey(true).add(Constant.ATTR_UUID), timestamp, this.uuid));
    // 关联key和属性值
    metricsByResource.put(resourceKey, metricData);
    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)

Aggregations

MetricData (com.integrien.alive.common.adapter3.MetricData)14 MetricKey (com.integrien.alive.common.adapter3.MetricKey)14 ArrayList (java.util.ArrayList)14 ResourceKey (com.integrien.alive.common.adapter3.ResourceKey)13 ResourceIdentifierConfig (com.integrien.alive.common.adapter3.config.ResourceIdentifierConfig)12 Envelope (com.microsoft.applicationinsights.smoketest.schemav2.Envelope)5 MetricData (com.microsoft.applicationinsights.smoketest.schemav2.MetricData)5 Test (org.junit.Test)5 DataPoint (com.microsoft.applicationinsights.smoketest.schemav2.DataPoint)3 ServerDeviceBean (com.huawei.esight.service.bean.ServerDeviceBean)1 DiscoveryResult (com.integrien.alive.common.adapter3.DiscoveryResult)1 Relationships (com.integrien.alive.common.adapter3.Relationships)1 ResourceConfig (com.integrien.alive.common.adapter3.config.ResourceConfig)1 Data (com.microsoft.applicationinsights.smoketest.schemav2.Data)1 DataPointType (com.microsoft.applicationinsights.smoketest.schemav2.DataPointType)1 RequestData (com.microsoft.applicationinsights.smoketest.schemav2.RequestData)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Assert.assertEquals (org.junit.Assert.assertEquals)1 Assert.assertNull (org.junit.Assert.assertNull)1