Skip to content

Instantly share code, notes, and snippets.

@asealey
Created November 2, 2014 23:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asealey/e618ea97e702a91077f5 to your computer and use it in GitHub Desktop.
Save asealey/e618ea97e702a91077f5 to your computer and use it in GitHub Desktop.
Fix for snmp.py from Splunk SNMP Modular input
From 792a36d6dd4352471ea8886c8b4e65deee515cce Mon Sep 17 00:00:00 2001
From: Adam Sealey <asealey@gmail.com>
Date: Sun, 2 Nov 2014 15:12:16 -0800
Subject: [PATCH] Fixing snmp.py for snmpv3 exceptions (treating as tuples when
they shouldn't be
---
snmp_ta/bin/snmp.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/snmp_ta/bin/snmp.py b/snmp_ta/bin/snmp.py
index cc14dc5..36177f3 100644
--- a/snmp_ta/bin/snmp.py
+++ b/snmp_ta/bin/snmp.py
@@ -244,9 +244,9 @@ def v3trapCallback(snmpEngine,stateReference,contextEngineId, contextName,varBin
server = ""
( transportDomain,transportAddress ) = snmpEngine.msgAndPduDsp.getTransportInfo(stateReference)
try:
- server = "%s" % transportAddress
- trap_metadata += 'notification_from_address = "%s" ' % (transportAddress)
- trap_metadata += 'notification_from_domain = "%s" ' % (transportDomain)
+ server = "%s" % transportAddress[0]
+ trap_metadata += 'notification_from_address = "%s" ' % (transportAddress[0])
+ trap_metadata += 'notification_from_domain = "%s" ' % (transportDomain[0])
except: # catch *all* exceptions
e = sys.exc_info()[1]
logging.error("Exception resolving source address/domain of the trap: %s" % str(e))
--
2.1.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment