Solved

Simple MIB and how to use it from sending application

Posted on 2011-09-07
7
411 Views
Last Modified: 2012-06-21
Hi all,

I'm new to SNMP, and
I need to create a very simple MIB file, with maybe 3-4 OIDs, and then send a trap that would contain one of them.
I tried to do my homework, but I'm baffled with complexity and incoherence of presentation, so please help.
An extremely simple example of an MIB and an example of how to send it (from C#, C++, a utility that does that - anything, as long as the list of parameters is intelligible or explained) will be perfect.
Kinda taking an easy way out here, but it doesn't hurt to try ;-)
Any help is appreciated,
Gene
0
Comment
Question by:Mi-Jack
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 16

Expert Comment

by:SteveJ
ID: 36507719
Creating your own MIB is non-trivial. You dont want to write your own code to do it. You need to get a C SNMP library and call it from your code. You should be able to google for sample C code and a library. No offense, but if you are having trouble at this stage you may be way in over your head. Look at PERL and snmp lib for some examples.

Good liuck,
Steve
0
 

Author Comment

by:Mi-Jack
ID: 36509573
I can send and receive in both C++ and C#, I just don't know how utilize an MIB, thats all.
Meaning: if I have an MIB that is specific to a company or product, how do I send a trap to reference that specific information? I can reference an OID defined in that MIB, but what else? How?

Sorry if I didn't make myself clear.
0
 
LVL 16

Expert Comment

by:SteveJ
ID: 36510193
So you C code is acting as thr agent? I see. Sorry. Then you need the conf files to be able to map the mib to. EG, "threshold reached" might be OID 1.2.3.4.5. So you find that oid in the MIB and send the variables associated with it. That is. 1.2 might be the company, 3 might be the entity (CPU) 4 might be five minute rate and 5 might be exceeded.

Good luck,
Steve
0
Do you have a plan for Continuity?

It's inevitable. People leave organizations creating a gap in your service. That's where Percona comes in.

See how Pepper.com relies on Percona to:
-Manage their database
-Guarantee data safety and protection
-Provide database expertise that is available for any situation

 

Author Comment

by:Mi-Jack
ID: 36510209
Exactly, but how?
I need a one-line example of an MIB entry, then, but this is making more sense already.
0
 

Author Comment

by:Mi-Jack
ID: 36512847
not sure what to do with this question. no input, close it please.
0
 
LVL 16

Accepted Solution

by:
SteveJ earned 500 total points
ID: 36513658

So here's part of a MIB entry.

********************************************************************
ifOperStatus OBJECT-TYPE
    SYNTAX  INTEGER {
                up(1),        -- ready to pass packets
                down(2),
                testing(3),   -- in some test mode
                unknown(4),   -- status can not be determined
                              -- for some reason.
                dormant(5),
                notPresent(6),    -- some component is missing
                lowerLayerDown(7) -- down due to state of
                                  -- lower-layer interface(s)
            }
********************************************************************

And the last number (1 thru 7) in the ASN notation for the MIB would indicate the interface status (ifOperStatus). So an agent on a Cisco router, for example, would receive a SNMP get in the form of an IOD for the status of an iterface. The agent software would query the interface and see that it is up (1) and return an OID with "1" as the last integer. SNMP management software, such as HP OpenView, would read the returned OID, look up the MIB and see that the last digit is a "1" and report the interface as "up".

So if you wanted to create your own MIB you would write it in Abstract Syntax Notation (ASN1) and put it on an SNMP manager. Then you would write an agent that would query for example an Oracle data base and see that some number of users were currently accessing a specific table. Lets say that you wanted a trap to be sent whenever more than 10 users were accessing a table. So your agent would constantly be checking ( or you are a good programmer and your code would be triggered by an event of some sort) for how many users are accessing a table. Your agent (the C code you have written) would sen an SNMP trap or Inform to the SNMP manager and it would be in the form of an OID, so the trap you are sending might look like 1.3.6.1.4.1.777.31.1, where 777 indicates that it is your company (XYZ company) and the .31 indicates it is an Oracle Threshold Event and the .1 indicates that the threshold has been reached.

Your MIB would contain the definition (as in the example above for ifOperStatus) and the SNMP manager would look up the OID string in your MIB and extract the appropriate string data to display indicating that a threshold had been reached.

There are enterprise MIBs that can be assigned to your company (that will always be preceded by the 1.3.6.1.4.1 OID string) that you can use however you like. If you were developing something that you wanted to market, you would need to follow the ASN1 rules for creating the MIB so that someone using a standard SNMP manager could "compile" your MIB so the manager woudl know what to do with it when it received a trap from your agent.

If you have ever seen an SNMP manager display something like:

EVENT: 1.3.6.1.4.1.2.6.3.3.56.6

That is, there was no way to know what the heck happened from looking at the OID, it is because the MIB wasn't defined to the SNMP manager OR the specific OID wasn't contained in any of the MIBs that the SNMP manager was aware of.

Good luck,
Steve
0
 

Author Comment

by:Mi-Jack
ID: 36514261
This gives me sufficient help to get where I need it to be, thank you.
0

Featured Post

Put Machine Learning to Work--Protect Your Clients

Machine learning means Smarter Cybersecurity™ Solutions.
As technology continues to advance, managing and analyzing massive data sets just can’t be accomplished by humans alone. It requires huge amounts of memory and storage, as well as the high-speed power of the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
Recovering from what the press called "the largest-ever cyber-attack", IT departments worldwide are discussing ways to defend against this in the future. In this process, many people are looking for immediate actions while, instead, they need to tho…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question