All Apps and Add-ons

SNMP Modular Input: Why am I getting error "cannot locate module ./saatrap.mib'" trying to convert an MIB file to Python?

ramighebral
Path Finder

Hi,

I am having trouble converting a MIB file to Oython as required by the SNMP Modular Input add-on, all mib dependencies have been downloaded and placed under the directory defined in $HOME/.smirc.
The error is the below:

smidump -f python -k ./saatrap.mib
./saatrap.mib:1: syntax error, unexpected identifier, expecting moduleKeyword or submoduleKeyword
smidump: cannot locate module ./saatrap.mib'

Anybody have an idea what's going on here?

MIB file can be found here:
http://pastebin.com/download/Pj0CVCWN

Thanks,
Rami

0 Karma

Damien_Dallimor
Ultra Champion

The Mib file in your link appears to have errors ie: the name of mib (saatrap) in line 1 should not be lowercase.

So I changed that , and voila , progress. Note : you can also use the program "smilint" to check your Mib files.

SAA-TRAP-MIB DEFINITIONS ::= BEGIN
IMPORTS

    enterprises
        FROM RFC1155-SMI
    OBJECT-TYPE
        FROM RFC-1212
    TRAP-TYPE
        FROM RFC-1215;

swift   OBJECT IDENTIFIER ::= { enterprises 18494 }
saa     OBJECT IDENTIFIER ::= { swift 2 }
saatrap OBJECT IDENTIFIER ::= { saa 1 }

saaInstance OBJECT-TYPE
        SYNTAX          OCTET STRING (SIZE(256))
        ACCESS          read-only
        STATUS          mandatory
        DESCRIPTION     "The unique identifier of SAA instance."
        ::= { saatrap 1 }

saaDate OBJECT-TYPE
        SYNTAX          OCTET STRING (SIZE(10))
        ACCESS          read-only
        STATUS          mandatory
        DESCRIPTION     "Date"
        ::= { saatrap 2 }

saaTime OBJECT-TYPE
        SYNTAX          OCTET STRING (SIZE(9))
        ACCESS          read-only
        STATUS          mandatory
        DESCRIPTION     "Time"
        ::= { saatrap 3 }

saaPlugin OBJECT-TYPE
        SYNTAX          OCTET STRING
        ACCESS          read-only
        STATUS          mandatory
        DESCRIPTION     "Generated by"
        ::= { saatrap 4 }

saaEventNumber OBJECT-TYPE
        SYNTAX          INTEGER
        ACCESS          read-only
        STATUS          mandatory
        DESCRIPTION     "Event number"
        ::= { saatrap 5 }

saaEventSeverity OBJECT-TYPE
        SYNTAX          OCTET STRING
        ACCESS          read-only
        STATUS          mandatory
        DESCRIPTION     "Event severity"
        ::= { saatrap 6 }

saaEventClass OBJECT-TYPE
        SYNTAX          OCTET STRING
        ACCESS          read-only
        STATUS          mandatory
        DESCRIPTION     "Event class"
        ::= { saatrap 7 }

saaEventName OBJECT-TYPE
        SYNTAX          OCTET STRING
        ACCESS          read-only
        STATUS          mandatory
        DESCRIPTION     "Event name"
        ::= { saatrap 8 }

saaEventDescription OBJECT-TYPE
        SYNTAX          OCTET STRING
        ACCESS          read-only
        STATUS          mandatory
        DESCRIPTION     "Event description"
        ::= { saatrap 9 }

snmpSAAEvent TRAP-TYPE
              ENTERPRISE  saa
              VARIABLES
              {
              saaInstance,
              saaDate,
              saaTime,
              saaPlugin,
              saaEventNumber,
              saaEventSeverity,
              saaEventClass,
              saaEventName,
              saaEventDescription
              }
              DESCRIPTION
                          "The following event was generated via Alliance Access.
                                                   More information is available in the details:"
              ::= 1

saaHb   OBJECT IDENTIFIER ::= { saa 2 }

saaHbInstance OBJECT-TYPE
        SYNTAX          OCTET STRING (SIZE(256))
        ACCESS          read-only
        STATUS          mandatory
        DESCRIPTION     "Unique identifier of Alliance Access instance"
        ::= { saaHb 1 }

saaHbStatus OBJECT-TYPE
        SYNTAX          OCTET STRING (SIZE(20))
        ACCESS          read-only
        STATUS          mandatory
        DESCRIPTION     "Status of Alliance Access instance"
        ::= { saaHb 2 }

saaHbInterval OBJECT-TYPE
        SYNTAX          INTEGER
        ACCESS          read-only
        STATUS          mandatory
        DESCRIPTION     "Heartbeat Interval"
        ::= { saaHb 3 }

snmpSWPHeartBeat TRAP-TYPE
              ENTERPRISE saa
              VARIABLES
              {
              saaHbInstance,
              saaHbStatus,
              saaHbInterval
              }
              DESCRIPTION
                          "The following event was generated via the Alliance Access.
                                                   More information is available in the details:"
              ::= 2

END
0 Karma

ramighebral
Path Finder

Thanks for your input Damien, the conversion works now, but after copying the mib to snmp_ta/bin/mibs/ I am still getting the below error:
Exception resolving MIB name in the caught trap NoSuchObjectError({'str': 'No MIB registered that defines 1.3.6.1.4.1.18494.2.1.9 object, closest known parent is 1.3.6.1.4.1 (SNMPv2-SMI::enterprises)'})

Noting that by browsing the MIB file you could find the referenced object in it.

0 Karma

Damien_Dallimor
Ultra Champion

1) Show me your inputs.conf stanza
2) Show me the exact name of the generated python module you placed in the mibs dir

0 Karma
Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

WATCH NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If exploited, ...

Enter the Splunk Community Dashboard Challenge for Your Chance to Win!

The Splunk Community Dashboard Challenge is underway! This is your chance to showcase your skills in creating ...

.conf24 | Session Scheduler is Live!!

.conf24 is happening June 11 - 14 in Las Vegas, and we are thrilled to announce that the conference catalog ...