Skip to content

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

robbavey
Copy link
Contributor

Relates: #12

Comment on lines +308 to +310
if (pdu instanceof ScopedPDU) {
trapEvent.put("context_engine_id", ((ScopedPDU)pdu).getContextEngineID());
trapEvent.put("context_name", ((ScopedPDU)pdu).getContextName());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (pdu instanceof ScopedPDU) {
trapEvent.put("context_engine_id", ((ScopedPDU)pdu).getContextEngineID());
trapEvent.put("context_name", ((ScopedPDU)pdu).getContextName());
if (pdu instanceof ScopedPDU) {
final ScopedPDU scopedPDU = (ScopedPDU) pdu;
trapEvent.put("context_engine_id", String.valueOf(scopedPDU.getContextEngineID()));
trapEvent.put("context_name", scopedPDU.getContextName());

Both fields are OctetString and need to be parse to string before setting them as a Logstash event field, otherwise a Java::OrgLogstash::MissingConverterException is raised.

@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
|[@metadata][input][snmptrap][pdu][context_engine_id]|`SNMPv3`|SNMP context engine id
|[@metadata][input][snmptrap][pdu][context_engine_id]|`SNMPv3`|SNMP context engine ID

@@ -1,3 +1,6 @@
## 4.1.0
- Add support for SNMPv3 `context engine ID` and `context name` to the `snmptrap` input[xxx]()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Add support for SNMPv3 `context engine ID` and `context name` to the `snmptrap` input[xxx]()
- Add support for SNMPv3 `context engine ID` and `context name` to the `snmptrap` input [#76](https://github.com/logstash-plugins/logstash-integration-snmp/pull/76)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants