Search in sources :

Example 1 with UdpListener

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;
}
Also used : TelemetrydConfiguration(org.opennms.netmgt.telemetry.config.model.TelemetrydConfiguration) UdpListener(org.opennms.netmgt.telemetry.listeners.udp.UdpListener) Listener(org.opennms.netmgt.telemetry.config.model.Listener) UdpListener(org.opennms.netmgt.telemetry.listeners.udp.UdpListener) Filter(org.opennms.netmgt.telemetry.config.model.Filter) Rrd(org.opennms.netmgt.telemetry.config.model.Rrd) JtiGpbAdapter(org.opennms.netmgt.telemetry.adapters.jti.JtiGpbAdapter) Parameter(org.opennms.netmgt.telemetry.config.model.Parameter) Adapter(org.opennms.netmgt.telemetry.config.model.Adapter) JtiGpbAdapter(org.opennms.netmgt.telemetry.adapters.jti.JtiGpbAdapter) Package(org.opennms.netmgt.telemetry.config.model.Package) Protocol(org.opennms.netmgt.telemetry.config.model.Protocol) File(java.io.File)

Aggregations

File (java.io.File)1 JtiGpbAdapter (org.opennms.netmgt.telemetry.adapters.jti.JtiGpbAdapter)1 Adapter (org.opennms.netmgt.telemetry.config.model.Adapter)1 Filter (org.opennms.netmgt.telemetry.config.model.Filter)1 Listener (org.opennms.netmgt.telemetry.config.model.Listener)1 Package (org.opennms.netmgt.telemetry.config.model.Package)1 Parameter (org.opennms.netmgt.telemetry.config.model.Parameter)1 Protocol (org.opennms.netmgt.telemetry.config.model.Protocol)1 Rrd (org.opennms.netmgt.telemetry.config.model.Rrd)1 TelemetrydConfiguration (org.opennms.netmgt.telemetry.config.model.TelemetrydConfiguration)1 UdpListener (org.opennms.netmgt.telemetry.listeners.udp.UdpListener)1