[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [Mibble-users] retrieving names of fields in NOTIFICATION-TYPE(traps
From: |
Hall, Matthew |
Subject: |
RE: [Mibble-users] retrieving names of fields in NOTIFICATION-TYPE(traps) |
Date: |
Wed, 16 Aug 2006 14:58:19 -0500 |
Hello again Per and the list,
I have some code I've tested on numerous vendors and in general bullet-proofed.
So now I'm releasing it to the world. I know it's a bit of a kludge but it will
enumerate and print out the data on traps in an easy to use format. I think it
can be used as an example of how to perform simple MIB reading tasks.
I deliberately made the interface as brain-dead as possible. One just lists the
MIB names on the command line and the tool will take it from there. I suppose
it could use a usage message but the code is simple enough as is.
Thanks,
Matthew Hall
> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden
> On Behalf Of Per Cederberg
> Sent: Saturday, July 22, 2006 12:51 AM
> To: Announcements, support, and forum for Mibble users
> Subject: Re: [Mibble-users] retrieving names of fields in
> NOTIFICATION-TYPE(traps)
>
> Hi Matthew,
>
> Doing what you want to do is unfortunately a little bit
> tricky with the current Mibble API. But luckily it has been
> done before, so there is code to look at. Check out
> MibWriter.printType(SnmpNotificationType, String) and
> MibWriter.printReferenceEntry(Object).
>
> Basically what you need to do is to iterate over all the Mib
> value symbols, finding the ones with a type of
> SnmpNotificationType, and then processing the list returned
> from SnmpNotificationType.getObjects(). Each entry in that
> list should be an ObjectIdentifierValue (depends on your MIB
> actually), from which you get the actual symbol name with
> oidValue.getSymbol().getName().
>
> Hope this helps!
>
> /Per
>
> Hall, Matthew wrote:
> > Hello,
> >
> > I am new to Mibble and I'm trying to write an extremely simple hack
> > application which is based on the MIB pretty printer
> included with the
> > base distribution (small 90-line current code listing
> attached) that
> > will display the traps (NOTIFICATION-TYPE), the trap OIDs, and the
> > friendly name of the trap PDUs.
> >
> > I read the documentation on the website and I tried recursively
> > looking for and printing out child nodes on the NOTIFICATION-TYPE
> > nodes that would hopefully contain the PDUs so I could run a
> > getName() call but the trap nodes do not seem to have any
> children for
> > me to enumerate and display. Thus it's not quite clear to
> me where the
> > names of the trap PDUs are stored in the Mib and MibValueSymbol
> > classes.
> >
> > The closest I have gotten so far produces output like the following.
> > If I could get the friendly names for the PDUs, I can make
> the rest of
> > it work out right with GAWK in multiline mode, so this
> doesn't need to
> > be any kind of fancy solution, nor does it need to be all
> that fast,
> > either.
> >
> > VALUE fnFMTrapIfChange NOTIFICATION-TYPE ( Objects:
> > [1.3.6.1.4.1.12356.10.1, 1.3.6.1.4.1.12356.10.2,
> > 1.3.6.1.4.1.12356.10.3, 1.3.6.1.4.1.12356.10.4] Status: current
> > Description: Trap is sent to managing FortiManager if an interface
> > changes IP ) ::= 1.3.6.1.4.1.12356.0.100
> >
> > What can I change to get the "Objects: " listing to appear with the
> > friendly name of the fields instead of the OIDs? Or am I
> going about
> > this the wrong way?
> >
> > Thanks, Matthew Hall
> >
> > P.S.: I am sorry if this question is a stupid one but I did my best.
>
>
> _______________________________________________
> Mibble-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/mibble-users
>
TrapPrinter.java
Description: TrapPrinter.java
- RE: [Mibble-users] retrieving names of fields in NOTIFICATION-TYPE(traps),
Hall, Matthew <=