Search in sources :

Example 1 with Filter

use of org.opennms.netmgt.telemetry.config.model.Filter 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>" } });
}
Also used : TelemetrydConfiguration(org.opennms.netmgt.telemetry.config.model.TelemetrydConfiguration) Listener(org.opennms.netmgt.telemetry.config.model.Listener) Filter(org.opennms.netmgt.telemetry.config.model.Filter) Rrd(org.opennms.netmgt.telemetry.config.model.Rrd) Parameter(org.opennms.netmgt.telemetry.config.model.Parameter) Adapter(org.opennms.netmgt.telemetry.config.model.Adapter) Package(org.opennms.netmgt.telemetry.config.model.Package) Protocol(org.opennms.netmgt.telemetry.config.model.Protocol)

Example 2 with Filter

use of org.opennms.netmgt.telemetry.config.model.Filter 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

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