Using the Adaptive Server SNMP Agent Plug-in

The Sybase Adaptive Server MIB defines the sybRaiseError error trap. This trap can be generated from a stored procedure:

create procedure snmpSybRaiseError
@errno int,
@severity int,
@state int,
@spid int,
@engine int,
@msg varchar(255) as
declare @user varchar(255)

begin
   select @user = suser_name()
   exec MYHOST_UAF...uaf_invoke_plugin_operation 
"com.sybase.ase.snmp",î2.0.0",1,
      "sybRaiseError",@@servername,@errno,@severity,
@state,@user,@spid,@engine,@msg
end

The stored procedure takes a set of arguments and calls the Adaptive Server SNMP Agent Plug-into generate the SNMP notification. The call to this stored procedure follows this format:

$ isql -Usa -P -Smyserver

1> exec snmpSybRaiseError 1,2,3,4,5,"Hello SNMP World"
sybRaiseError
-------------
1

For example:

exec snmpSybRaiseError 1,2,3,4,5,"Hello SNMP World"
sybRaiseError
-------------
1

The stored procedure returns the SNMP table index:

(0 rows affected) (return status = 0)