Send a notification trap SNMP with snmptrap command Linux
The syntax is pretty simple:
snmptrap -c public -v 2c 127.0.0.1 "" 1.3.6.1.2.1.43.18.2.0.1
The problem here is that this particular trap should be sent with 6 varbinds:
- prtAlertIndex
- prtAlertSeverityLevel
- prtAlertGroup
- prtAlertGroupIndex
- prtAlertLocation
- prtAlertCode
Thus you'll also have to provide values for all these varbinds. So the Trap Receiver will be able to handle this type of trap properly.
I'd suggest using tools like NetDecision Trap Simulator which automatically configures traps to send based on MIB definitions.
Anything wrong with this trap message?
This is pretty normal Enterprise specific SNMP notification. The type of this notification (PDU format) is TRAPv2. This trap contains 3 varbinds. The first two are required by RFC1448. So you cannot get rid of them.
- The first varbind
snmpTrapOID.0
is the actual Object Identifier (OID) that identifies the type of Trap. - The second varbind
sysUptime.0
is from RFC1213 (MIB-2). Basically it is the time since device was last rebooted.
I would add .0
to cpsSystemSendTrap
as it is a scalar object.
how to capture trap message in net-snmp
Netsnmp provides Snmptrapd for this purpose.
It is an application which can listen on a port (default 162) on a host for traps and will log those that are received.
//EDIT ...
Here is an example ...
snmptrapd -f -m +ALL -Lo -c /tmp/snmptrapd.conf 9876
where /tmp/snmptrapd.conf
only contains one line which for simplicity disables community/password checking
disableAuthorization yes
Use man snmptrapd
to see what the flags/arguements mean.
Related Topics
How to Cancel Command in Grunt Shell
Udev Rules Are Not Working for Libusb on Ubuntu 12.04
How to Make Libusb Library Visible to Another Program
Unexpected Periodic Behaviour of an Ultra Low Latency Hard Real Time Multi-Threaded X86 Code
Kill Bash Script Foreground Children When a Signal Comes
How to Install G++ on Centos Without Root
Shell Script to Get List of Defined Users on Linux
How to Handle Error/Exception in Shell Script
How to Selectively Create Symbolic Links to Specific Files in Another Directory in Linux
Building /Lib/Modules/$(Uname -R)/Build While Compiling a Kernel
Bash-Script Printing a PDF to a PDF in Linux
Installing New Version of Python on Debian Linux Server
How to Distinguish Between Different Operating System Distros in Node.Js
Failed to Load Javahl Library.- Linux/Eclipse
Error Hh604: Error Running JSON-Rpc Server: Error:0308010C:Digital Envelope Routines::Unsupported