Download Simple Network Management Protocol (SNMP)
Transcript
snmp generic SNMP Reference Manual NewVal = term() Sets a new value to a variable. The variable is created if it does not exist. No checks are made on the type of the new value. Returns false if the NameDb argument is incorrectly specified, otherwise true. Example The following example shows an implementation of a table which is stored in Mnesia, but with some checks performed at set-request operations. myTable func(new, NameDb) -> % pass unchanged snmp generic:table func(new, NameDb). % pass unchanged myTable func(delete, NameDb) -> snmp generic:table func(delete, NameDb). %% change row myTable func(is set ok, RowIndex, Cols, NameDb) -> case snmp generic:table func(is set ok, RowIndex, Cols, NameDb) of fnoError, 0g -> myApplication:is set ok(RowIndex, Cols); Err -> Err end; myTable func(set, RowIndex, Cols, NameDb) -> case snmp generic:table func(set, RowIndex, Cols, NameDb), fnoError, 0g -> % Now the row is updated, tell the application myApplication:update(RowIndex, Cols); Err -> Err end; myTable func(Op, RowIndex, Cols, NameDb) -> % pass unchanged snmp generic:table func(Op, RowIndex, Cols, NameDb). The .funcs file would look like: fmyTable, fmyModule, myTable func, [fmyTable, mnesiag]gg. 120 Simple Network Management Protocol (SNMP)