use of org.opennms.netmgt.telemetry.listeners.udp.UdpListener 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