Search in sources :

Example 1 with Relationships

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

the class ESightAdapter method useResourceKey.

private void useResourceKey(DiscoveryResult discoveryResult, ResourceKey resourceKey) {
    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);
}
Also used : Relationships(com.integrien.alive.common.adapter3.Relationships) ResourceConfig(com.integrien.alive.common.adapter3.config.ResourceConfig)

Example 2 with Relationships

use of com.integrien.alive.common.adapter3.Relationships 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

Relationships (com.integrien.alive.common.adapter3.Relationships)2 ResourceConfig (com.integrien.alive.common.adapter3.config.ResourceConfig)2 DiscoveryResult (com.integrien.alive.common.adapter3.DiscoveryResult)1 MetricData (com.integrien.alive.common.adapter3.MetricData)1 MetricKey (com.integrien.alive.common.adapter3.MetricKey)1 ResourceKey (com.integrien.alive.common.adapter3.ResourceKey)1 ArrayList (java.util.ArrayList)1