use of org.opennms.web.category.AvailabilityMonitoredService in project opennms by OpenNMS.
the class AvailabilityRestService method getAvailabilityNode.
AvailabilityNode getAvailabilityNode(final int id) throws Exception {
final OnmsNode dbNode = m_nodeDao.get(id);
initialize(dbNode);
if (dbNode == null) {
throw getException(Status.NOT_FOUND, "Node {} was not found.", Integer.toString(id));
}
final double nodeAvail = CategoryModel.getNodeAvailability(id);
final AvailabilityNode node = new AvailabilityNode(dbNode, nodeAvail);
for (final OnmsIpInterface iface : dbNode.getIpInterfaces()) {
final double ifaceAvail = CategoryModel.getInterfaceAvailability(id, str(iface.getIpAddress()));
final AvailabilityIpInterface ai = new AvailabilityIpInterface(iface, ifaceAvail);
for (final OnmsMonitoredService svc : iface.getMonitoredServices()) {
final double serviceAvail = CategoryModel.getServiceAvailability(id, str(iface.getIpAddress()), svc.getServiceId());
final AvailabilityMonitoredService ams = new AvailabilityMonitoredService(svc, serviceAvail);
ai.addService(ams);
}
node.addIpInterface(ai);
}
return node;
}
Aggregations