mibble-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Mibble-users] retrieving names of fields in NOTIFICATION-TYPE (trap


From: Per Cederberg
Subject: Re: [Mibble-users] retrieving names of fields in NOTIFICATION-TYPE (traps)
Date: Sat, 22 Jul 2006 09:51:29 +0200
User-agent: Thunderbird 1.5.0.4 (Macintosh/20060530)

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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]