The coldStart trap's parameters - Whats going on and how do I find out what they should be

StackOverflow https://stackoverflow.com/questions/19427631

  •  01-07-2022
  •  | 
  •  

문제

The coldStart trap's parameters - Whats going on and how do I find out what they should be

Hello, I'm new to SNMP, and have a simple question. I'm trying to send a coldStart trap to another system. The coldStart trap's OID is 1.3.6.1.6.3.1.1.5.1

Here is the coldStart's description in the mib:

coldStart NOTIFICATION-TYPE STATUS current DESCRIPTION "A coldStart trap signifies that the SNMP entity, supporting a notification originator application, is reinitializing itself and that its configuration may have been altered." ::= { snmpTraps 1 }

Clear thus far. Now, I'll try to send the trap:

# snmptrap -v 2c -c public otherLinuxSystem SNMPv2-MIB::coldStart

and this command returns:

 Missing trap-oid parameter

What? Theres nothing in the mib about parameters. So, I googled, and I found adding a value, 0 in this case:

    # snmptrap -v 2c -c public otherLinuxSystem SNMPv2-MIB::coldStart 0

Works. 1 or 2 works too. Heres my questions:

Do all traps have a parameter and its just implied? Is this defined somewhere I missed? How do I know what values represent what? what does 0, 1, and 2 mean in this case, and how can I find this myself in the future? Thanks.

도움이 되었습니까?

해결책

The issue you observe is nothing specific to coldStart, but is just an issue of mistaken usage of net-snmp's snmptrap command. If you look at the bottom of the usage info if you call "snmptrap" with no parameters, you'll see:

  -v 1 TRAP-PARAMETERS:
         enterprise-oid agent trap-type specific-type uptime [OID TYPE VALUE]...
  or
  -v 2 TRAP-PARAMETERS:
         uptime trapoid [OID TYPE VALUE] ...

You specified -v 2c in your argument, so snmptrap expects the second form. That is, two arguments required after the target address (otherLinuxSystem in your example): a value for sysUpTime.0 and a value for snmpTrapOID.0 that will be included in the trap (I suspect the arguments are swapped in your second example).

The first indicates when the trap occurred and the second identifies the trap itself. Both are required variables in all SNMPv2c/v3 traps; it just happens that net-snmp's snmptrap requires you to specify both of these (rather than, say, defaulting to the host's uptime for sysUpTime.0 if unspecified).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top