On 17 August 2011 05:29, sujata patra <[email protected]> wrote:
> Let me explain with an example .....
> Let's say there is an ABC table and abcIndex is key
OK - so you've got a MIB table 'abcTable', defined with "INDEX {abdIndex}"
You've also got an SQL table 'abcTable' with primary key 'abcIndex'
With you so far.
> Now there is second one DEF Table and its oid is formed using root oid
> of the DEF table appended with abcIndex and defIndex.
So that's a MIB table 'defTable', defined with "INDEX {adbIndex, defIndex}"
And an SQL table 'defTable' with a key pair '(FOREIGN abcIndex, defIndex)'
No problem there.
> If I like to store the rows in database , abcIndex will be the primary key of
> the ABC table( in database) and for the second table , the primary key is
> abcIndex+defIndex.
Yes.
That would work easily enough.
> So I was wondering what will be the easier way to store the snmp data in
> database table.
The easiest way would be to have the structure of the database tables match
those of the MIB definition. The closer the mapping, the easier the
storage of
the data.
> Rows are dynamic.
Yes. So as you query the agent, and discover rows being created/deleted,
you'd update the database to match.
The simplest way to do that (though not the most efficient) would probably
be to clear the database table completely, and walk the MIB table in its
entireity. But there are better ways to handle this, without throwing away
perfectly valid data.
> I mean to say they are not scalar in nature.
I'm sorry - that doesn't make sense again.
Tables are not the same as scalars - sure.
That's like saying that integers are not the same as strings.
Whether the rows of a table are static or dynamic is purely
down to the table in question. Scalars simply don't come
into it.
> More over generally the Index fields are MAX-ACCESS
> not-accessible.
Yes - because that information is available via the OIDs of the
accessible column instances.
> Parsing the oid and forming the primary key is the harder way to do .
But that's the way that SNMP operates.
Don't be so damn lazy! :-)
> Any easier way ?
Use the parsing routines that come as part of the Net-SNMP liibrary.
Given the index structure of the table, unpicking an OID into the
constituent element is straighforward, and there are routines to do
exactly this.
Have a look at how the table helper works, to see this in action.
Dave
------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system,
user administration capabilities and model configuration. Take
the hassle out of deploying and managing Subversion and the
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders