SNMP Traps in Nagios
Posted: Tue Apr 26, 2011 11:35 am
We have built an application which will generate an SNMP trap and send this to a server with Nagios Installed to enable us to see when an exception occurs.
We are using the snmptrap daemon to listen for the trap and snmptt to translate the trap to enable Nagios to show the trap.
We have used the following page as our reference
http://xavier.dusart.free.fr/nagios/en/snmptraps.html
The mib file that we have written is
Our problem is when we try to compile a mib file that we have written to interpretate the trap that we are having problems with the part "Looking up via snmptranslate:" as shown below
We have tried to use the following as a guide in trying to get this to work.
http://www.net-snmp.org/docs/mibs/NET-S ... ES-MIB.txt
However when we try to import the NOTIFICATION-TYPE we get a warning about skipping a line as shown below.
Can anyone please help us with this specific scenario as we are newbies in this area but we have been trying to get this to work for some time
or Can anybody direct us to a good example of a mib which has been written to handle a user generated trap that can be shown in Nagios.
All help will be much appreciated.
We are using the snmptrap daemon to listen for the trap and snmptt to translate the trap to enable Nagios to show the trap.
We have used the following page as our reference
http://xavier.dusart.free.fr/nagios/en/snmptraps.html
The mib file that we have written is
Code: Select all
ERRORBOT-MIB DEFINITIONS ::= BEGIN
IMPORTS
enterprises,
OBJECT-TYPE,
Counter
FROM RFC1155-SMI
microsoft
FROM MSFT-MIB
software OBJECT IDENTIFIER ::= { microsoft 1} -- 1.3.6.1.4.1.311.1
internetServer OBJECT IDENTIFIER ::= { software 7 } -- 1.3.6.1.4.1.311.1.7
ErrorBot OBJECT IDENTIFIER ::= { internetServer 2000 } -- 1.3.6.1.4.1.311.1.7.2000
ErrorBotHeart OBJECT IDENTIFIER ::= { ErrorBot 2} -- 1.3.6.1.4.1.311.1.7.2000.2
-- Package Details
OpSystem OBJECT-TYPE
SYNTAX OCTET STRING (SIZE(0..255))
ACCESS read-only
STATUS mandatory
DESCRIPTION
"OS Version"
::= {ErrorBotHeart 1}
TrapName OBJECT-TYPE
SYNTAX OCTET STRING (SIZE(0..255))
ACCESS read-only
STATUS mandatory
DESCRIPTION
"Name of Trap"
::= {ErrorBotHeart 2}
CurrStat OBJECT-TYPE
SYNTAX OCTET STRING (SIZE(0..255))
ACCESS read-only
STATUS mandatory
DESCRIPTION
"Current Status of Trap"
::= {ErrorBotHeart 3}
HeartBeatNotification NOTIFICATION-TYPE
OBJECTS {CurrStat}
STATUS current
DESCRIPTION
"notification"
::= {ErrorBotHeart 4}
END
Code: Select all
root@nagios3:/usr/share/snmp/mibs# snmpttconvertmib --in=ERRORBOT-MIB.txt --out=/etc/snmp/snmptt.conf --exec='/usr/local/nagios/libexec/submit_check_result $r TRAP 1'
exec: /usr/local/nagios/libexec/submit_check_result $r TRAP 1
***** Processing MIB file *****
snmptranslate version: NET-SNMP version: 5.4.2.1
severity: Normal
File to load is: ./ERRORBOT-MIB.txt
File to APPEND TO: /etc/snmp/snmptt.conf
MIBS environment var: ./ERRORBOT-MIB.txt
mib name: ERRORBOT-MIB
Processing MIB: ERRORBOT-MIB
#
Line: 43
NOTIFICATION-TYPE: HeartBeatNotification
Variables: CurrStat
Enterprise: ErrorBotHeart
Looking up via snmptranslate: ERRORBOT-MIB::HeartBeatNotification
Unknown object identifier: ERRORBOT-MIB::HeartBeatNotification
OID:
Done
Total translations: 1
Successful translations: 0
Failed translations: 1
root@nagios3:/usr/share/snmp/mibs#
http://www.net-snmp.org/docs/mibs/NET-S ... ES-MIB.txt
However when we try to import the NOTIFICATION-TYPE we get a warning about skipping a line as shown below.
Code: Select all
root@nagios3:/usr/share/snmp/mibs# snmpttconvertmib --in=ERRORBOT-MIB.txt --out=/etc/snmp/snmptt.conf --exec='/usr/local/nagios/libexec/submit_check_result $r TRAP 1'
exec: /usr/local/nagios/libexec/submit_check_result $r TRAP 1
***** Processing MIB file *****
snmptranslate version: NET-SNMP version: 5.4.2.1
severity: Normal
File to load is: ./ERRORBOT-MIB.txt
File to APPEND TO: /etc/snmp/snmptt.conf
MIBS environment var: ./ERRORBOT-MIB.txt
mib name: ERRORBOT-MIB
Processing MIB: ERRORBOT-MIB
skipping a TRAP-TYPE / NOTIFICATION-TYPE line - probably an import line.
#
Line: 44
NOTIFICATION-TYPE: HeartBeatNotification
Variables: CurrStat
Enterprise: ErrorBotHeart
Looking up via snmptranslate: ERRORBOT-MIB::HeartBeatNotification
Unknown object identifier: ERRORBOT-MIB::HeartBeatNotification
OID:
Done
Total translations: 1
Successful translations: 0
Failed translations: 1
or Can anybody direct us to a good example of a mib which has been written to handle a user generated trap that can be shown in Nagios.
All help will be much appreciated.