| Author | Forum: PowerSNMP for .NET Topic: Creating dummy in-coming variables not defined in the MIB |
| BRiddle From: Jacksonville, FL USA Posts: 2 Member Since: 05/04/09 |
posted May 4, 2009 9:58 AM I am new to SNMP and am having trouble figuring out how to add new variables with VarNames to a message sourced from an incomplete MIB. We have a new firewall vendor whose SNMP support seems to be mainly a marketing bullet. His MIB is tiny and short and provides only for an SNMP v2 message which arrives with an OID of "0.0" and one variable in the Variables array. The value for that variable contains the vendor's entire 20+ data field normal SysLog record in a space-delimited format. I thought the most graceful way to integrate this vendor into our rule-based SNMP monitoring would be to have a custom parser class which would identfy the data fields. It would then create and add additional Variables to the Variables array whose ID would the one MIB-defined OID plus an incremental number, the VarName would be the name of the Syslog field, and VarValue the value. There would, as I said, no MIB information for these new variables. But the rest of the the SNMP monitor would be able to consume this NotifyMessage without the vendor fixing his MIB. (We also have an additional vendor that it looks so far like they may be doing this same thing; dumping generic data into one value of a single all-purpose variable in their MIB). I thought I could create that variable as a SimpleType.Opaque class. But the PowerSNMP Variable constructor does not seem to allow me to define an ID, a VarName, and a VarValue for such an ad hoc new variable. I can create the new Variable with an ID and Value; but the VarName is then a read-only property and cannot be set. I really need variable name plus value in the newly created variables to get the rest of the monitor to swallow this without changes. All of the other overloads for the Variable constructor seem to require pre-defined MibNodes. I see in the PowerSnmp sample code that I might be able to use the limited predefined Dart.PowerSNMP.MibObjects to put in some of the values where the names and meanings match; but not how to create values for whom there is no pre-defined class. How should I handle this without having to write new MIB's for vendors that play the game like this? What am I doing wrong here? Or is it easier to create a dummy MIBNode than it seems? Thanks! |
| Jason Farrar (Admin) From: Oneida, NY USA Posts: 223 Member Since: 07/24/07 Extra Support Options Custom Application Development |
posted May 5, 2009 10:02 AM Well, first thing first. Any message's variables only contain the OID and the value, there isn't a name for the variable in the actual structure of the message. The name comes from a MIB. So you could create a new variable sans the name with the OID that you want and the correct value. I don't know what you are using to monitor the SNMP traffic but I bet it uses the mibs to get any name information. If that's the case then the easiest way to do what you want is to actually create your own MIB and then use the mib class generator to generate class file. The alternative is to create a set of classes that inherit the MibNode class and define the mib there. You can take a look at Mib.cs and DartSamplesMib.Mib in the agent sample to see how the variables in the Mib file correlate to the generated Mib.cs. |
| BRiddle From: Jacksonville, FL USA Posts: 2 Member Since: 05/04/09 |
posted May 6, 2009 10:08 AM >I don't know what you are using to monitor the SNMP traffic but I bet it uses the mibs to get any name information< Actually we're using a home-grown app with PowerSNMP, for our previous, all-v1 Trap message traffic, doesn't use MIBs at all once it receives and identifies each message. It uses straight text parsing to pull out variables and parse them into name-value pairs. There is then an XML configuration file that provides mappings between VarName-or-VarID to a standard set of database columns. A rules engine runs against the database every 5 minutes and performs actions as required. This approach gave us the flexibility to deal with multiple vendors who put more fields in the values within the Variables array than they broke out in their MIBs. This has been our first foray into SNMP. We were surprised to see that several of our security device vendors only pay lip service to the rules and intent of SNMP. By cramming other content into generic Variable values, they can still show a marketing bullet point that says they "offer SNMP". The arrival of our new firewall which only does v2 has forced us into straight MIB processing. I'll look at the MIB.cs and DartSamplesMib.Mib to see how to proceed. We'd still like to create ad hoc variables on the fly with text names. Perhaps we can subclass somewhere in Dart's hierarchy and provide a way to make VarName writeable when/after using the new Variable(string, string) constructor. |
| Reply | PowerSNMP for .NET Topics | Forums |
This site is powered by
PowerTCP WebServer for ActiveX
|