use of org.opennms.netmgt.model.OnmsMonitoredService in project opennms by OpenNMS.
the class WebOutageRepositoryFilterIT method setUp.
@Before
public void setUp() {
m_dbPopulator.populateDatabase();
OnmsMonitoredService svc2 = m_dbPopulator.getMonitoredServiceDao().get(m_dbPopulator.getNode2().getId(), InetAddressUtils.addr("192.168.2.1"), "ICMP");
// This requires every test method to have a new database instance :/
OnmsEvent event = m_dbPopulator.getEventDao().get(1);
OnmsOutage unresolved2 = new OnmsOutage(new Date(), event, svc2);
m_dbPopulator.getOutageDao().save(unresolved2);
m_dbPopulator.getOutageDao().flush();
}
use of org.opennms.netmgt.model.OnmsMonitoredService in project opennms by OpenNMS.
the class RestClient method getServicesForANode.
public List<OnmsMonitoredService> getServicesForANode(String nodeCriteria, String ipAddress) {
GenericType<List<OnmsMonitoredService>> services = new GenericType<List<OnmsMonitoredService>>() {
};
final WebTarget target = getTarget().path("nodes").path(nodeCriteria).path("ipinterfaces").path(ipAddress).path("services");
return getBuilder(target).get(services);
}
use of org.opennms.netmgt.model.OnmsMonitoredService in project opennms by OpenNMS.
the class Poller method scheduleServices.
private int scheduleServices() {
final Criteria criteria = new Criteria(OnmsMonitoredService.class);
criteria.addRestriction(new InRestriction("status", Arrays.asList("A", "N")));
return m_transactionTemplate.execute(new TransactionCallback<Integer>() {
@Override
public Integer doInTransaction(TransactionStatus arg0) {
final List<OnmsMonitoredService> services = m_monitoredServiceDao.findMatching(criteria);
for (OnmsMonitoredService service : services) {
scheduleService(service);
}
return services.size();
}
});
}
use of org.opennms.netmgt.model.OnmsMonitoredService in project opennms by OpenNMS.
the class DefaultDistributedStatusService method initializeGraphUrls.
private void initializeGraphUrls(DistributedStatusHistoryModel model) {
if (model.getChosenMonitor() != null) {
Collection<OnmsMonitoredService> services = model.getChosenApplicationMemberServices();
long[] times = model.getChosenPeriod().getStartAndEndTimes();
SortedSet<ServiceGraph> serviceGraphs = new TreeSet<ServiceGraph>(SERVICE_GRAPH_COMPARATOR);
for (OnmsMonitoredService service : services) {
serviceGraphs.add(getServiceGraphForService(model.getChosenMonitor(), service, times));
}
model.setServiceGraphs(serviceGraphs);
}
}
use of org.opennms.netmgt.model.OnmsMonitoredService in project opennms by OpenNMS.
the class DefaultSiteStatusServiceIT method createOutageForNodeInCategory.
private void createOutageForNodeInCategory(String categoryName) {
OnmsCategory category = m_categoryDao.findByName(categoryName);
Collection<OnmsNode> nodes = m_nodeDao.findByCategory(category);
assertNotNull(nodes);
assertFalse(nodes.isEmpty());
/*
* There should only be 1 node per category based on the set of
* default nodes that are stored in {@link DatabasePopulator}
*/
assertEquals(1, nodes.size());
OnmsNode node = nodes.iterator().next();
node.visit(new AbstractEntityVisitor() {
@Override
public void visitMonitoredService(OnmsMonitoredService monSvc) {
createOutageForService(monSvc);
}
});
}
Aggregations