[ First - *please* don't mail me privately, without copying
any responses to the mailing list. I don't have the time
or inclination to offer private, unpaid, SNMP consultancy.
Keep discussions to the list, where others can both learn
and offer advice. Thanks. ]
2008/5/30 杨伟 <[EMAIL PROTECTED]>:
> For example, I want to fetch information under UdpTable.And the table is
> listed below.
>
> udpLocalAddress udpLocalPort
> --------------------------------------------------
> 0.0.0.0 67
> 0.0.0.0 161
> 0.0.0.0 520
>
> When I want to fetch these information, I should specify the OID of the
> variable. But how could I get this OID before I know the content?
> Such as the first one,(column one , row one) has the OID of
> 1.3.6.1.2.1.7.5.1.1.0.0.0.0.67. But before I get the content of this table,
> I don't know the values.How do I know the address is 0.0.0.0? and the port
> is 67?
You don't. That's why walking a table uses GETNEXT rather than GET.
Try looking at the code of snmptable.c (or snmpwalk.c) again
You should see that they starts with the OIDs of the individual column
objects (or a single object for snmpwalk), and ask for the next OID(s)
after this. That gives you the first row of the table.
You then ask for the next OID(s) after the result you've just received.
That gives you the second row of the table. And so on.
> If I use the snmp_parse_oid() to parse the name and get the OID, what name
> should I put in? UdpTable is ok? or UdpTable.udpLocalAddress?
Either will do - both will give you the same varbind back.
Try this using the "snmpgetnext" command.
> Would you mind tell me what is in the PDU for each record,
> if I want to get the UdpTable?
Yes - I would mind.
I do not have the time to hand-hold you through every single step
of the way. You've got the tools - experiment with them yourself!
Run
snmptable -Ddump ....
and look at what requests/responses are produced.
Try to reproduce this behaviour using snmpgetnext.
Once you're happy with how to use the command-line tools,
then you can try converting these into C-level requests.
But I would strongly recommend that you get familiar with the
basic operations of SNMP first.
Dave
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders