Search in sources :

Example 6 with Conformity

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

the class BasicConformityEmailBuilder method getEntryTable.

@Override
protected String getEntryTable(String emailAddress) {
    StringBuilder table = new StringBuilder();
    table.append(getHtmlTableHeader(getTableColumns()));
    for (Cluster cluster : emailToClusters.get(emailAddress)) {
        for (Conformity conformity : cluster.getConformties()) {
            if (!conformity.getFailedComponents().isEmpty()) {
                table.append(getClusterRow(cluster, conformity));
            }
        }
    }
    table.append("</table>");
    return table.toString();
}
Also used : Cluster(com.netflix.simianarmy.conformity.Cluster) Conformity(com.netflix.simianarmy.conformity.Conformity)

Example 7 with Conformity

use of com.netflix.simianarmy.conformity.Conformity 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)

Example 8 with Conformity

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

the class InstanceIsHealthyInEureka method check.

@Override
public Conformity check(Cluster cluster) {
    Collection<String> failedComponents = Lists.newArrayList();
    for (AutoScalingGroup asg : cluster.getAutoScalingGroups()) {
        // ignore suspended ASGs
        if (asg.isSuspended()) {
            LOGGER.info(String.format("ASG %s is suspended, ignore.", asg.getName()));
            continue;
        }
        for (String instance : asg.getInstances()) {
            if (!conformityEurekaClient.isHealthy(cluster.getRegion(), instance)) {
                LOGGER.info(String.format("Instance %s is not healthy in Eureka.", instance));
                failedComponents.add(instance);
            }
        }
    }
    return new Conformity(getName(), failedComponents);
}
Also used : AutoScalingGroup(com.netflix.simianarmy.conformity.AutoScalingGroup) Conformity(com.netflix.simianarmy.conformity.Conformity)

Example 9 with Conformity

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

the class InstanceTooOld method check.

@Override
public Conformity check(Cluster cluster) {
    List<String> instanceIds = Lists.newArrayList();
    for (AutoScalingGroup asg : cluster.getAutoScalingGroups()) {
        instanceIds.addAll(asg.getInstances());
    }
    Map<String, Long> instanceIdToLaunchTime = getInstanceLaunchTimes(cluster.getRegion(), instanceIds.toArray(new String[instanceIds.size()]));
    Collection<String> failedComponents = Lists.newArrayList();
    long creationTimeThreshold = DateTime.now().minusDays(instanceAgeThreshold).getMillis();
    for (Map.Entry<String, Long> entry : instanceIdToLaunchTime.entrySet()) {
        String instanceId = entry.getKey();
        if (creationTimeThreshold > entry.getValue()) {
            LOGGER.info(String.format("Instance %s was created more than %d days ago", instanceId, instanceAgeThreshold));
            failedComponents.add(instanceId);
        }
    }
    return new Conformity(getName(), failedComponents);
}
Also used : AutoScalingGroup(com.netflix.simianarmy.conformity.AutoScalingGroup) Map(java.util.Map) Conformity(com.netflix.simianarmy.conformity.Conformity)

Example 10 with Conformity

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

the class SameZonesInElbAndAsg method check.

@Override
public Conformity check(Cluster cluster) {
    List<String> asgNames = Lists.newArrayList();
    for (AutoScalingGroup asg : cluster.getAutoScalingGroups()) {
        asgNames.add(asg.getName());
    }
    Collection<String> failedComponents = Lists.newArrayList();
    for (AutoScalingGroup asg : cluster.getAutoScalingGroups()) {
        List<String> asgZones = getAvailabilityZonesForAsg(cluster.getRegion(), asg.getName());
        for (String lbName : getLoadBalancerNamesForAsg(cluster.getRegion(), asg.getName())) {
            List<String> lbZones = getAvailabilityZonesForLoadBalancer(cluster.getRegion(), lbName);
            if (!haveSameZones(asgZones, lbZones)) {
                LOGGER.info(String.format("ASG %s and ELB %s do not have the same availability zones", asgZones, lbZones));
                failedComponents.add(lbName);
            }
        }
    }
    return new Conformity(getName(), failedComponents);
}
Also used : AutoScalingGroup(com.netflix.simianarmy.conformity.AutoScalingGroup) Conformity(com.netflix.simianarmy.conformity.Conformity)

Aggregations

Conformity (com.netflix.simianarmy.conformity.Conformity)12 AutoScalingGroup (com.netflix.simianarmy.conformity.AutoScalingGroup)9 Cluster (com.netflix.simianarmy.conformity.Cluster)4 Test (org.testng.annotations.Test)3 Map (java.util.Map)2 MonkeyRestClient (com.netflix.simianarmy.client.MonkeyRestClient)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 List (java.util.List)1 RowMapper (org.springframework.jdbc.core.RowMapper)1