?
Solved

Simple MIB and how to use it from sending application

Posted on 2011-09-07
7
Medium Priority
?
422 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
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 

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 2000 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

Need protection from advanced malware attacks?

Look no further than WatchGuard's Total Security Suite, providing defense in depth against today's most headlining attacks like Petya 2.0 and WannaCry. Keep your organization out of the news with protection from known and unknown threats.

Question has a verified solution.

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

OnPage enhanced its integration with ConnectWise Manage to offer incident responders more control over the ticket and Incident Resolution Lifecycle.
Introducing Priority Question, our latest feature.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Suggested Courses
Course of the Month12 days, 19 hours left to enroll

777 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