Send-Trap Cmdlet
Parameters Output Objects Configuration Settings
The Send-Trap cmdlet is used to sends SNMP traps to a remote address.
Syntax
Send-Trap [parameters]
Remarks
Depending upon the value of the Version parameter, the packet is constructed as an SNMPv1, SNMPv2 or SNMPv3 Trap PDU. The following parameters provide more control over how traps are generated: Port, Agent, Community, Enterprise.
For SNMPv3 traps, the User, AuthenticationPassword, and EncryptionPassword parameters can be set. If any values are provided in the ObjectID, ObjectType, ObjectValue arrays, they are sent unchanged. In the case of an SNMPv2 or SNMPv3 Trap, if the Obj properties are not specified, the following values are set: sysUpTime.0 equal to Uptime and snmpTrapOID.0 equal to OID.
For SNMPv2 and SNMPv3 Traps, OID must contain the full OID of the Trap. Automatic translation is handled internally from node labels to node OIDs assuming that a valid MIB file is provided. For SNMPv1, OID must be of the form "GenericTrap.SpecificTrap". These values are sent in the PDU header. Agent and Enterprise are taken from their corresponding parameters.
The cmdlets support pipeline input for some of their parameters. Prebuilding an object and piping it to the cmdlet is very useful, but should be used with caution to prevent security conflicts. Steps have been taken to decrease the risk of a possibly accidental pipe to the cmdlet, for instance, the Credential parameter cannot be piped to the cmdlet and must be specified manually.
#send a coldStart trap
send-trap -manager 10.0.1.255 -oid coldStart.0
#send a custom coldStart trap
send-trap -manager 10.0.1.255 -oid coldStart.0 -objectID 1.1 -objectType Integer -objectValue 20
#send a custom coldStart trap with multiple objects
send-trap -manager 10.0.1.255 -oid coldStart.0 -objectID 1.1,1.2,1.3 -objectType Integer,Integer,Integer -objectValue 20,31,53
Below are some examples using SNMPv1:
#send a coldStart trap using SNMPv1
send-trap -version 1 -manager 10.0.1.255 -oid 0.0
#send a custom coldStart trap using SNMPv1
send-trap -version 1 -manager 10.0.1.255 -oid 0.0 -objectID 1.1 -objectType Integer -objectValue 20
#send a custom coldStart trap with multiple objects and custom enterprise
send-trap -version 1 -manager 10.0.1.255 -enterprise 1.5.7.5.8.3.4.1.4 -oid 0.0 -objectID 1.1,1.2 -objectType Integer,Integer -objectValue 20,31
Parameter List
The following is the full list of the parameters of the cmdlet with short descriptions. Click on the links for further details.
LogFile | The location of a file to which debug information is written. |
Agent | The address of the SNMP agent. |
AuthenticationPassword | The password to use for SNMPv3 authentication. |
AuthenticationProtocol | The authentication protocol used. |
Community | The value of the Community parameter for SNMP traps. |
Config | Specifies one or more configuration settings. |
EncryptionAlgorithm | The encryption algorithm used for the request. |
EncryptionPassword | The password to use for SNMPv3 privacy encryption. |
Enterprise | The type of the object generating the trap. |
LocalIP | The IP address of the local interface to use. |
LogFile | The location of a file to which debug information is written. |
Manager | The Manager to which to send the trap. |
Mib | Extra mib files to use for the Label to OID translation and vice versa. |
ObjectID | A collection of OIDs to add to the trap. |
ObjectType | A collection of Object types to add to the trap. |
ObjectValue | The Object value collection to add to the trap. |
OID | The OID to use for the request. |
Timeout | The maximum time allowed for the operation. |
Uptime | Time passed since the agent was initialized (in hundredths of a second). |
User | The username to use for authentication. |
Version | The version of SNMP to use for the request. |
Output Objects
The following is the full list of the output objects returned by the cmdlet with short descriptions. Click on the links for further details.
Trap | This object is returned for each trap received by the cmdlet. |
Configuration Settings
The following is a list of configuration settings for the cmdlet with short descriptions. Click on the links for further details.
UseBackgroundThread | Whether threads created by the cmdlet are background threads. |
UseInternalSecurityAPI | Tells the cmdlet whether or not to use the system security libraries or an internal implementation. |