NOTIFICATION-TYPE unexpected when importing custom MIB into AgenPro.

I’m using AgenPro to create an Agent (and compiled MIB java files) that needs to support SNMPv2 / v3. It has been generated against a custom MIB which I’m currently writing.

Figure 1 in section 6.2.1 of the AgenProManual.pdf shows a MIB imports definition with OBJECT-TYPE and NOTIFICATION-TYPE imported from SNMPv2-SMI. When I try this the import process raises errors stating that:

  1. The OBJECT-TYPE must be imported from RFC-1212.
  2. The NOTIFICATION-TYPE definitions are unexpected (expecting one of: … “TRAP-TYPE”… ).

There were similar issues with other types. Importing DisplayString from RFC1213-MIB results in the error that the imported MIB is unknown, for example.

I’m unsure if this is a problem with my MIB definition or in my use of AgenPro, I’m hoping I just missed something in the documentation. Do you know where I’m going wrong?

Example MIB entries for reference.

The following entries in our MIB define the Imports and an example trap NOTIFICATION-TYPEs which I’m trying to define:

IMPORTS
  OBJECT-TYPE
    FROM RFC-1212
  NOTIFICATION-TYPE
    FROM SNMPv2-SMI          -- [RFC2578]
  enterprises
    FROM RFC1155-SMI
;

…

-- Traps Definition
projComponentMemoryNotification NOTIFICATION-TYPE
    OBJECTS     { projComponentMemoryPercentage }
    STATUS      current
    DESCRIPTION
        "A notification raised when the memory reaches the maximum or minimum value defined."
::= { projComponentTraps 1 }

projComponentMemoryPercentage OBJECT-TYPE
    SYNTAX      DisplayString
    ACCESS      read-only
    STATUS      mandatory
    DESCRIPTION
        "The current percentage memory use which triggered the alert."
::= { projComponentTrapObjects 1 }

Sorry, maybe I saw this topic very late (not sure why?). Nevertheless, here is my answer:

I assume that you wanted to write a SMIv2 MIB module specification. SMIv2 requires, that the first object definition in any SMIv2 MIB module is a MODULE-IDENTITY construct. In your case that is missing. Therefore the SMI parser assumes, that your MIB module is SMIv1. For SMIv1, you would have to use different imports than for those you partly used. SNMPv2-SMI is SMIv2 but RFC1155-SMI is SMIv1.

I suggest to fix it as follows:

  1. Remove any SMIv1 imports.
  2. Add a MODULE-IDENTIY immediately after the IMPORT statement

See AGENT++'s MIB Design Dos and Dont's too for other common MIB errors.