SNMP Input Adapter


The TIBCO StreamBase® SNMP Input Adapter allows a StreamBase application to act as an SNMP manager for receiving SNMP v1 and v2c traps.

The adapter has the following capabilities:

  • Listens for trap notifications sent to the given port number.

  • When such a trap is received, outputs a tuple describing the values contained in the trap.

  • Optionally receives commands from the StreamBase application to connect (start listening) and disconnect (stop listening).

  • Optionally issues status tuples on a dedicated to inform the application of interesting events such as connection and disconnection.

The adapter exposes a set of input and output ports, the fields for which are defined later in this document. In addition, the adapter exposes a set of adapter properties as described in Adapter Properties.

Adapter Properties

Settings are used to control most of the behavior of the adapter. The settings are grouped under several tabs in the Properties view in StreamBase Studio.

In the table in this section, the Property column shows each property name as found in the one or more adapter properties tabs of the Properties view for this adapter.

When using this adapter in a StreamSQL program with the APPLY JAVA statement, you must convert the Studio property names to parameter names using the simple formula described in APPLY Statement. For cases where the Studio property name is not convertible in an obvious way, the StreamSQL parameter name is included in the Description column.

Input Adapter Properties

General Tab

Name: Use this field to specify or change the component's name, which must be unique in the application. The name must contain only alphabetic characters, numbers, and underscores, and no hyphens or other special characters. The first character must be alphabetic or an underscore.

Adapter: A read-only field that shows the formal name of the adapter.

Class: A field that shows the fully qualified class name that implements the functionality of this adapter. Use this class name when loading the adapter in StreamSQL programs with the APPLY JAVA statement. You can right-click this field and select Copy from the context menu to place the full class name in the system clipboard.

Start with application: If this field is set to Yes or to a module parameter that evaluates to true, an instance of this adapter starts as part of the containing StreamBase Server. If this field is set to No or to a module parameter that evaluates to false, the adapter is loaded with the server, but does not start until you send an sbadmin resume command, or until you start the component with StreamBase Manager. With this option set to No or false, the adapter does not start even if the application as a whole is suspended and later resumed. The recommended setting is selected by default.

Enable Error Output Port: Select this check box to add an Error Port to this component. In the EventFlow canvas, the Error Port shows as a red output port, always the last port for the component. See Using Error Ports and Error Streams to learn about Error Ports.

Description: Optionally enter text to briefly describe the component's purpose and function. In the EventFlow canvas, you can see the description by pressing Ctrl while the component's tooltip is displayed.

Adapter Properties Tab

Property Data Type Default Description
UDP port int 162 The port number to use, on which the adapter will listen for incoming traps from SNMP agents.


This setting is required.

(StreamSQL property name: udpPort)

Connect On Startup boolean (check box) true (selected) When selected, the adapter attempts to open the specified UDP port and start listening for incoming traps immediately after starting. If cleared, the adapter remains idle after starting and waits for a Connect command as described in Command Input Port.

(StreamSQL property name: connectOnStartup)

Add Command Input Port boolean (check box) false (cleared) When selected, the adapter adds an input port for the app to issue commands to the adapter, for example to make it start or stop listening for incoming traps. The schema for this port is described in Command Input Port.

(StreamSQL property name: addCommandPort)

Add Status Output Port boolean (check box) false (cleared) When selected, the adapter adds an output port to issue events that may be of interest to the application, for example to inform the app that the adapter has started or stopped listening for incoming traps. The schema for this port is described in Status Output Port Schema.

(StreamSQL property name: addStatusPort)

Log Level drop-down list INFO Controls the level of verbosity the adapter uses to issue informational traces to the console. This setting is independent of the containing application's overall log level. Available values, in increasing order of verbosity, are: OFF, ERROR, WARN, INFO, DEBUG, TRACE, and ALL.

(StreamSQL property name: logLevel)

Concurrency Tab

Use the Concurrency tab to specify parallel regions for this instance of this component, or multiplicity options, or both. The Concurrency tab settings are described in Concurrency Options, and dispatch styles are described in Dispatch Styles.


Concurrency settings are not suitable for every application, and using these settings requires a thorough analysis of your application. For details, see Execution Order and Concurrency, which includes important guidelines for using the concurrency options.

Adapter Ports And Schemas

Input Port Overview

The adapter has at most one input port, depending on its configuration (see Add Command Input Port in Adapter Properties Tab).

Command Input Port

The (optional) Command input port is used to instruct the adapter to perform certain actions, such as connect or disconnect from the UDP port on which it listens for traps.

The schema for the Command Input port is expected to contain the following fields:

Field Name Field Type Field Description
command string Contains the name of the command to execute. This field is required to be non-null for all supported commands. See below for a list of the available commands.
params list(string) All-purpose list of string parameters that may be of use to specify additional information to apply the command. Currently, this field is not used by any of the supported commands and is only here to allow for future expansion.

This field may be left null or empty if no parameters are required or needed.

Available commands include:

  • Connect: Start listening for SNMP traps on the configured UDP port. Required fields:

    • command: Should contain the value Connect. Case is unimportant.

  • Disconnect: Stop listening for SNMP traps. Required fields:

    • command: Should contain the value Disconnect. Case is unimportant.

Output Port Overview

The adapter has at least one output port, and optionally a second one:

  • The first port issues a tuple for each SNMP trap received, and describes its content.

  • The second (optional) port routes status messages, such as connection and disconnection events.

The schema for each output port is described in the following sections:

Traps Output Port Schema

The first output port routes incoming SNMP traps to the StreamBase application.

The schema for this port is pre-set by the adapter, and is described in the following table:

Field Name Field Type Description
requestID int The value of the incoming trap's PDU's request ID field.
type string The type of the incoming trap's PDU:
  • V1TRAP for SNMP v1 traps

  • TRAP for SNMP v2c traps

address string The IP address of the trap's originator. Will only be non-null for SNMP v1 traps.
enterpriseOID string The enterprise OID. Will only be non-null for SNMP v1 traps.
genericTrap int The generic number of this trap. Will only be non-null for SNMP v1 traps.
specificTrap int The specific number of this trap. Will only be non-null for SNMP v1 traps.
uptime timestamp An INTERVAL timestamp representing the trap sender's system uptime. Will only be non-null for SNMP v1 traps.
errorIndex int The error index, if any.
errorStatus string The error status, if any.
variableBindings list(tuple) Contains the list of variable bindings for the trap. Each tuple describes one binding and has the following fields:
^ oid string The binding's OID value.
type string The binding's value's data type.
value string The binding's value.

Status Output Port Schema

The second output port routes Status messages to the StreamBase application, provided the adapter has been configured to expose this optional port (see Add Status Output Port in Adapter Properties Tab).

The schema for this port is pre-set by the adapter, and is described in the following table:

Field Name Field Type Field Description
type string Describes the type of status being emitted. Currently the only value supported is Event.
action string The action that triggered this status tuple. One of:
  • Connected - Connection has been established and the adapter is now listening for incoming traps.

  • Disconnected - Adapter has disconnected from the UDP port and has stopped listening for traps.

info list(string) Contains extra information pertaining to the event. May be null or empty depending on the type of event being described.

Typechecking and Error Handling

The adapter uses typecheck messages to help you configure the adapter in your StreamBase application. In particular, the adapter generates typecheck messages for the following reasons:

  • A required property is missing.

  • One or more required fields in the Command input port is missing or is of the wrong type or size.

Suspend and Resume Behavior

When suspended, the adapter remains connected to the configured UDP port if it was already connected, but all incoming traps are dropped.

When resumed, the adapter starts routing incoming traps to the StreamBase application again.

Related Topics