Junos Telemetry Interface

The Junos Telemetry Interface (JTI) lets you push operational statistics asynchronously to Horizon. Horizon sends a request to stream periodic updates once to the device. Data is generated as Google protocol buffers (GPB) structured messages over UDP. For detailed information about JTI, see the Juniper Documentation.

To enable support for JTI, edit ${OPENNMS_HOME}/etc/telemetryd-configuration.xml and set enabled=true for JTI protocol.

Enable JTI protocol in telemetryd-configuration.xml
<listener name="JTI-UDP-50000" class-name="org.opennms.netmgt.telemetry.listeners.simple.Udp" enabled="false">
    <parameter key="port" value="50000"/>

    <parser name="JTI-Parser" class-name="org.opennms.netmgt.telemetry.protocols.common.parser.ForwardParser" queue="JTI" />
</listener>

<queue name="JTI">
    <adapter name="JTI-GPB" class-name="org.opennms.netmgt.telemetry.protocols.jti.adapter.JtiGpbAdapter" enabled="false">
        <parameter key="script" value="$OPENNMS_HOME/etc/telemetryd-adapters/junos-telemetry-interface.groovy"/>

        <package name="JTI-Default">
            <rrd step="300">
                <rra>RRA:AVERAGE:0.5:1:2016</rra>
                <rra>RRA:AVERAGE:0.5:12:1488</rra>
                <rra>RRA:AVERAGE:0.5:288:366</rra>
                <rra>RRA:MAX:0.5:288:366</rra>
                <rra>RRA:MIN:0.5:288:366</rra>
            </rrd>
        </package>
    </adapter>
</queue>

Apply the changes without restarting by sending a reloadDaemonConfig event in the CLI or the Web UI:

Send a reloadDaemonConfig event through CLI
# ${OPENNMS_HOME}/bin/send-event.pl -p 'daemonName Telemetryd' uei.opennms.org/internal/reloadDaemonConfig

By default, this will open a UDP socket bound to 0.0.0.0:50000 to which JTI messages can be forwarded.

Configure JTI listener on a Minion

To enable and configure a UDP listener for JTI on Minion, connect to the Karaf Console and set the following properties:

$ ssh -p 8201 admin@localhost
...
admin@minion()> config:edit --alias udp-50000 --factory org.opennms.features.telemetry.listeners
admin@minion()> config:property-set name JTI
admin@minion()> config:property-set class-name org.opennms.netmgt.telemetry.listeners.UdpListener
admin@minion()> config:property-set parameters.port 50000
admin@minion()> config:property-set parsers.0.name JTI
admin@minion()> config:property-set parsers.0.class-name org.opennms.netmgt.telemetry.protocols.common.parser.ForwardParser
admin@minion()> config:update
The protocol must also be enabled on Horizon for the messages to be processed.

JTI adapter

The JTI adapter handles Junos Telemetry Interface payloads. Messages are decoded using the published protobuf specifications and forwarded to a JSR-223-compatible script (for example, Beanshell or Groovy) for further processing. Use the script extension to extract the desired metrics from the JTI messages and persist the results as time series data.

Facts

Class Name

org.opennms.netmgt.telemetry.protocols.jti.adapter.JtiGpbAdapter

Configuration and use

Table 1. Required adapter-specific parameters for the JtiGpbAdapter
Parameter Description Default

script

Full path to the script used to handle the JTI messages.

none

Scripting

The script will be invoked for every JTI message that is received and successfully decoded.

The following globals will be passed to the script:

Table 2. Globals passed to the script
Parameter Description Type

agent

The agent (node) against which the metrics will be associated.

org.opennms.netmgt.collection.api.CollectionAgent

builder

Builder in which to add the resources and metrics.

org.opennms.netmgt.collection.support.builder.CollectionSetBuilder

msg

Decoded JTI message from which the metrics should be extracted.

org.opennms.netmgt.telemetry.adapters.jti.proto.TelemetryTop

Steps to Increase Log Character Size

By default, the log message size is limited to 500 characters with karaf logs. However, in some cases, such as when viewing detailed proto object logs, you may need to increase the character size to capture the full log details.

Locate file org.ops4j.pax.logging.cfg in the ${OPENNMS_HOME}/etc/ directory.

Locate the log4j2.pattern property in the file. By default, it is set to limit log messages to 500 characters see %encode{%.-500m}

log4j2.pattern = %d{ISO8601} | %-5p | %-16t | %-32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %encode{%.-500m}{CRLF}%n

To increase the character size, modify the %.-500m part of the pattern. For example, to increase the limit to 1000 characters, change it to %.-1000m:

log4j2.pattern = %d{ISO8601} | %-5p | %-16t | %-32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %encode{%.-1000m}{CRLF}%n

Using Karaf Shell

You can also modify the org.ops4j.pax.logging configuration dynamically using the Karaf shell

Log in to the Karaf console in OpenNMS

ssh -p 8101 admin@localhost

Use the config:edit command to start editing the org.ops4j.pax.logging configuration

config:edit org.ops4j.pax.logging

Use the config:property-set command to update the log4j2.pattern property. For example, to increase the log message size to 1000 characters

config:property-set log4j2.pattern '%d{ISO8601} | %-5p | %-16t | %-32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %encode{%.-1000m}{CRLF}%n'
config:update

To verify that the changes have been applied, use the below command:

 config:edit org.ops4j.pax.logging
 config:property-get log4j2.pattern