snmptrap
- Organization of this page
Syntax
snmptrap [-d] [-p port-number] [-c community-name] node-name enterprise-ID agent-address standard-trap-number enterprise-specific-trap-number time-stamp [object-identifier value-type value...]
Description
The snmptrap command issues an SNMP trap to a specified node.
Location
-
Systems other than AIX: /opt/OV/bin
-
AIX: /usr/OV/bin
Arguments
- -d
-
Specify this option if you want to output the SNMP packets to the standard output in the hexadecimal format and decoded ASN.1 format.
- -p port-number
-
Specify the port number of the sending manager. If omitted, the value 162 is assumed.
- -c community-name
-
Specify the community name. If omitted, the value public is assumed.
- node-name
-
Specify the IP address or host name of the destination node.
- enterprise-ID
-
Specify a sysObjectID in the A.B.C.D... format, where A, B, C, and D are subidentifiers in decimal notation. If the object identifier is in the A.B.C.D... format and begins with 1.3.6.1.2.1, you can omit 1.3.6.1.2.1. If you specify a NULL string (''), the command assumes SNMP Agent's sysObjectID. For details about the sysObjectID function of SNMP Agent, see 4.3.1 Organization of Hitachi enterprise-specific MIB objects.
- agent-address
-
Specify the IP address or the host name of the agent. If you specify a NULL string (''), the command applies the value acquired by using the appropriate OS functions to first acquire the host name, and then to convert the acquired host name to its IP address.
If you wish to use a particular IP address as the agent address that is output in trap messages issued by the snmptrap command, specify that IP address as the agent address.
- standard-trap-number
-
Specify a standard trap number as an integer from 0 to 6. Specify 6 to issue an enterprise-specific trap.
- enterprise-specific-trap-number
-
Specify an enterprise-specific trap number as a 32-bit integer. If the standard trap number is not set to 6, this number is ignored, and the argument is filled with 0s. Valid values are positive integers, negative integers, hexadecimal integers (beginning with 0x), and octet integers (beginning with 0).
- time-stamp
-
Specify a time as an integer of value 0 or greater. If you specify a NULL string ('') the command assumes the value in timeticks, which is the number of ticks counted since the system started.
- object-identifier
-
For the snmptrap command, you can specify more than one object-identifier value-type value tuple. For example, if one tuple is 256 bytes in length, you can specify up to 20 tuples. object-identifier must be in the A.B.C.D... format, where A, B, and C are subidentifiers in decimal notation. If the object identifier is in the A.B.C.D... format and begins with 1.3.6.1.2.1, you can omit 1.3.6.1.2.1.
- value-type
-
Specify one of the following values:
-
integer (from -231 to 231-1)
-
octetstring
-
objectidentifier (if the object identifier is in the A.B.C.D... format and begins with 1.3.6.1.2.1, you can omit 1.3.6.1.2.1)
-
null (the command unconditionally ignores the value argument following null)
-
ipaddress
-
counter (from 0 to 4294967295)
-
gauge
-
timeticks
-
opaque
For details, see RFC 1155.
You can also specify the following special octetstring values:
-
octetstringhex (string of hexadecimal pairs from 00 to FF; example: 01FF)
-
octetstringoctal (string of octal triples from 000 to 377; example: 001377)
-
octetstringascii (ASCII character string)
You can also specify the following special opaque values:
-
opaquehex (string of hexadecimal pairs from 00 to FF; example: 01FF)
-
opaqueoctal (string of octal triples from 000 to 377; example: 001377)
-
opaqueascii (ASCII character string)
-
- value
-
Specify a value of the specified value type.
Return values
- 0: Normal termination
-
Since SNMP traps are transmitted via UDP, whether the transmission succeeded is not checked. Thus, the remote node might not be notified even when the command terminated normally.
- 1: Run-time error
-
An error message is output.
Note
In AIX, if the snmptrap command is executed as an extension of a shell script or program started from cron or /etc/inittab, the command might fail with the following message:
snmptrap:cannot set locale($LANG="Ja_JP")
If this message is output, in the LC_ALL environment variable, set the language you want to use.
The following shows an example of setting C as the language code for the B shell.
LC_ALL=C export LC_ALL snmptrap flcndmak .1.3.6.1.4.1.4242 15.6.71.223 6 2 0