SNMP Traps Not Triggering In NagiosXI (Bug?)
Posted: Wed Dec 21, 2011 1:53 pm
Hello,
1. RHEL 6.1
2. 32bit
3. Manual Install of XI
4. No special configurations
I ran into an issue with SNMP Trap handling in NagiosXI that I thought I'd share. I followed the documentation on SNMP trap setup to a T, but NagiosXI was never aware of any trap messages that came in. The trap messages were showing up in the snmptt.log without issue. I tracked the problem back to /usr/local/bin/snmptraphandling.py, since this is what was executing when a trap message came in. When testing this command manually, it was failing with...
I know almost nothing about Python, but based off of the error message I did notice that the indentation was a little funny in one of the declarations. It looked like this:
Once I un-indented the 'severity' statement so it was even with the if statements, everything worked as expected.
- Bryant
1. RHEL 6.1
2. 32bit
3. Manual Install of XI
4. No special configurations
I ran into an issue with SNMP Trap handling in NagiosXI that I thought I'd share. I followed the documentation on SNMP trap setup to a T, but NagiosXI was never aware of any trap messages that came in. The trap messages were showing up in the snmptt.log without issue. I tracked the problem back to /usr/local/bin/snmptraphandling.py, since this is what was executing when a trap message came in. When testing this command manually, it was failing with...
Code: Select all
File "/usr/local/bin/snmptraphandling.py", line 46
if severity == "INFORMATIONAL":
^
IndentationError: unindent does not match any outer indentation levelCode: Select all
def get_return_code(severity):
severity = severity.upper()
if severity == "INFORMATIONAL":
return_code = "0"
elif severity == "NORMAL":
return_code = "0"
elif severity == "SEVERE":
return_code = "2"
elif severity == "MAJOR":
return_code = "2"
elif severity == "CRITICAL":
return_code = "2"
elif severity == "WARNING":
return_code = "1"
elif severity == "MINOR":
return_code = "1"
else:
printusage()
return return_code- Bryant