-
Notifications
You must be signed in to change notification settings - Fork 6
Add support for SNMPv3 context engine ID and context name to snmptrap
#76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
4.0.7 | ||
4.1.0 |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -60,6 +60,8 @@ The value is stored in the `@metadata` where it can be used by other plugins in | |||||
|ECS disabled, v1, v8 |Availability|Description | ||||||
|[@metadata][input][snmptrap][pdu][agent_addr]|`SNMPv1`|Network address of the object generating the trap | ||||||
|[@metadata][input][snmptrap][pdu][community]|`SNMPv1` `SNMPv2c`|SNMP community | ||||||
|[@metadata][input][snmptrap][pdu][context_engine_id]|`SNMPv3`|SNMP context engine id | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|[@metadata][input][snmptrap][pdu][context_name]|`SNMPv3`|SNMP context name | ||||||
|[@metadata][input][snmptrap][pdu][enterprise]|`SNMPv1`|Type of object generating the trap | ||||||
|[@metadata][input][snmptrap][pdu][error_index]|`SNMPv2c` `SNMPv3`|Provides additional information by identifying | ||||||
which variable binding in the list caused the error | ||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -246,7 +246,6 @@ public <A extends Address> void processPdu(final CommandResponderEvent<A> event) | |||||||||||||||
if (!validateTrapMessage(version, securityName, event.getSecurityLevel(), allowedCommunities)) { | ||||||||||||||||
return; | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
final Map<String, Object> trapEvent = createTrapEvent(version, securityName, event.getPDU()); | ||||||||||||||||
final Map<String, Object> formattedVarBindings = new HashMap<>(event.getPDU().getVariableBindings().size()); | ||||||||||||||||
for (VariableBinding binding : event.getPDU().getVariableBindings()) { | ||||||||||||||||
|
@@ -306,6 +305,10 @@ private Map<String, Object> createTrapEvent(int version, final String securityNa | |||||||||||||||
trapEvent.put("error_status", pdu.getErrorStatus()); | ||||||||||||||||
trapEvent.put("error_status_text", pdu.getErrorStatusText()); | ||||||||||||||||
trapEvent.put("error_index", pdu.getErrorIndex()); | ||||||||||||||||
if (pdu instanceof ScopedPDU) { | ||||||||||||||||
trapEvent.put("context_engine_id", ((ScopedPDU)pdu).getContextEngineID()); | ||||||||||||||||
trapEvent.put("context_name", ((ScopedPDU)pdu).getContextName()); | ||||||||||||||||
Comment on lines
+308
to
+310
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Both fields are |
||||||||||||||||
} | ||||||||||||||||
} else if (pdu instanceof PDUv1) { | ||||||||||||||||
final PDUv1 pdUv1 = (PDUv1) pdu; | ||||||||||||||||
trapEvent.put("enterprise", String.valueOf(pdUv1.getEnterprise())); | ||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.