Severity is not correct

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
sonuma
Posts: 42
Joined: Fri Jan 13, 2012 3:51 am

Severity is not correct

Post 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 ?
Last edited by sonuma on Thu Jul 16, 2015 1:44 am, edited 1 time in total.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Severity is not correct

Post 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:

Code: Select all

service snmptt restart
That should get you up and running.
sonuma
Posts: 42
Joined: Fri Jan 13, 2012 3:51 am

Re: Severity is not correct

Post 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
sonuma
Posts: 42
Joined: Fri Jan 13, 2012 3:51 am

Re: Severity is not correct

Post 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...?
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Severity is not correct

Post 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.
sonuma
Posts: 42
Joined: Fri Jan 13, 2012 3:51 am

Re: Severity is not correct

Post by sonuma »

Good :)

With the command ADDMIB, is it possible to choose the target file ? it's snmptt.conf by default...
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Severity is not correct

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
sonuma
Posts: 42
Joined: Fri Jan 13, 2012 3:51 am

Re: Severity is not correct

Post by sonuma »

Thank you
Locked