use of org.platformlayer.ops.networks.NetworkPoint 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";
}
Aggregations