1snmpa_local_db(3) Erlang Module Definition snmpa_local_db(3)
2
3
4
6 snmpa_local_db - The SNMP built-in database
7
9 The module snmpa_local_db contains functions for implementing tables
10 (and variables) using the SNMP built-in database. The database exists
11 in two instances, one volatile and one persistent. The volatile data‐
12 base is implemented with ets. The persistent database is implemented
13 with dets.
14
15 There is a scaling problem with this database.
16
17 * Insertions and deletions are inefficient for large tables.
18
19 This problem is best solved by using Mnesia instead.
20
21 The following functions describe the interface to snmpa_local_db. Each
22 function has a Mnesia equivalent. The argument NameDb is a tuple {Name,
23 Db} where Name is the symbolic name of the managed object (as defined
24 in the MIB), and Db is either volatile or persistent. mnesia is not
25 possible since all these functions are snmpa_local_db specific.
26
28 In the functions defined below, the following types are used:
29
30 * NameDb = {Name, Db}
31
32 * Name = atom(), Db = volatile | persistent
33
34 * RowIndex = [int()]
35
36 * Cols = [Col] | [{Col, Value}], Col = int(), Value = term()
37
38 where RowIndex denotes the last part of the OID, that specifies the
39 index of the row in the table. Cols is a list of column numbers in case
40 of a get operation, and a list of column numbers and values in case of
41 a set operation.
42
44 dump() -> ok | {error, Reason}
45
46 Types:
47
48 Reason = term()
49
50 This function can be used to manually dump the database to file.
51
52 match(NameDb, Pattern)
53
54 Performs an ets/dets matching on the table. See Stdlib documen‐
55 tation, module ets, for a description of Pattern and the return
56 values.
57
58 print()
59 print(TableName)
60 print(TableName, Db)
61
62 Types:
63
64 TableName = atom()
65
66 Prints the contents of the database on screen. This is useful
67 for debugging since the STANDARD-MIB and OTP-SNMPEA-MIB (and
68 maybe your own MIBs) are stored in snmpa_local_db.
69
70 TableName is an atom for a table in the database. When no name
71 is supplied, the whole database is shown.
72
73 table_create(NameDb) -> bool()
74
75 Creates a table. If the table already exist, the old copy is
76 destroyed.
77
78 Returns false if the NameDb argument is incorrectly specified,
79 true otherwise.
80
81 table_create_row(NameDb, RowIndex, Row) -> bool()
82
83 Types:
84
85 Row = {Val1, Val2, ..., ValN}
86 Val1 = Val2 = ... = ValN = term()
87
88 Creates a row in a table. Row is a tuple with values for all
89 columns, including the index columns.
90
91 table_delete(NameDb) -> void()
92
93 Deletes a table.
94
95 table_delete_row(NameDb, RowIndex) -> bool()
96
97 Deletes the row in the table.
98
99 table_exists(NameDb) -> bool()
100
101 Checks if a table exists.
102
103 table_get_row(NameDb, RowIndex) -> Row | undefined
104
105 Types:
106
107 Row = {Val1, Val2, ..., ValN}
108 Val1 = Val2 = ... = ValN = term()
109
110 Row is a tuple with values for all columns, including the index
111 columns.
112
114 ets(3), dets(3), snmp_generic(3)
115
116
117
118Ericsson AB snmp 5.5 snmpa_local_db(3)