You may find it useful (or perhaps necessary) to have your SMUX
peer generate traps based on the occurrence of certain types of events,
such as specific errors.
Implementing these enterpriseSpecific traps will involve the following steps:
Define the required enterpriseSpecific traps.
Make sure that all objects appearing in the VarBindList have
been defined in the peer's MIB module. If they haven't been,
you will have to define them there now.
Write code that constructs a VarBindList and then issues
a trap message.
Now consider this example, in which foosmuxd could be modified
to generate a trap when a serial line ``dies'':
First, the file smuxpeer.h must be edited to #define this
#define LINE_DEATH_ERROR_TRAP 1
When a serial line death occurs, this example trap will convey the board
status and serial line number. Both of these values are already
defined in the foo MIB under the object names boardStatus
so no further modification of the
foo MIB module is necessary.
The following code should be put in the code path that is executed whenever
the serial line dies:
Declare the variables used in constructing the trap message. In this example
there are 2 VarBinds in the VarBind list, so the array size is set
The statements below build the boardStatus VarBind.
boardStatus is a single instance object, so its object name is
appended with 0. The value of board status is held in the
global variable boardStatus.
mibvar_oid_ptr = text2oid("boardStatus.0");
trap_varbindlist = make_varbind(mibvar_oid_ptr, INTEGER_TYPE,
0, (long) boardStatus, NULL, (OID) 0);
The statements below build the serialLineNumber VarBind and
link it with the first VarBind; together, these 2 VarBinds make the
VarBindList for this trap. In this example the serial line number is
a multiple instance object so its object name is appended with the
table index, which is the line number 2:
mibvar_oid_ptr = text2oid("serialLineNumber.2");
trap_varbindlist->next = make_varbind(mibvar_oid_ptr,
INTEGER_TYPE, 0, (long) 2, NULL, (OID) 0);
Finally, the statement below builds the trap message and forwards it
to the agent. The agent then sends the trap message to the management
if (smux_trap(trap_enterpriseSpecific, LINE_DEATH_ERROR_TRAP,
(struct type_SNMP_VarBindList) trap_varbindlist) == NOTOK)
LIB_ERROR2("smux_trap: %s [%s]", smux_error(smux_error),
Writing set functions
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003