net-snmp 3.17.0 → 3.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/launch.json +111 -156
- package/README.md +19 -2
- package/index.js +145 -84
- package/package.json +1 -1
- package/test/TEST-MIB.mib +210 -0
- package/test/mib.test.js +129 -0
- package/test/object-types.test.js +242 -0
- package/test/varbinds.test.js +53 -0
- package/test/objects.js +0 -238
- package/test/varbinds.js +0 -49
package/.vscode/launch.json
CHANGED
@@ -3,40 +3,37 @@
|
|
3
3
|
// Hover to view descriptions of existing attributes.
|
4
4
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
5
5
|
"version": "0.2.0",
|
6
|
-
"configurations": [
|
6
|
+
"configurations": [
|
7
7
|
{
|
8
8
|
"type": "node",
|
9
9
|
"request": "launch",
|
10
10
|
"name": "SNMP community get",
|
11
|
-
"skipFiles": [
|
12
|
-
"<node_internals>/**"
|
13
|
-
],
|
11
|
+
"skipFiles": ["<node_internals>/**"],
|
14
12
|
"program": "${workspaceFolder}/example/snmp-get.js",
|
15
|
-
"args": [
|
16
|
-
"-v", "2c",
|
17
|
-
"-c", "public",
|
18
|
-
"-s", "1162",
|
19
|
-
"127.0.0.1",
|
20
|
-
"1.3.6.1.2.1.31.1.1.1.6.1"
|
21
|
-
]
|
13
|
+
"args": ["-v", "2c", "-c", "public", "-s", "1162", "127.0.0.1", "1.3.6.1.2.1.31.1.1.1.6.1"]
|
22
14
|
},
|
23
15
|
{
|
24
16
|
"type": "node",
|
25
17
|
"request": "launch",
|
26
18
|
"name": "SNMP user get",
|
27
|
-
"skipFiles": [
|
28
|
-
"<node_internals>/**"
|
29
|
-
],
|
19
|
+
"skipFiles": ["<node_internals>/**"],
|
30
20
|
"program": "${workspaceFolder}/example/snmp-get.js",
|
31
21
|
"args": [
|
32
22
|
"-d",
|
33
|
-
"-v",
|
34
|
-
"
|
35
|
-
"-
|
36
|
-
"
|
37
|
-
"-
|
38
|
-
"
|
39
|
-
"-
|
23
|
+
"-v",
|
24
|
+
"3",
|
25
|
+
"-l",
|
26
|
+
"authPriv",
|
27
|
+
"-u",
|
28
|
+
"wilma",
|
29
|
+
"-a",
|
30
|
+
"sha",
|
31
|
+
"-A",
|
32
|
+
"illhavesomeauth",
|
33
|
+
"-x",
|
34
|
+
"des",
|
35
|
+
"-X",
|
36
|
+
"andsomepriv",
|
40
37
|
"127.0.0.1",
|
41
38
|
"1.3.6.1.2.1.1.1.0"
|
42
39
|
]
|
@@ -45,115 +42,73 @@
|
|
45
42
|
"type": "node",
|
46
43
|
"request": "launch",
|
47
44
|
"name": "SNMP community get bulk",
|
48
|
-
"skipFiles": [
|
49
|
-
"<node_internals>/**"
|
50
|
-
],
|
45
|
+
"skipFiles": ["<node_internals>/**"],
|
51
46
|
"program": "${workspaceFolder}/example/snmp-get-bulk.js",
|
52
|
-
"args": [
|
53
|
-
"-v", "2c",
|
54
|
-
"-c", "public",
|
55
|
-
"-o", "1",
|
56
|
-
"-r", "20",
|
57
|
-
"127.0.0.1",
|
58
|
-
"1.3.6.1.2.1.1.9",
|
59
|
-
"1.3.6.1.2.1.2"
|
60
|
-
]
|
47
|
+
"args": ["-v", "2c", "-c", "public", "-o", "1", "-r", "20", "127.0.0.1", "1.3.6.1.2.1.1.9", "1.3.6.1.2.1.2"]
|
61
48
|
},
|
62
49
|
{
|
63
50
|
"type": "node",
|
64
51
|
"request": "launch",
|
65
52
|
"name": "SNMP community subtree",
|
66
|
-
"skipFiles": [
|
67
|
-
"<node_internals>/**"
|
68
|
-
],
|
53
|
+
"skipFiles": ["<node_internals>/**"],
|
69
54
|
"program": "${workspaceFolder}/example/snmp-subtree.js",
|
70
|
-
"args": [
|
71
|
-
"-v", "2c",
|
72
|
-
"-c", "public",
|
73
|
-
"127.0.0.1",
|
74
|
-
"1.3.6.1.6.3.16.1.5.2.1.6.9"
|
75
|
-
]
|
55
|
+
"args": ["-v", "2c", "-c", "public", "127.0.0.1", "1.3.6.1.6.3.16.1.5.2.1.6.9"]
|
76
56
|
},
|
77
57
|
{
|
78
58
|
"type": "node",
|
79
59
|
"request": "launch",
|
80
60
|
"name": "SNMP community walk",
|
81
|
-
"skipFiles": [
|
82
|
-
"<node_internals>/**"
|
83
|
-
],
|
61
|
+
"skipFiles": ["<node_internals>/**"],
|
84
62
|
"program": "${workspaceFolder}/example/snmp-walk.js",
|
85
|
-
"args": [
|
86
|
-
"-v", "2c",
|
87
|
-
"-c", "public",
|
88
|
-
"127.0.0.1",
|
89
|
-
"1.3.6.1.6.3.16.1.5.2.1.6.9"
|
90
|
-
]
|
63
|
+
"args": ["-v", "2c", "-c", "public", "127.0.0.1", "1.3.6.1.6.3.16.1.5.2.1.6.9"]
|
91
64
|
},
|
92
65
|
{
|
93
66
|
"type": "node",
|
94
67
|
"request": "launch",
|
95
68
|
"name": "SNMP user walk",
|
96
|
-
"skipFiles": [
|
97
|
-
"<node_internals>/**"
|
98
|
-
],
|
69
|
+
"skipFiles": ["<node_internals>/**"],
|
99
70
|
"program": "${workspaceFolder}/example/snmp-walk.js",
|
100
|
-
"args": [
|
101
|
-
"-v", "3",
|
102
|
-
"-u", "noauth",
|
103
|
-
"-l", "noAuthNoPriv",
|
104
|
-
"127.0.0.1",
|
105
|
-
"1.3.6.1.6.3.16.1.5"
|
106
|
-
]
|
71
|
+
"args": ["-v", "3", "-u", "noauth", "-l", "noAuthNoPriv", "127.0.0.1", "1.3.6.1.6.3.16.1.5"]
|
107
72
|
},
|
108
73
|
{
|
109
74
|
"type": "node",
|
110
75
|
"request": "launch",
|
111
76
|
"name": "SNMP community set",
|
112
|
-
"skipFiles": [
|
113
|
-
"<node_internals>/**"
|
114
|
-
],
|
77
|
+
"skipFiles": ["<node_internals>/**"],
|
115
78
|
"program": "${workspaceFolder}/example/snmp-set.js",
|
116
|
-
"args": [
|
117
|
-
"-v", "2c",
|
118
|
-
"-c", "private",
|
119
|
-
"127.0.0.1",
|
120
|
-
"1.3.6.1.2.1.1.7.0",
|
121
|
-
"Integer",
|
122
|
-
"40"
|
123
|
-
]
|
79
|
+
"args": ["-v", "2c", "-c", "private", "127.0.0.1", "1.3.6.1.2.1.1.7.0", "Integer", "40"]
|
124
80
|
},
|
125
81
|
{
|
126
82
|
"type": "node",
|
127
83
|
"request": "launch",
|
128
84
|
"name": "SNMP community trap",
|
129
|
-
"skipFiles": [
|
130
|
-
"<node_internals>/**"
|
131
|
-
],
|
85
|
+
"skipFiles": ["<node_internals>/**"],
|
132
86
|
"program": "${workspaceFolder}/example/snmp-trap.js",
|
133
|
-
"args": [
|
134
|
-
"-v", "2c",
|
135
|
-
"-c", "public",
|
136
|
-
"127.0.0.1",
|
137
|
-
"1.3.6.1.6.3.1.1.5.1"
|
138
|
-
]
|
87
|
+
"args": ["-v", "2c", "-c", "public", "127.0.0.1", "1.3.6.1.6.3.1.1.5.1"]
|
139
88
|
},
|
140
89
|
{
|
141
90
|
"type": "node",
|
142
91
|
"request": "launch",
|
143
92
|
"name": "SNMP user trap",
|
144
|
-
"skipFiles": [
|
145
|
-
"<node_internals>/**"
|
146
|
-
],
|
93
|
+
"skipFiles": ["<node_internals>/**"],
|
147
94
|
"program": "${workspaceFolder}/example/snmp-trap.js",
|
148
95
|
"args": [
|
149
|
-
"-e",
|
150
|
-
"
|
151
|
-
"-
|
152
|
-
"
|
153
|
-
"-
|
154
|
-
"
|
155
|
-
"-
|
156
|
-
"
|
96
|
+
"-e",
|
97
|
+
"0x010203040a",
|
98
|
+
"-v",
|
99
|
+
"3",
|
100
|
+
"-u",
|
101
|
+
"barney",
|
102
|
+
"-l",
|
103
|
+
"authPriv",
|
104
|
+
"-a",
|
105
|
+
"sha",
|
106
|
+
"-A",
|
107
|
+
"illhavesomeauth",
|
108
|
+
"-x",
|
109
|
+
"aes",
|
110
|
+
"-X",
|
111
|
+
"andsomepriv",
|
157
112
|
"127.0.0.1",
|
158
113
|
"1.3.6.1.6.3.1.1.5.1"
|
159
114
|
]
|
@@ -162,18 +117,23 @@
|
|
162
117
|
"type": "node",
|
163
118
|
"request": "launch",
|
164
119
|
"name": "SNMP user inform",
|
165
|
-
"skipFiles": [
|
166
|
-
"<node_internals>/**"
|
167
|
-
],
|
120
|
+
"skipFiles": ["<node_internals>/**"],
|
168
121
|
"program": "${workspaceFolder}/example/snmp-inform.js",
|
169
122
|
"args": [
|
170
|
-
"-v",
|
171
|
-
"
|
172
|
-
"-
|
173
|
-
"
|
174
|
-
"-
|
175
|
-
"
|
176
|
-
"-
|
123
|
+
"-v",
|
124
|
+
"3",
|
125
|
+
"-u",
|
126
|
+
"informerpriv",
|
127
|
+
"-l",
|
128
|
+
"authPriv",
|
129
|
+
"-a",
|
130
|
+
"md5",
|
131
|
+
"-A",
|
132
|
+
"testing123",
|
133
|
+
"-x",
|
134
|
+
"des",
|
135
|
+
"-X",
|
136
|
+
"testing123",
|
177
137
|
"127.0.0.1",
|
178
138
|
"1.3.6.1.6.3.1.1.5.1"
|
179
139
|
]
|
@@ -182,113 +142,108 @@
|
|
182
142
|
"type": "node",
|
183
143
|
"request": "launch",
|
184
144
|
"name": "SNMP user table columns",
|
185
|
-
"skipFiles": [
|
186
|
-
"<node_internals>/**"
|
187
|
-
],
|
145
|
+
"skipFiles": ["<node_internals>/**"],
|
188
146
|
"program": "${workspaceFolder}/example/snmp-table-columns.js",
|
189
147
|
"args": [
|
190
|
-
"-v",
|
191
|
-
"
|
192
|
-
"-
|
193
|
-
"
|
194
|
-
"-
|
195
|
-
"
|
196
|
-
"-
|
148
|
+
"-v",
|
149
|
+
"3",
|
150
|
+
"-u",
|
151
|
+
"wilma",
|
152
|
+
"-l",
|
153
|
+
"authPriv",
|
154
|
+
"-a",
|
155
|
+
"sha",
|
156
|
+
"-A",
|
157
|
+
"illhavesomeauth",
|
158
|
+
"-x",
|
159
|
+
"des",
|
160
|
+
"-X",
|
161
|
+
"andsomepriv",
|
197
162
|
"127.0.0.1",
|
198
|
-
"1.3.6.1.2.1.2.2",
|
163
|
+
"1.3.6.1.2.1.2.2",
|
164
|
+
"2"
|
199
165
|
]
|
200
166
|
},
|
201
167
|
{
|
202
168
|
"type": "node",
|
203
169
|
"request": "launch",
|
204
170
|
"name": "SNMP receiver",
|
205
|
-
"skipFiles": [
|
206
|
-
"<node_internals>/**"
|
207
|
-
],
|
171
|
+
"skipFiles": ["<node_internals>/**"],
|
208
172
|
"program": "${workspaceFolder}/example/snmp-receiver.js",
|
209
|
-
"args": [
|
210
|
-
"-p", "162"
|
211
|
-
]
|
173
|
+
"args": ["-p", "162"]
|
212
174
|
},
|
213
175
|
{
|
214
176
|
"type": "node",
|
215
177
|
"request": "launch",
|
216
178
|
"name": "Receiver LCD",
|
217
|
-
"skipFiles": [
|
218
|
-
|
219
|
-
],
|
220
|
-
"program": "${workspaceFolder}/example/receiver-lcd.js",
|
179
|
+
"skipFiles": ["<node_internals>/**"],
|
180
|
+
"program": "${workspaceFolder}/example/receiver-lcd.js"
|
221
181
|
},
|
222
182
|
{
|
223
183
|
"type": "node",
|
224
184
|
"request": "launch",
|
225
185
|
"name": "AgentX subagent",
|
226
|
-
"skipFiles": [
|
227
|
-
"<node_internals>/**"
|
228
|
-
],
|
186
|
+
"skipFiles": ["<node_internals>/**"],
|
229
187
|
"program": "${workspaceFolder}/example/agentx-subagent.js",
|
230
|
-
"args": [
|
231
|
-
"-d"
|
232
|
-
]
|
188
|
+
"args": ["-d"]
|
233
189
|
},
|
234
190
|
{
|
235
191
|
"type": "node",
|
236
192
|
"request": "launch",
|
237
193
|
"name": "SNMP agent",
|
238
|
-
"skipFiles": [
|
239
|
-
"<node_internals>/**"
|
240
|
-
],
|
194
|
+
"skipFiles": ["<node_internals>/**"],
|
241
195
|
"program": "${workspaceFolder}/example/snmp-agent.js",
|
242
196
|
"args": [
|
243
197
|
//"-d",
|
244
|
-
"-p",
|
198
|
+
"-p",
|
199
|
+
"1161"
|
245
200
|
]
|
246
201
|
},
|
247
202
|
{
|
248
203
|
"type": "node",
|
249
204
|
"request": "launch",
|
250
205
|
"name": "MIB parser",
|
251
|
-
"skipFiles": [
|
252
|
-
"<node_internals>/**"
|
253
|
-
],
|
206
|
+
"skipFiles": ["<node_internals>/**"],
|
254
207
|
"program": "${workspaceFolder}/example/mib-parser.js",
|
255
|
-
"args": [
|
256
|
-
"-n",
|
257
|
-
"-p", "1161"
|
258
|
-
]
|
208
|
+
"args": ["-n", "-p", "1161"]
|
259
209
|
},
|
260
210
|
{
|
261
211
|
"type": "node",
|
262
212
|
"request": "launch",
|
263
213
|
"name": "SNMP proxy",
|
264
|
-
"skipFiles": [
|
265
|
-
"<node_internals>/**"
|
266
|
-
],
|
214
|
+
"skipFiles": ["<node_internals>/**"],
|
267
215
|
"program": "${workspaceFolder}/example/snmp-proxy.js",
|
268
|
-
"args": [
|
269
|
-
"-p", "1161"
|
270
|
-
]
|
216
|
+
"args": ["-p", "1161"]
|
271
217
|
},
|
272
218
|
{
|
273
219
|
"type": "node",
|
274
220
|
"request": "launch",
|
275
221
|
"name": "test",
|
276
|
-
"skipFiles": [
|
277
|
-
"<node_internals>/**"
|
278
|
-
],
|
222
|
+
"skipFiles": ["<node_internals>/**"],
|
279
223
|
"program": "${workspaceFolder}/example/test.js",
|
280
|
-
"args": [
|
281
|
-
"-p", "1161"
|
282
|
-
]
|
224
|
+
"args": ["-p", "1161"]
|
283
225
|
},
|
284
226
|
{
|
285
227
|
"type": "node",
|
286
228
|
"request": "attach",
|
287
229
|
"name": "SNMP attach",
|
288
230
|
"port": 9222,
|
289
|
-
"skipFiles": [
|
290
|
-
|
291
|
-
|
231
|
+
"skipFiles": ["<node_internals>/**"]
|
232
|
+
},
|
233
|
+
{
|
234
|
+
"type": "node",
|
235
|
+
"request": "launch",
|
236
|
+
"name": "Mocha",
|
237
|
+
"program": "${workspaceFolder}/node_modules/mocha/bin/mocha.js",
|
238
|
+
"args": [
|
239
|
+
"--timeout",
|
240
|
+
"999999",
|
241
|
+
"--colors",
|
242
|
+
"${workspaceFolder}/test/**/*.test.js" // Adjust the test file pattern
|
243
|
+
],
|
244
|
+
"internalConsoleOptions": "openOnSessionStart",
|
245
|
+
"cwd": "${workspaceFolder}",
|
246
|
+
"skipFiles": ["<node_internals>/**"]
|
292
247
|
}
|
293
248
|
]
|
294
|
-
}
|
249
|
+
}
|
package/README.md
CHANGED
@@ -1598,7 +1598,8 @@ var options = {
|
|
1598
1598
|
accessControlModelType: snmp.AccessControlModelType.None,
|
1599
1599
|
engineID: "8000B98380XXXXXXXXXXXXXXXXXXXXXXXX", // where the X's are random hex digits
|
1600
1600
|
address: null,
|
1601
|
-
transport: "udp4"
|
1601
|
+
transport: "udp4",
|
1602
|
+
mibOptions: {}
|
1602
1603
|
};
|
1603
1604
|
|
1604
1605
|
var callback = function (error, data) {
|
@@ -1634,6 +1635,8 @@ an object, possibly empty, and can contain the following fields:
|
|
1634
1635
|
* `sockets` - an array of objects containing triples of `transport`, `address` and `port` that
|
1635
1636
|
can be used to specify multiple socket listeners. This option overrides any individual
|
1636
1637
|
`transport`, `address` and `port` options.
|
1638
|
+
* `mibOptions` - an MIB options object that is passed to the `Mib` instance - see the MIB section
|
1639
|
+
for further details on this - defaults to the empty object.
|
1637
1640
|
|
1638
1641
|
The `mib` parameter is optional, and sets the agent's singleton `Mib` instance.
|
1639
1642
|
If not supplied, the agent creates itself a new empty `Mib` singleton. If supplied,
|
@@ -2055,7 +2058,7 @@ constraints: {
|
|
2055
2058
|
]
|
2056
2059
|
}
|
2057
2060
|
```
|
2058
|
-
## snmp.createMib ()
|
2061
|
+
## snmp.createMib (options)
|
2059
2062
|
|
2060
2063
|
The `createMib()` function instantiates and returns an instance of the
|
2061
2064
|
`Mib` class. The new Mib does not have any nodes (except for a single
|
@@ -2069,6 +2072,12 @@ might be useful are:
|
|
2069
2072
|
before creating the `Agent` instance itself.
|
2070
2073
|
* where you want to swap out an agent's existing `Mib` instance for an entirely new one.
|
2071
2074
|
|
2075
|
+
The `options` object is optional. If supplied, a single key is supported:
|
2076
|
+
* `addScalarDefaultsOnRegistration` - if `true`, automatically adds to the MIB a scalar with a
|
2077
|
+
default value (`defVal`) in its provider definition upon registration of the provider.
|
2078
|
+
The default value is `false`, which means the MIB is unchanged on registration of the provider,
|
2079
|
+
even if a `defVal` is present in the provider definition.
|
2080
|
+
|
2072
2081
|
## mib.registerProvider (definition)
|
2073
2082
|
|
2074
2083
|
Registers a provider definition with the MIB. Doesn't add anything to the MIB tree.
|
@@ -3440,6 +3449,14 @@ Example programs are included under the module's `example` directory.
|
|
3440
3449
|
|
3441
3450
|
* Relax validation of unknown object types
|
3442
3451
|
|
3452
|
+
## Version 3.18.0 - 06/01/2025
|
3453
|
+
|
3454
|
+
* Add MIB option to add scalar MIB object on scalar provider registration
|
3455
|
+
|
3456
|
+
## Version 3.18.1 - 06/01/2025
|
3457
|
+
|
3458
|
+
* Add agent option key for MIB options
|
3459
|
+
|
3443
3460
|
# License
|
3444
3461
|
|
3445
3462
|
Copyright (c) 2020 Mark Abrahams <mark@abrahams.co.nz>
|