[Ericsson AB]

log_snmp

MODULE

log_snmp

MODULE SUMMARY

Implements an SNMP interface to the log service in the EVA application

DESCRIPTION

This module implements an SNMP interface to the log service in the EVA application. The MIB implemented by this adaptation is OTP-LOG-MIB. The MIB is located in the directory mibs in the distribution.

EXPORTS

create_tables(Nodes) -> void()

Types:

Nodes = [node()]

This function creates the Mnesia tables required by the log SNMP implementation. Nodes is a list of nodes where the tables should be replicated. This list of nodes should specify the same nodes where the application EVA can be run distributed, in order for the log server to always have local access to the tables.

This function should be called once when installing the EVA application in the system.

register_type(Type,TypeOid,TypeFunc)

Types:

Type = term()
TypeOid = oid() = [int()]
TypeFunc = {M,F,A}
M = F = atom()
A = list()

This function is used to register a type of log to the SNMP log functionality. The Type is the same as the Type argument given to log:open/3.

The purpose of this function is to tell the SNMP LOG functions that all logs of type Type have an SNMP type defined in some MIB (TypeOid, defined as an OBJECT IDENTITY), and that the TypeFunc should be used to control creation and transfer of logs of this type.

The type control function (TypeFunc) will be called when a manger tries to create or delete a log of type TypeOid, or when he tries to transfer a log of this type. The purpose of this function is to check if creation is possible, and to format the log when it is transferred. The function should be defined as:

M:F(validate_creation, LogIndex, Cols | A) -> true | false | {SnmpErr, Col}
Called when the manager tries to create a new log of type TypeOid. It is supposed to check if it is possible to create a new log of this type. If it is, it should return true. If it is never possible to create logs of this type, it should return false. Otherwise, the creation is not possible becasue some resource is not available, and the function should return {SnmpError, Col} (see definition of SNMP instrumenetation functions for a description of this).
M:F(create, Log | A) -> ok | error
Called when M:F(validate_creation, ...) returned true. This function is supposed to create the log. Log is a #log record, defined in log.hrl.
M:F(delete, Log | A) -> void()
Called when a log previously created by a manager is deleted.
M:F(search, LogIndex, LogTrIndex | A) -> SearchFunc
Called when the manager activates a log transfer for a log of this type. The LogIndex is the index into logTable, and {LogIndex, LogTrIndex} is the index into the logTransferTable. This function is supposed to return a search function as specified in log:transfer/5. The records for these tables are defined in include/log_snmp.hrl.

start_link() -> {ok, Pid} | {error, Reason}

Starts the LOG SNMP implementation. This function can be used to include the service in a supervisor. Normally, functions in the supervisor log_sup can be used instead.

The function create_tables/1 must have been called before the server is started.

Instrumentation functions for the OTP-LOG-MIB

In some cases other adaptations may need access to the SNMP specific data in LOG. To do this, the instrumentation functions for the SNMP objects can be used. These instrumentation functions takes the arguments and return the values defined in the application snmp.

EXPORTS

log_table(Op, RowIndex, Cols) -> InstrumRet

Instrumentation function for logTable. This function assumes that access checks are made according to the MIB, so it may crash if e.g. logOperStatus is set.

log_tr_table(Op, RowIndex, Cols) -> InstrumRet

Instrumentation function for logTransferTable. This function assumes that access checks are made according to the MIB.

AUTHORS

Martin Björklund - support@erlang.ericsson.se

eva 2.0.4
Copyright © 1991-2006 Ericsson AB