Search in sources :

Example 1 with AutoScalingGroup

use of com.netflix.simianarmy.conformity.AutoScalingGroup in project SimianArmy by Netflix.

the class InstanceHasHealthCheckUrl method check.

@Override
public Conformity check(Cluster cluster) {
    Collection<String> failedComponents = Lists.newArrayList();
    for (AutoScalingGroup asg : cluster.getAutoScalingGroups()) {
        if (asg.isSuspended()) {
            continue;
        }
        for (String instance : asg.getInstances()) {
            if (!conformityEurekaClient.hasHealthCheckUrl(cluster.getRegion(), instance)) {
                LOGGER.info(String.format("Instance %s does not have health check url in discovery.", instance));
                failedComponents.add(instance);
            }
        }
    }
    return new Conformity(getName(), failedComponents);
}
Also used : AutoScalingGroup(com.netflix.simianarmy.conformity.AutoScalingGroup) Conformity(com.netflix.simianarmy.conformity.Conformity)

Example 2 with AutoScalingGroup

use of com.netflix.simianarmy.conformity.AutoScalingGroup in project SimianArmy by Netflix.

the class InstanceHasStatusUrl method check.

@Override
public Conformity check(Cluster cluster) {
    Collection<String> failedComponents = Lists.newArrayList();
    for (AutoScalingGroup asg : cluster.getAutoScalingGroups()) {
        if (asg.isSuspended()) {
            continue;
        }
        for (String instance : asg.getInstances()) {
            if (!conformityEurekaClient.hasStatusUrl(cluster.getRegion(), instance)) {
                LOGGER.info(String.format("Instance %s does not have a status page url in discovery.", instance));
                failedComponents.add(instance);
            }
        }
    }
    return new Conformity(getName(), failedComponents);
}
Also used : AutoScalingGroup(com.netflix.simianarmy.conformity.AutoScalingGroup) Conformity(com.netflix.simianarmy.conformity.Conformity)

Example 3 with AutoScalingGroup

use of com.netflix.simianarmy.conformity.AutoScalingGroup in project SimianArmy by Netflix.

the class InstanceInSecurityGroup method check.

@Override
public Conformity check(Cluster cluster) {
    List<String> instanceIds = Lists.newArrayList();
    for (AutoScalingGroup asg : cluster.getAutoScalingGroups()) {
        instanceIds.addAll(asg.getInstances());
    }
    Collection<String> failedComponents = Lists.newArrayList();
    if (instanceIds.size() != 0) {
        Map<String, List<String>> instanceIdToSecurityGroup = getInstanceSecurityGroups(cluster.getRegion(), instanceIds.toArray(new String[instanceIds.size()]));
        for (Map.Entry<String, List<String>> entry : instanceIdToSecurityGroup.entrySet()) {
            String instanceId = entry.getKey();
            if (!checkSecurityGroups(entry.getValue())) {
                LOGGER.info(String.format("Instance %s does not have all required security groups", instanceId));
                failedComponents.add(instanceId);
            }
        }
    }
    return new Conformity(getName(), failedComponents);
}
Also used : AutoScalingGroup(com.netflix.simianarmy.conformity.AutoScalingGroup) List(java.util.List) Map(java.util.Map) Conformity(com.netflix.simianarmy.conformity.Conformity)

Example 4 with AutoScalingGroup

use of com.netflix.simianarmy.conformity.AutoScalingGroup in project SimianArmy by Netflix.

the class InstanceInVPC method check.

@Override
public Conformity check(Cluster cluster) {
    Collection<String> failedComponents = Lists.newArrayList();
    //check all instances
    Set<String> failedInstances = checkInstancesInVPC(cluster.getRegion(), cluster.getSoloInstances());
    failedComponents.addAll(failedInstances);
    //check asg instances
    for (AutoScalingGroup asg : cluster.getAutoScalingGroups()) {
        if (asg.isSuspended()) {
            continue;
        }
        Set<String> asgFailedInstances = checkInstancesInVPC(cluster.getRegion(), asg.getInstances());
        failedComponents.addAll(asgFailedInstances);
    }
    return new Conformity(getName(), failedComponents);
}
Also used : AutoScalingGroup(com.netflix.simianarmy.conformity.AutoScalingGroup) Conformity(com.netflix.simianarmy.conformity.Conformity)

Example 5 with AutoScalingGroup

use of com.netflix.simianarmy.conformity.AutoScalingGroup in project SimianArmy by Netflix.

the class CrossZoneLoadBalancing method check.

@Override
public Conformity check(Cluster cluster) {
    Collection<String> failedComponents = Lists.newArrayList();
    for (AutoScalingGroup asg : cluster.getAutoScalingGroups()) {
        try {
            for (String lbName : getLoadBalancerNamesForAsg(cluster.getRegion(), asg.getName())) {
                if (!isCrossZoneLoadBalancingEnabled(cluster.getRegion(), lbName)) {
                    LOGGER.info(String.format("ELB %s in %s does not have cross-zone load balancing enabled", lbName, cluster.getRegion()));
                    failedComponents.add(lbName);
                }
            }
        } catch (MonkeyRestClient.DataReadException e) {
            LOGGER.error(String.format("Transient error reading ELB for %s in %s - skipping this check", asg.getName(), cluster.getRegion()), e);
        }
    }
    return new Conformity(getName(), failedComponents);
}
Also used : AutoScalingGroup(com.netflix.simianarmy.conformity.AutoScalingGroup) MonkeyRestClient(com.netflix.simianarmy.client.MonkeyRestClient) Conformity(com.netflix.simianarmy.conformity.Conformity)

Aggregations

AutoScalingGroup (com.netflix.simianarmy.conformity.AutoScalingGroup)9 Conformity (com.netflix.simianarmy.conformity.Conformity)9 Map (java.util.Map)2 MonkeyRestClient (com.netflix.simianarmy.client.MonkeyRestClient)1 Cluster (com.netflix.simianarmy.conformity.Cluster)1 List (java.util.List)1 Test (org.testng.annotations.Test)1