Page 1 of 1
Severity is not correct
Posted: Mon Jul 13, 2015 7:26 am
by sonuma
Hello,
For convert my MIBs, I use this command :
Code: Select all
snmpttconvertmib --in=FILE.MIB --out=FILE.CONF --exec='/usr/local/nagios/libexec/eventhandlers/submit_check_result $r "SNMP Traps" $s'
But I have a problem because when an CRITICAL trap is send to nagios, the status is not CRITICAL but INFORMATIONAL / NORMAL.
a example of snmptt.conf :
Code: Select all
EVENT wfmFSCRedundantFanFailed .1.3.6.1.4.1.3183.1.1.0.15101699 "Status Events" MAJOR
FORMAT FSC: Redundant fan failed: $2
EXEC /usr/local/nagios/libexec/eventhandlers/submit_check_result $r "SNMP Traps" $s "FSC: Redundant fan failed: $2"
SDESC
FSC: Redundant fan failed.
Variables:
1: wfmTrapDetails
2: wfmTrapType
EDESC
Where is the problem ?
my variable "$s" (in the EXEC line) is not recognized ?
Re: Severity is not correct
Posted: Mon Jul 13, 2015 1:20 pm
by ssax
Change MAJOR to Critical
Code: Select all
EVENT wfmFSCRedundantFanFailed .1.3.6.1.4.1.3183.1.1.0.15101699 "Status Events" Critical
FORMAT FSC: Redundant fan failed: $2
EXEC /usr/local/nagios/libexec/eventhandlers/submit_check_result $r "SNMP Traps" $s "FSC: Redundant fan failed: $2"
SDESC
FSC: Redundant fan failed.
Variables:
1: wfmTrapDetails
2: wfmTrapType
EDESC
Then:
That should get you up and running.
Re: Severity is not correct
Posted: Tue Jul 14, 2015 1:53 am
by sonuma
I don't understand why this change resolve my problem because in "/usr/local/bin/snmptraphandling.py" script, there is an analyse of severity...and MAJOR is inside... ?
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
Re: Severity is not correct
Posted: Tue Jul 14, 2015 2:32 am
by sonuma
When I launch manually the command :
Code: Select all
/usr/local/nagios/libexec/eventhandlers/submit_check_result SERVER_NAME "SNMP Traps" Critical "FSC: Redundant fan failed: $2"
The service status is OK
When I launch the same command but change "Critical" to "2" :
Code: Select all
/usr/local/nagios/libexec/eventhandlers/submit_check_result SERVER_NAME "SNMP Traps" 2 "FSC: Redundant fan failed: $2"
The service status is Critical.
Where is the problem ? Why my "$s" variable in EXEC command doesn't match correctly ? or how match 0,1,2 or 3 in place of Critical, warning...?
Re: Severity is not correct
Posted: Tue Jul 14, 2015 10:06 am
by ssax
Ah, I see the issue.
Please follow this guide for setting up SNMP traps with Nagios XI:
https://assets.nagios.com/downloads/nag ... ios_XI.pdf
Then you will need to remove your entries from
/etc/snmp/snmptt.conf
Then run this command on your MIBs to re-add them to snmptt the proper way:
Code: Select all
addmib /usr/share/snmp/mibs/YOUR-MIB
It would then looks something like this:
Code: Select all
EVENT wfmFSCRedundantFanFailed .1.3.6.1.4.1.3183.1.1.0.15101699 "Status Events" Critical
FORMAT FSC: Redundant fan failed: $2
EXEC /usr/local/bin/snmptraphandling.py "$r" "SNMP Traps" "$s" "$@" "$-*" "FSC: Redundant fan failed: $2"
SDESC
FSC: Redundant fan failed.
Variables:
1: wfmTrapDetails
2: wfmTrapType
EDESC
Notice the EXEC line is different.
Re: Severity is not correct
Posted: Wed Jul 15, 2015 3:54 am
by sonuma
Good
With the command ADDMIB, is it possible to choose the target file ? it's snmptt.conf by default...
Re: Severity is not correct
Posted: Wed Jul 15, 2015 11:28 am
by tgriep
The addmib program is a bash script and you can edit it to output to a different file if you would like.
It is located in the /usr/local/bin folder.
Re: Severity is not correct
Posted: Thu Jul 16, 2015 1:44 am
by sonuma
Thank you