Writing SNMP MIBs from C Structs? 23
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!"
Write a program to write the MIB. (Score:1)
Perl, awk, sed, tcsh, bash, Java, and Python are your friends...
Re:Let me see... (Score:1)
Re:RTFM (Score:1)
Re:RTFM (Score:3)
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?
Re:RTFM (Score:1)
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.
Re:RTFM (Score:1)
To write that you're right or not to write that you're right.
Bottom line: you're right.
Cheers! Have a good weekend.
Re:What is MIB? (Score:2)
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)
Re:Acronym deciphering (Score:2)
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 [yahoo.com]).
(The tools that I work on use MIBs for network discovery)
RTFM (Score:2)
Try helping yourself. I was able to find tons of information by just doing a 5 second search.
Acronym deciphering (Score:2)
I still don't have the faintest idea what he wants to do, though, but I'd like to get enlightened
More karmaho'ing (Score:2)
One could also check out my friend's homepage [www.bunk.cc], where he offers SNMP walks [net.bunk.cc] of his badass Olicom Switch [net.bunk.cc]. Node 2 [net.bunk.cc] is interesting.
Bo
Re:What is MIB? (Score:1)
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.
What is MIB? (Score:1)
Thanks.
Re:Acronym deciphering (Score:1)
Ditto. It sounds like he's trying something that I'd like to be able to do, but what exactly does he mean by Does he want to write one of those MIB text files? Or create a C structure to use internally in net-snmp code? Or something else?
You can write a MIB... (Score:1)
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!
Why C (Score:1)
Re:Why C (Score:1)
Re:Why C (Score:1)
No offense intended, but C's day has come and gone. You're opening up yourself to a world of pain by sticking to it. C occupies a non-existant middle ground between high-level languages like Java and low-level languages like assembly.
Your best solution is to write just enough C code to send the data over a TCP/IP socket, and then write the actual presental code in a real language which reads the data from the C program and analyzes the data.
Re:Why C (Score:1)
Re:Why C (Score:1)
Re:Why C (Score:1)
--
Darthtuttle
Thought Architect
Re:You can write a MIB... (Score:1)
pagesOut OBJECT-TYPE
SYNTAX Integer32
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"The pages paged out"
over and over and over and over agian...
The thing about all this is that the data structures are already defined for me in C. I'm pulling kernel structures out of a Solaris box using the kstat interface. I should at least have a skeleton of a MIB created.
I guess I'll just have to write it and convince my employer to let me release it in the wild.
--
Darthtuttle
Thought Architect
Forget all of this! (Score:1)