Creating dynamic traps

A dynamic trap is a trap that is sent by the SQL Anywhere Extension Agent when a simple expression involving the value of a particular property, statistic, or option is true. Dynamic traps are created in the sasnmp.ini file. The format of the trap information in the sasnmp.ini file entry is as follows:

Traptrapnum=[1.3.6.1.4.1.897.2.]oid[.dbnum] op value

trapnum   is the dynamic trap number. It must start at 1 and be sequential.

oid   is the OID of the property, statistic, or option. OIDs in either the SQL Anywhere MIB or the RDBMS MIB are supported. If the OID given is an invalid SQL Anywhere or RDBMS OID, the SQL Anywhere MIB prefix (1.3.6.1.4.1.897.2.) is prepended.

For information about the OIDs in the SQL Anywhere MIB, see SQL Anywhere MIB reference.

For information about the OIDs in the RDBMS MIB, see RDBMS MIB reference.

Note

You can only use OIDs corresponding to database server or database properties, statistics, or options in dynamic traps.

dbnum   is the database number. This field is optional, but if specified, it must match the database number of the [DBn] section of the sasnmp.ini file.

op   must have one of the following values:

  • = or == (equality)

  • !=, <>, or >< (inequality)

  • <= or =< (less than or equal)

  • >= or => (greater than or equal)

  • < (less than)

  • > (greater than)

Note

Only equality or inequality is supported for string values.

value    is the value to use in the expression. String values may be enclosed in single or double quotes; these quotes are not included in the value. If you want the beginning or closing quotation marks to be included in the string, you must double them. Note that single quotes occurring within the string should not be doubled.

When setting dynamic traps, use k, m, g, or t to specify units of kilobytes, megabytes, gigabytes, or terabytes. For example, you can set a dynamic trap to fire if the current cache size exceeds 200 MB by using:

Trap1=1.3.6.1.4.1.897.2.1.1.11.1 > 200M

You can specify as many Trap fields as you want in the sasnmp.ini file. The OID used for the trap is 1.3.6.1.4.1.897.2.4.1, and the data sent with the trap includes the following:

  • the trap number (starts at 1 for the first dynamic trap sent by the SQL Anywhere SNMP agent)

  • the database index

  • the database name trap index (from the sasnmp.ini file)

  • the variable name

  • the variable value (this is the current value of the variable, not necessarily the threshold value)

 Dynamic trap behavior
 Trap examples