Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Send a notification trap SNMP with snmptrap command Linux

For test purpose, i'm trying to use the snmptrap command to produce a .1.3.6.1.2.1.43.18.2.0.1 trap (printer alert trap).

I'm not in my two feet with the syntax of the snmptrap command, so can someone explain me how to correctly use this command, specially for this trap if it's possible ?

like image 534
Nicolas Frbezar Avatar asked May 09 '16 15:05

Nicolas Frbezar


People also ask

How do I capture SNMP traps in Linux?

If you have an SNMP-managed network, you can use RMC on Linux nodes to catch SNMP traps. You can use RMC's event management capabilities to respond to the trap message as you would respond to a monitored event in RMC. The SNMP trap information is also entered into the audit log.

What is SNMP trap command?

snmptrap is an SNMP application that uses the SNMP TRAP operation to send information to a network manager. One or more object identifiers (OIDs) can be given as arguments on the command line. A type and a value must accompany each object identifier. Each variable name is given in the format specified in variables(5).


1 Answers

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.

enter image description here

like image 130
Andrew Komiagin Avatar answered Oct 06 '22 15:10

Andrew Komiagin