use of org.platformlayer.service.collectd.model.CollectdService in project platformlayer by platformlayer.
the class CollectdModelBuilder method getCollectdServer.
@Deprecated
public String getCollectdServer() throws OpsException {
Iterable<CollectdService> collectdServices = platformLayer.listItems(CollectdService.class);
for (CollectdService collectdService : collectdServices) {
// TODO: Use DNS name when it works
NetworkPoint target = network.getNetworkPoint(collectdService);
if (target != null) {
NetworkPoint targetNetworkPoint = NetworkPoint.forTargetInContext();
InetAddress address = target.findBestAddress(targetNetworkPoint, InetAddressChooser.preferIpv6());
if (address != null) {
return address.getHostAddress();
}
}
}
log.warn("Unable to find collectd server; defaulting to 127.0.0.1");
return "127.0.0.1";
}
use of org.platformlayer.service.collectd.model.CollectdService in project platformlayer by platformlayer.
the class CollectdServiceController method addChildren.
@Override
protected void addChildren() throws OpsException {
CollectdService model = OpsContext.get().getInstance(CollectdService.class);
if (Strings.isNullOrEmpty(model.dnsName)) {
throw new IllegalArgumentException("dnsName must be specified");
}
// We'd like to auto-gen the disk image, but we have to fix the problems involving pre-installing collectd (see
// below)
InstanceBuilder instance = InstanceBuilder.build(model.dnsName, DiskImageRecipeBuilder.loadDiskImageResource(getClass(), "DiskImageRecipe.xml"), model.getTags());
// Make sure we have a bit more RAM, so that we can queue up a fair amount of
instance.minimumMemoryMb = 512;
// RRD data
addChild(instance);
// We have some problems using collectd with debootstrap; I think it's when we're using FQDN and we can't
// resolve the hostname
// See http://thegrebs.com/irc/debian/2011/04/01
instance.addChild(PackageDependency.build("librrd4"));
instance.addChild(PackageDependency.build("rrdcached"));
// collectd is a bit fussy, so we have problems bundling it into the disk image
// TODO: This sucks - collectd is pretty big...
instance.addChild(PackageDependency.build("collectd"));
// collectd has collectdmon to keep it alive; don't use monit (for now)
instance.addChild(CollectdSink.build());
instance.addChild(ManagedService.build("collectd"));
}
Aggregations