Search in sources :

Example 1 with AvailabilityMonitoredService

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;
}
Also used : OnmsNode(org.opennms.netmgt.model.OnmsNode) AvailabilityNode(org.opennms.web.category.AvailabilityNode) OnmsIpInterface(org.opennms.netmgt.model.OnmsIpInterface) AvailabilityIpInterface(org.opennms.web.category.AvailabilityIpInterface) AvailabilityMonitoredService(org.opennms.web.category.AvailabilityMonitoredService) OnmsMonitoredService(org.opennms.netmgt.model.OnmsMonitoredService)

Aggregations

OnmsIpInterface (org.opennms.netmgt.model.OnmsIpInterface)1 OnmsMonitoredService (org.opennms.netmgt.model.OnmsMonitoredService)1 OnmsNode (org.opennms.netmgt.model.OnmsNode)1 AvailabilityIpInterface (org.opennms.web.category.AvailabilityIpInterface)1 AvailabilityMonitoredService (org.opennms.web.category.AvailabilityMonitoredService)1 AvailabilityNode (org.opennms.web.category.AvailabilityNode)1