Writing SNMP MIBs from C Structs?
darthtuttle asks: "So I'm working on collecting some stats from the Solaris kernel via the kstat interface and a few others, and I'm going to advertise them via SNMP and graph them with MRTG, however...writing the MIB is going to take forever, not to mention handling three versions of Solaris and different information based on what class of machine. My questions is, does anyone know of a way to take a C structure, mix some additional info (like where in the MIB it goes) and output a MIB definition? I swear, writing the MIB definition is harder then writing the C code to compile in to net-snmp!"
Sometimes it's easier to write a program to write the program than to write the program.
Perl, awk, sed, tcsh, bash, Java, and Python are your friends...
That's no troll. It's the truth. I too am mystified. Perhaps the Men In Black want to keep it that way.
If tits were wings it'd be flying around.
But, does that make the original poster a troll? Perhaps you should RTFM and find out what a troll is and how that's different than offtopic?
If tits were wings it'd be flying around.
Decisions, decisions. Post at +2 or not? It's an extra click to post at +1, so +2 it is. Taco should change the default to +1.
If the original message was a waste of electrons, then your threads are a waste too. Have you considered that all electrons are actually recycled, and thus you can't really waste them?
If tits were wings it'd be flying around.
My point is that regardless of whether or not the poster trolled or is offtopic they didn't have a clue and shouldn't have posted in the first place.
Furthermore, regardless of how the comment was moderated it was a waste of electrons to post in the first place.
Lastly, IMO using your +2 to post a response to poor moderation is a waste as well, and draws attention away from the actual point of the post.
Ack!
:)
To write that you're right or not to write that you're right.
Bottom line: you're right.
Cheers! Have a good weekend.
From http://foldoc.doc.ic.ac.uk/foldoc/foldoc.cgi?query =mib&action=Search
Management Information Base
(MIB) A database of managed objects acessed by network management protocols. An SNMP MIB is a set of parameters which an SNMP management station can query or set in the SNMP agent of a network device (e.g. router).
SNMP has two standard MIBs. The first, MIB I, was established in RFC 1156, was defined to manage TCP/IP-based internets. MIB II, defined in RFC 1213, is basically an update to MIB I.
Standard minimal MIBs have been defined, and many hardware (and certain software, e.g. DBMS) providers have developed private MIBs in ASN.1 format allowing them to be compiled for use in a Nework Management System. In theory, any SNMP manager can talk to any SNMP agent with a properly defined MIB.
See also client-server model.
(1994-11-14)
Once the data is exposed via SNMP he can use standard SNMP tools (like MTRG) to get and analyze the data.
The problem that he's having is in exposing the data.
I took a quick peek at yahoo for info on how to write a MIB... go to http://google.yahoo.com/bin/query?p=how+to+write+a +MIB&hc=0&hs=0
I think that your best bet is to search for examples on the net.
I suggest that you read The Simple Book (and check out this listing).
(The tools that I work on use MIBs for network discovery)
I suggest that if you don't know about a topic in Ask Slashdot that you go do a little web searching rather than simply post statements like "I don't get it."
Try helping yourself. I was able to find tons of information by just doing a 5 second search.
I still don't have the faintest idea what he wants to do, though, but I'd like to get enlightened
If you want to know more about SNMP, check out this PDF.
One could also check out my friend's homepage, where he offers SNMP walks of his badass Olicom Switch. Node 2 is interesting.
Bo
its a data format to output to -- kinda like an XML tree with data populated into it that SNMP management devices can use to gather info on the device being queried. well..thats the easy explanation anyway. :)
for the poster -- i know what youre trying to do -- ive dont it myself and its a bitch. took me two weeks.
good luck..i havent found any tools to do this and you need to do it manually from my experience...read the RFC and crunch on it.
Can someone quickly explain MIB?
Thanks.
I can't imagine a tool that would take a header file and convert it into a MIB. Too much additional info would be required, and providing all of that info would be just as tedious as constructing the MIB by hand: either way, you would need to learn some funky new syntax and type a whole bunch of text.
Building a MIB isn't as hard as you make it sound. Yes, all of the different possible field attributes can be daunting. Yes, the syntax is arcane (and probably should be replaced by an XML schema). But really, you should only need the bare minimum to get access to the data you want.
My advice: skim the SNMP RFC, then hunt around and find a simple third-party MIB to use as a template. Don't try to write it from scratch. Finally, fire up an agent with the MIB, and talk to it using some standard snmpget/snmpset tools to make sure it's all happy before you try to patch it into your larger system.
Good luck!
Are there other languages with advantages in the areas you seek? Like Java?
Download UCD-SNMP. It's got a lot of the kstat stuff already in it. I use it an MRTG to graph just about everything worth graphing on my Solaris boxen. :)