SNMP functions

Zorka provides SNMP library which currently only provides support for sending SNMP traps. SNMP agent functionality is not yet implemented albeit it is planned for the future.


snmp.trapper(id, snmpAddr, community, agentAddr)
snmp.trapper(id, snmpAddr, community, agentAddr, protocol)

Returns (and eventually creates) SNMP trapper object. Newly created SNMP trappers are registered in snmp library and will be returned every time trapper() method with the same id will be called. Parameters:

  • id - arbitrary string that will identify trapper; must be unique in snmp library;

  • snmpAddr - address of SNMP server (and optionally port in addr:port form);

  • community - community ID (as configured in SNMP server);

  • agentAddr - (advertised) agent IP address;

  • protocol - SNMP protocol version: snmp.SNMP_V1 and snmp.SNMP_V2 are currently supported;

Each created trapper will have its own UDP port and its own thread. Last function removes and stops trapper identified by id.


snmp.val(type, value)

Converts java object into SNMP typed object. The following SNMP types are valid: snmp.INTEGER, snmp.BITSTRING, snmp.OCTETSTRING, snmp.NULL, snmp.OID, snmp.SEQUENCE, snmp.IPADDRESS, snmp.COUNTER32, snmp.GAUGE32, snmp.TIMETICKS, snmp.NSAPADDRESS, snmp.COUNTER64, snmp.UINTEGER32.


snmp.oid(template, vals)

Creates an SNMP OID object. Template is an OID string with optional placeholders in standard ${...} form. Parameters passed as vals are used to fill placeholders.


snmp.bind(slot, type, oidSuffix)

Creates spy record to trap variable binding object. It will map object from slot in ON_COLLECT buffer of spy record to a SNMP object of type tagged with oidSuffix. OID suffix will be added to base OID in traps sent by SnmpCollector component of Zorka Spy. See sdef.toSnmp() description below for more information about bindings.

Data normalization functions

There are cases when intercepted data has to be normalized in some way. Removing data from intercepted SQL queries is one example but there are many types of data that should be stripped or simplified in some way. Data normalization framework functions are available via normalizers library. Objects created with those functions can be attached to spy processing chains using normalize() method of spy definition objects.

There are several predefined normalization modes, passed to normalizer constructors as flags parameter:

  • normalizers.NORM_MIN - minimal normalizer (cut off white spaces and illegal tokens, normalize white spaces, symbols and keywords, leave values (literals) unchanged (and visible);

  • normalizers.NORM_STD - everything NORM_MIN does plus remove literals and replace them with ? placeholders.