use of org.opennms.netmgt.model.PrefabGraph in project opennms by OpenNMS.
the class GraphRestService method getGraphNames.
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_ATOM_XML })
@Transactional(readOnly = true)
public GraphNameCollection getGraphNames() {
List<String> graphNames = Lists.newLinkedList();
for (PrefabGraph prefabGraph : m_graphDao.getAllPrefabGraphs()) {
graphNames.add(prefabGraph.getName());
}
Collections.sort(graphNames);
return new GraphNameCollection(graphNames);
}
use of org.opennms.netmgt.model.PrefabGraph in project opennms by OpenNMS.
the class GraphRestService method getGraphNamesForResource.
private GraphNameCollection getGraphNamesForResource(final OnmsResource resource) {
List<String> graphNames = Lists.newLinkedList();
for (PrefabGraph prefabGraph : m_graphDao.getPrefabGraphsForResource(resource)) {
graphNames.add(prefabGraph.getName());
}
Collections.sort(graphNames);
return new GraphNameCollection(graphNames);
}
use of org.opennms.netmgt.model.PrefabGraph in project opennms by OpenNMS.
the class NrtHelperTest method testStringProperties.
@Test
public void testStringProperties() {
String rawString = "--title='Current TCP Connections' --vertical-label='Current Connections ({ifSpeed})' DEF:currEstab={rrd1}:tcpCurrEstab:AVERAGE DEF:minCurrEstab={rrd1}:tcpCurrEstab:MIN DEF:maxCurrEstab={rrd1}:tcpCurrEstab:MAX LINE2:currEstab#00ff00:'Current ' GPRINT:currEstab:AVERAGE:'Avg \n: %8.2lf %s' GPRINT:currEstab:MIN:'Min \n: %8.2lf %s' GPRINT:currEstab:MAX:'Max \n: %8.2lf %s\n'";
final Map<String, String> properties = new HashMap<String, String>();
properties.put("ifSpeed", "monkey");
final PrefabGraph prefabGraph = new PrefabGraph("foo", "bar", new String[] {}, rawString, new String[] {}, new String[] {}, 0, null, null, null, null, new String[] {});
final String graphString = nrtHelper.cleanUpRrdGraphStringForWebUi(prefabGraph, m_emptyMap, properties);
assertTrue(graphString.contains("(monkey)"));
}
use of org.opennms.netmgt.model.PrefabGraph in project opennms by OpenNMS.
the class DefaultDistributedStatusService method getServiceGraphForService.
private ServiceGraph getServiceGraphForService(OnmsLocationMonitor locMon, OnmsMonitoredService service, long[] times) {
OnmsResource resource;
try {
resource = m_resourceDao.getResourceForIpInterface(service.getIpInterface(), locMon);
} catch (ObjectRetrievalFailureException e) {
resource = null;
}
if (resource == null) {
return new ServiceGraph(service, new String[] { "Resource could not be found. Has any response time data been collected for this service from this remote poller?" });
}
String graphName = service.getServiceName().toLowerCase();
try {
m_graphDao.getPrefabGraph(graphName);
} catch (ObjectRetrievalFailureException e) {
return new ServiceGraph(service, new String[] { "Graph definition could not be found for '" + graphName + "'. A graph definition needs to be created for this service." });
}
PrefabGraph[] prefabGraphs = m_graphDao.getPrefabGraphsForResource(resource);
for (PrefabGraph graph : prefabGraphs) {
if (graph.getName().equals(graphName)) {
String url = "graph/graph.png" + "?report=" + Util.encode(graph.getName()) + "&resourceId=" + Util.encode(resource.getId().toString()) + "&start=" + times[0] + "&end=" + times[1];
return new ServiceGraph(service, url);
}
}
return new ServiceGraph(service, new String[] { "Graph could not be found for '" + graphName + "' on this resource. Has any response time data been collected for this service from this remote poller and is the graph definition correct?" });
}
use of org.opennms.netmgt.model.PrefabGraph in project opennms by OpenNMS.
the class PropertiesGraphDaoIT method testCompareToLessThan.
@Test
public void testCompareToLessThan() {
PrefabGraph bits = m_graphs.get("mib2.bits").getObject();
PrefabGraph discards = m_graphs.get("mib2.discards").getObject();
;
assertEquals("compareTo", -1, bits.compareTo(discards));
}
Aggregations