Search in sources :

Example 1 with Conformity

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

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

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

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

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

the class TestInstanceInVPC method testCheckSoloInstances.

@Test
public void testCheckSoloInstances() throws Exception {
    Set<String> list = Sets.newHashSet();
    list.add(VPC_INSTANCE_ID);
    list.add(INSTANCE_ID);
    Cluster cluster = new Cluster("SoloInstances", REGION, list);
    Conformity result = instanceInVPC.check(cluster);
    Assert.assertNotNull(result);
    Assert.assertEquals(result.getRuleId(), instanceInVPC.getName());
    Assert.assertEquals(result.getFailedComponents().size(), 1);
    Assert.assertEquals(result.getFailedComponents().iterator().next(), INSTANCE_ID);
}
Also used : Cluster(com.netflix.simianarmy.conformity.Cluster) Conformity(com.netflix.simianarmy.conformity.Conformity) Test(org.testng.annotations.Test)

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