Wiki source code of SNMP4J-CLT-Usage

Last modified by Frank Fock on 2024/05/25 10:51

Hide last authors
Frank Fock 21.1 1 === SNMP4J Command-Line Tool, version 3.5.x ===
Admin 19.1 2
3 Type
4
5 {{code}}
6 java -SNMP4J-CLT.jar help <command>
7 {{/code}}
8
9 for help on a specific command.
10 Type
11
12 {{code}}
13 java -jar SNMP4J-CLT.jar example <command>
14 {{/code}}
15
16 for examples on a specific command.
17 Type
18
19 {{code}}
20 java -jar SNMP4J-CLT.jar version
21 {{/code}}
22
23 to see the program version.
24 Type
25
26 {{code}}
27 java -jar SNMP4J-CLT.jar -L "<license>" "<key>" defaults list
28 {{/code}}
29
30 to register your license //(you then do not need to enter it for subsequent commands)//.
31
32 Most commands take agent address and OID list arguments. A list of the
33 available options for each command is listed after the command description.
34 The description of all options follows the command list.
35
36 Standard parameter formats are:
37
38 **<OID>**:
39
40 1. An object identifier is either a dotted notation like '1.3.6.1.2.2.1.0'.
41 1. An object name with dotted numeric suffix like 'IF-MIB:ifDescr.0' or 'sysName' (requires MIB information).
42 1. An columnar OBJECT-TYPE name with formatted index, e.g. vacmAccessContextMatch."v3group"."".3.'authPriv(3)' (requires MIB information).
43
44 **<address>**: [upd:|tcp:]<host>[/<port>]
45 Host is either an IP address or hostname and port is the SNMP port
46 of the target SNMP entity.
47
Frank Fock 20.1 48 {{code language="none"}}
Admin 19.1 49 create-snapshot:
50 create-snapshot <file> <address> <OID>
51
52
53
54 defaults:
55 defaults <action>
56
57
58 list
59
60 reset
61
62 save
63
64
65
66 dump-snapshot:
67 dump-snapshot <file>
68
69
70
71 example:
72 example <command>
73
74
75
76 get:
77 get <address> <OID> [..]
78
79
80
81 getbulk:
82 [-Cr <repeaters>] [-Cn <non-repeaters>] getbulk <address> <OID> [..]
83
84
85
86 getnext:
87 getnext <address> <OID> [..]
88
89
90
91 help:
92 help [command]|all
93
94
95
96 inform:
97 inform <address> <OID>={<type>}<value> [..]
98
99
100
101 license:
102 license
103
104
105
106 listen:
107 listen <address>
108
109
110
111 mib:
112 mib <action> [<mib>]
113
114
115 add <mib-file>
116
117
118 del <mib-module-name>
119
120
121 list
122
123
124
125 oid:
126 oid [find|find-by-descr] <regex>
127
128
129 find oid find <regex>
130
131
132 find-by-descr oid find-by-descr <regex>
133
134
135
136
137 set:
138 set <address> <OID>={<type>}<value> [..]
139
140
141
142 smi:
143 smi <OID> [..]
144
145
146
147 table:
148 table <address> <OID> [..]
149
150
151
152 trap:
153 [-To <notificationID>] trap <address> <OID>={<type>}<value> [..]
154
155
156
157 usmDHKey:
158 usmKey auth|priv|authPriv <address> <oldpwd> <newpwd> [<user>]
159
160
161 auth usmDHKey auth <address> [<user>]
162
163
164 priv usmDHKey priv <address> [<user>]
165
166
167 authPriv usmDHKey authPriv <address> [<user>]
168
169
170
171
172 usmDHKickstartInit:
173 usmDHKickstartInit -privateKeysFile <dhKickstartPrivKeys.properties> <address> [<user> ..]
174
175
176
177 usmDHKickstartRun:
178 usmDHKickstartRun -privateKeysFile <dhKickstartPrivKeys.properties> <address> [<user> ..]
179
180
181
182 usmKey:
183 usmKey auth|priv|authPriv <address> <old> <new> [<user>]
184
185
186 auth usmKey auth <address> <old> <new> [<user>]
187
188
189 priv usmKey priv <address> <old> <new> [<user>]
190
191
192 authPriv usmKey authPriv <address> <oldpwd> <newpwd> [<user>]
193
194
195
196
197 usmUser:
198 usmUser create|delete <address> <user> [<cloneFromUser> [<cloneFromEngineID>]]
199
200
201 create [-CE <usmUserEngineID>] [-createAndWait] usmUser create <address> <user> [<cloneFromUser> [<cloneFromEngineID>]]
202
203
204 delete [-CE <usmUserEngineID>] usmUser delete <address> <user>
205
206
207
208
209 v1trap:
210 -Te eid -Ts sid -Tg gid -Ta addr v1trap <address> <OID>={<type>}<value> [..]
211
212
213
214 version:
215 version
216
217
218
219 walk:
220 walk <address> <OID>
221
222
223
224 xml:
225 xml <output-dir>
226
227
228
229
230
231 OPTIONS:
232 -A authPassphrase Set the authentication pass phrase for
233 authenticated SNMPv3 messages.
234 -CB Display brief column headers. Common prefixes will
235 be dropped.
236 -CE usmUserTableEngineID Set usmUserTableEngineID to be used as part of
237 the index of the usmUserTable. Default is to use
238 the authoritative engine ID (set via -e or probed)
239 as the usmUserTableEngineID.
240 -CH Do not display column headers.
241 -Cb bufferSize The number of table rows to buffer before computing
242 column sizes.
243 -Cc columnWidth Print table columns with specified character width.
244 -Cf columnSeparator Separate table columns with the specified separator
245 string. The table is printed in compact form. By
Frank Fock 20.1 246 default, columns are separated by spaces and
Admin 19.1 247 aligned.
248 -Ch Display only column headers.
249 -Ci Prepend the index for each printed row.
250 -Cil lowerBoundIndex Set the lower bound index for TABLE operations.
251 -Ciu upperBoundIndex Set the upper bound index for TABLE operations.
252 -Cl Left justify all cells when printing a table.
253 -Cn non-repeaters Set the non-repeaters field for GETBULK PDUs. It
254 specifies the number of supplied variables that
255 should not be iterated over. The default is 0.
256 -Cr max-repetitions Set the max-repetitions field for GETBULK PDUs.
257 This specifies the maximum number of iterations
258 over the repeating variables. The default is 10.
259 -Cw Specify the line width when printing tables
260 -Djavax.net.ssl.keyStore keyStoreFile The key store file with SSL keys for
261 the TLS protocol.
262 -Djavax.net.ssl.keyStorePassword keyStorePassword The password for the key
263 store file with SSL keys for TLS.
264 -Djavax.net.ssl.trustStore keyStoreFile The trust store file with trusted
265 (public) SSL keys for the TLS protocol.
266 -Djavax.net.ssl.trustStorePassword keyStorePassword The password for the
267 trust store file.
268 -Dn Do not use any default option values stored in
269 config.
270 -E contextEngineID Set the context engine ID used for the SNMPv3
271 scoped PDU. The authoritative engine ID will be
272 used for the context engine ID, if the latter is
273 not specified.
274 -L license key Specify license and associated key. The license
275 info will be saved in the SNMP4J-CLT config file in
276 your home directory. Enter each license part
277 enclosed in quotes, for example by '-L "b6 80 4d 68
278 3a 8 c0 f4" "O?fWO-3s"'
279 -M mibRepositoryPath Set the path to the MIB repository to be used to
280 resolve object names (OIDs) and parse/format object
281 values ('repository' is the default). The
282 repository directory must contain compiled MIB
283 modules files only.
284 -Oesc escapeCharacter Escape character used in non-printable OCTET-STRING
285 values to print them as strings (instead of
286 hex-strings). Default is '_' and 'x' disables
287 escaping and enables hex-string output.
288 -Ors maxSizeRespPDU The maximum size of the response PDU in bytes.
289 -OtCSV For each SNMP row received exactly one row of comma
Frank Fock 20.1 290 separated values will be printed to the console
291 where the first column contains the row index.
Admin 19.1 292 -Otd Activates dense table operation mode which improves
293 table retrieval performance on regular (dense)
294 tables. This option must not be used with sparse
295 tables.
Frank Fock 20.1 296 -Otmr tableMaxRows Specifies the maximum number of table rows to
297 retrieve (default is no limit: 0).
Admin 19.1 298 -OttCSV Same as -OtCSV except that each row's first column
299 will report the current time (millis after
300 1.1.1970) when the request has been sent.
301 -Ta agentAddress Set the agent address field of a V1TRAP PDU. The
302 default value is '0.0.0.0'.
303 -Te enterpriseOID Set the enterprise OID field of a V1TRAP PDU.
304 -Tg genericID Set the generic ID for SNMPv1 TRAPs (V1TRAP). The
305 default is 0 (coldStart).
306 -To trapOID Sets the trapOID (1.3.6.1.6.3.1.1.4.1.0) of an
307 INFORM or TRAP PDU. The default is
308 1.3.6.1.6.3.1.1.5.1.
309 -Ts specificID Set the specific ID for V1TRAP PDU. The default is
310 0.
311 -Tu upTime Set the sysUpTime field of an INFORM, TRAP, or
312 V1TRAP PDU.
313 -Y privacyPassphrase Set the privacy pass phrase for encrypted SNMPv3
314 messages.
315 -a authProtocol Set the authentication protocol used to
316 authenticate SNMPv3 messages. Valid values are MD5
317 and SHA, SHA224, SHA256, SHA384, and SHA512.
318 -b bindAddress Set local interface and port to use for outgoing
Frank Fock 20.1 319 SNMP messages. By default, this is 0.0.0.0/0 (host
Admin 19.1 320 chosen port on all local IPv4 addresses).
321 -bc engineBootCount Set the engine boot count to the specified value
322 greater or equal to zero. Default is zero.
323 -c community Set the community for SNMPv1/v2c messages.
324 -createAndWait Use the createAndWait(5) RowStatus to create new
325 rows instead of createAndGo(4) which might not be
326 supported on certain devices.
327 -d debugLevel Set the global debug level for Log4J logging
328 output. Valid values are OFF, ERROR, WARN, INFO,
329 and DEBUG.
330 -dhp usmDHParameters The octet string (provided as colon separated
331 hexadecimal string) containing the BER encoded
332 ASN.1 sequence of prime (p) and base (g) as defined
333 by RFC2786 usmDHParamters OBJECT-TYPE. The default
334 value is (without line breaks):
335 10:69:02:61:00:ff:ff:ff:ff:ff:ff:ff:ff:c9:0f:
336 da:a2:21:68:c2:34:c4:c6:62:8b:80:dc:1c:d1:29:
337 02:4e:08:8a:67:cc:74:02:0b:be:a6:3b:13:9b:22:
338 51:4a:08:79:8e:34:04:dd:ef:95:19:b3:cd:3a:43:
339 1b:30:2b:0a:6d:f2:5f:14:37:4f:e1:35:6d:6d:51:
340 c2:45:e4:85:b5:76:62:5e:7e:c6:f4:4c:42:e9:a6:
341 3a:36:20:ff:ff:ff:ff:ff:ff:ff:ff:02:01:02:02:
342 01:10
343
344 -dhx diffieHellmanPropertyPrefix The property prefix used with the
345 privateKeysFile for the usmDHKickstartInit and
346 usmDHKickstartRun commands. By default
347 'org.snmp4j.' is used.
348 -dtls-version dtlsVersion Specifies the DTLS version to use. Possible
349 values are DTLSv1.0 and DTLSv1.2 (default).
350 -e engineID Set the authoritative engine ID of the command
351 responder used for SNMPv3 request messages. If not
352 supplied, the engine ID will be discovered.
353 -f 1|2|3|4 Set the OID output format, where 1 = numeric, 2 =
354 last name and numeric index, 3 = last name and
355 formatted index without quoting, and 4 = last name
356 and formatted index including hex-formatting of
357 non-printable strings. The default is 4.
358 -h windowSize Set the window height in rows. If the value is
359 greater than zero, every windowSize rows the user
360 is prompted to continue output. Default is zero.
361 -ilo Do not check for lexicographic ordering errors
362 while walking a subtree. Using this option may
363 cause endless looping if an agent does not
364 implement lexicographic ordering correctly!
365 -l localEngineID Set the local engine ID of the command generator
366 and the notification receiver used for SNMPv3
367 request messages. This option can be used to avoid
368 engine ID clashes through duplicate IDs leading to
369 usmStatsNotInTimeWindows reports.
370 -m mibModuleName Load the specified MIB module from the MIB
371 repository specified by the -M option. The
372 mibModuleName can be a regular expression, e.g. use
373 'SNMPv2-.*' to load all MIB modules in the
374 repository that start with 'SNMPv2-'.
375 -n contextName Set the target context name for SNMPv3 messages.
376 Default is the empty string.
377 -p Dump sent and received packets as hex string.
378 -r retries Set the number of retries used for requests. A zero
379 value will send out a request exactly once. Default
380 is 1.
381 -rsl low|basic|secure Set the security level strategy for auto-responses
382 to REPORT PDUs The default is 'low' for better
383 error handling. Use 'secure' for max. security
384 (i.e. never send noAuthNoPriv). The basic level is
385 conforming to RFC 3412 and 3414 allowing
386 'noAuthNoPriv' for engine ID discovery and wrong
387 username reports.
388 -s Suppress any output on stderr (silent mode).
389 -t timeout Set the timeout in milliseconds between retries.
390 Default is 1000 milliseconds.
391 -tls-cert-fingerprint certFingerprint The fingerprint of the trusted
392 certificate presented by the remote SNMP engine as
393 hex string. If the fingerprint does not match,
394 connection will not be established. Use this option
395 with the "tls:" or "dtls:" transport domain.
396 -tls-local-id certAlias The local certificate alias identity which selects
397 a certificate chain from the local key store. Only
398 the selected certificate chain will be presented to
399 the remote SNMP engine. Use this option with the
400 "tls:" or "dtls:" transport domain.
401 -tls-peer-id subjectDN The subject DN (e.g., "EMAILADDRESS=email@host.com,
402 C=US, CN=My Name") of the trusted certificate
403 presented by the remote SNMP engine ID. Use this
404 option with the "tls:" or "dtls:" transport domain.
405 -tls-trust-ca issuerDN The issuer DN (e.g., "Company Name CA") of a
406 trusted certification authority (CA) presented by
407 the remote SNMP engine ID for TLS and DTLS.
408 -tls-version tlsVersion The TLS version to use with the 'tls:' transport
409 protocol. Currently only 'TLSv1', 'TLSv1.1', and
410 'TLSv1.2' are supported with Java 7 or later.
411 'TLSv1' is the default which is supported with Java
412 6 too.
413 -u securityName Set the security name for authenticated v3
414 messages.
415 -v 1|2c|3 Set the SNMP protocol version to be used. Default
416 is 3.
417 -w consoleWidth Specifies the width of the console output, default
418 is 80 characters.
419 -y privacyProtocol Set the privacy protocol to be used to encrypt
420 SNMPv3 messages. Valid values are DES, AES
421 (AES128), AES192, AES256, AES192p, AES256p, and
422 3DES(DESEDE). The AES protocols that end with 'p'
423 (for proprietary) are using a non-standardized key
424 extension algorithm from 3DES.
425
Frank Fock 20.1 426 {{/code}}
427
428