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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations