File: snmpa_local_db.3

package info (click to toggle)
erlang-manpages 1%3A12.b.3-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 4,188 kB
  • ctags: 2
  • sloc: makefile: 68; perl: 30; sh: 15
file content (151 lines) | stat: -rw-r--r-- 3,485 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
.TH snmpa_local_db 3 "snmp  4.11" "Ericsson AB" "ERLANG MODULE DEFINITION"
.SH MODULE
snmpa_local_db \- The SNMP built-in database
.SH DESCRIPTION
.LP
The module \fIsnmpa_local_db\fR contains functions for implementing tables (and variables) using the SNMP built-in database\&. The database exists in two instances, one volatile and one persistent\&. The volatile database is implemented with ets\&. The persistent database is implemented with dets\&. 
.LP
There is a scaling problem with this database\&. 
.RS 2
.TP 2
*
Insertions and deletions are inefficient for large tables\&.
.RE
.LP
This problem is best solved by using Mnesia instead\&. 
.LP
The following functions describe the interface to \fIsnmpa_local_db\fR\&. Each function has a Mnesia equivalent\&. The argument \fINameDb\fR is a tuple \fI{Name, Db}\fR where \fIName\fR is the symbolic name of the managed object (as defined in the MIB), and \fIDb\fR is either \fIvolatile\fR or \fIpersistent\fR\&. \fImnesia\fR is not possible since all these functions are \fIsnmpa_local_db\fR specific\&. 

.SH COMMON DATA TYPES
.LP
In the functions defined below, the following types are used: 
.RS 2
.TP 2
*
\fINameDb = {Name, Db}\fR
.TP 2
*
\fIName = atom(), Db = volatile | persistent\fR
.TP 2
*
\fIRowIndex = [int()]\fR
.TP 2
*
\fICols = [Col] | [{Col, Value}], Col = int(), Value = term()\fR
.RE
.LP
where \fIRowIndex\fR denotes the last part of the OID, that specifies the index of the row in the table\&. \fICols\fR is a list of column numbers in case of a get operation, and a list of column numbers and values in case of a set operation\&. 
.SH EXPORTS
.LP
.B
dump() -> ok | {error, Reason}
.br
.RS
.TP
Types
Reason = term()
.br
.RE
.RS
.LP
This function can be used to manually dump the database to file\&.
.RE
.LP
.B
match(NameDb, Pattern)
.br
.RS
.LP
Performs an ets/dets matching on the table\&. See Stdlib documentation, module ets, for a description of \fIPattern\fR and the return values\&.
.RE
.LP
.B
print()
.br
.B
print(TableName)
.br
.B
print(TableName, Db)
.br
.RS
.TP
Types
TableName = atom()
.br
.RE
.RS
.LP
Prints the contents of the database on screen\&. This is useful for debugging since the \fISTANDARD-MIB\fR and \fIOTP-SNMPEA-MIB\fR (and maybe your own MIBs) are stored in \fIsnmpa_local_db\fR\&. 
.LP
\fITableName\fR is an atom for a table in the database\&. When no name is supplied, the whole database is shown\&.
.RE
.LP
.B
table_create(NameDb) -> bool()
.br
.RS
.LP
Creates a table\&. If the table already exist, the old copy is destroyed\&. 
.LP
Returns \fIfalse\fR if the \fINameDb\fR argument is incorrectly specified, \fItrue\fR otherwise\&.
.RE
.LP
.B
table_create_row(NameDb, RowIndex, Row) -> bool()
.br
.RS
.TP
Types
Row = {Val1, Val2, \&.\&.\&., ValN}
.br
Val1 = Val2 = \&.\&.\&. = ValN = term()
.br
.RE
.RS
.LP
Creates a row in a table\&. \fIRow\fR is a tuple with values for all columns, including the index columns\&.
.RE
.LP
.B
table_delete(NameDb) -> void()
.br
.RS
.LP
Deletes a table\&.
.RE
.LP
.B
table_delete_row(NameDb, RowIndex) -> bool()
.br
.RS
.LP
Deletes the row in the table\&.
.RE
.LP
.B
table_exists(NameDb) -> bool()
.br
.RS
.LP
Checks if a table exists\&.
.RE
.LP
.B
table_get_row(NameDb, RowIndex) -> Row | undefined
.br
.RS
.TP
Types
Row = {Val1, Val2, \&.\&.\&., ValN}
.br
Val1 = Val2 = \&.\&.\&. = ValN = term()
.br
.RE
.RS
.LP
\fIRow\fR is a tuple with values for all columns, including the index columns\&.
.RE
.SH SEE ALSO
.LP
ets(3), dets(3), snmp_generic(3)