use of org.opennms.netmgt.telemetry.config.model.Rrd in project opennms by OpenNMS.
the class TelemetrydConfigTest method data.
@Parameterized.Parameters
public static Collection<Object[]> data() throws ParseException, UnknownHostException {
TelemetrydConfiguration telemetrydConfig = new TelemetrydConfiguration();
Protocol jtiProtocol = new Protocol();
jtiProtocol.setName("JTI");
jtiProtocol.setDescription("Junos Telemetry Interface (JTI)");
jtiProtocol.setEnabled(false);
telemetrydConfig.getProtocols().add(jtiProtocol);
Listener udpListener = new Listener();
udpListener.setName("JTI-UDP-50000");
udpListener.setClassName("org.opennms.netmgt.collection.streaming.udp.UdpListener");
udpListener.getParameters().add(new Parameter("port", "50000"));
jtiProtocol.getListeners().add(udpListener);
Adapter jtiGbpAdapter = new Adapter();
jtiGbpAdapter.setName("JTI-GPB");
jtiGbpAdapter.setClassName("org.opennms.netmgt.collection.streaming.jti.JtiGpbAdapter");
jtiGbpAdapter.getParameters().add(new Parameter("script", "${install.dir}/etc/telemetryd-adapters/junos-telemetry-interface.groovy"));
jtiProtocol.getAdapters().add(jtiGbpAdapter);
Package jtiDefaultPkg = new Package();
jtiDefaultPkg.setName("JTI-Default");
jtiDefaultPkg.setFilter(new Filter("IPADDR != '0.0.0.0'"));
jtiProtocol.getPackages().add(jtiDefaultPkg);
Rrd rrd = new Rrd();
rrd.setStep(300);
rrd.getRras().add("RRA:AVERAGE:0.5:1:2016");
rrd.getRras().add("RRA:AVERAGE:0.5:12:1488");
rrd.getRras().add("RRA:AVERAGE:0.5:288:366");
rrd.getRras().add("RRA:MAX:0.5:288:366");
rrd.getRras().add("RRA:MIN:0.5:288:366");
jtiDefaultPkg.setRrd(rrd);
return Arrays.asList(new Object[][] { { telemetrydConfig, "<telemetryd-config>\n" + " <protocol name=\"JTI\" description=\"Junos Telemetry Interface (JTI)\" enabled=\"false\">\n" + " <listener name=\"JTI-UDP-50000\" class-name=\"org.opennms.netmgt.collection.streaming.udp.UdpListener\">\n" + " <parameter key=\"port\" value=\"50000\"/>\n" + " </listener>\n" + "\n" + " <adapter name=\"JTI-GPB\" class-name=\"org.opennms.netmgt.collection.streaming.jti.JtiGpbAdapter\">\n" + " <parameter key=\"script\" value=\"${install.dir}/etc/telemetryd-adapters/junos-telemetry-interface.groovy\" />\n" + " </adapter>\n" + "\n" + " <package name=\"JTI-Default\">\n" + " <filter>IPADDR != '0.0.0.0'</filter>\n" + " <rrd step=\"300\">\n" + " <rra>RRA:AVERAGE:0.5:1:2016</rra>\n" + " <rra>RRA:AVERAGE:0.5:12:1488</rra>\n" + " <rra>RRA:AVERAGE:0.5:288:366</rra>\n" + " <rra>RRA:MAX:0.5:288:366</rra>\n" + " <rra>RRA:MIN:0.5:288:366</rra>\n" + " </rrd>\n" + " </package>\n" + " </protocol>\n" + "</telemetryd-config>" } });
}
use of org.opennms.netmgt.telemetry.config.model.Rrd in project opennms by OpenNMS.
the class JtiIT method getConfig.
private TelemetrydConfiguration getConfig(int port) {
TelemetrydConfiguration telemetrydConfig = new TelemetrydConfiguration();
Protocol jtiProtocol = new Protocol();
jtiProtocol.setName("JTI");
jtiProtocol.setDescription("Junos Telemetry Interface (JTI)");
telemetrydConfig.getProtocols().add(jtiProtocol);
Listener udpListener = new Listener();
udpListener.setName("JTI-UDP-" + port);
udpListener.setClassName(UdpListener.class.getCanonicalName());
udpListener.getParameters().add(new Parameter("port", Integer.toString(port)));
jtiProtocol.getListeners().add(udpListener);
Adapter jtiGbpAdapter = new Adapter();
jtiGbpAdapter.setName("JTI-GBP");
jtiGbpAdapter.setClassName(JtiGpbAdapter.class.getCanonicalName());
File script = Paths.get(System.getProperty("opennms.home"), "etc", "telemetryd-adapters", "junos-telemetry-interface.groovy").toFile();
assertTrue("Can't read: " + script.getAbsolutePath(), script.canRead());
jtiGbpAdapter.getParameters().add(new Parameter("script", script.getAbsolutePath()));
jtiProtocol.getAdapters().add(jtiGbpAdapter);
Package jtiDefaultPkg = new Package();
jtiDefaultPkg.setName("JTI-Default");
jtiDefaultPkg.setFilter(new Filter("IPADDR != '0.0.0.0'"));
jtiProtocol.getPackages().add(jtiDefaultPkg);
Rrd rrd = new Rrd();
rrd.setStep(300);
rrd.setBaseDir(rrdBaseDir.getAbsolutePath());
rrd.getRras().add("RRA:AVERAGE:0.5:1:2016");
jtiDefaultPkg.setRrd(rrd);
return telemetrydConfig;
}
Aggregations