On 27.10.2012 21:16, Magnus Fromreide wrote: > On Sat, 2012-10-27 at 20:45 +0200, Garry wrote: >> On 27.10.2012 20:05, Magnus Fromreide wrote: >> I know the shell level requests (snmpbulkwalk), trying to get this done >> in C ... > Good. > >>> Is any of them a table? >> e.g. I'd want to get several values at the same time that are associated >> to an interface, e.g. bytes sent, received, errors > Ok, then we are onto something. > >>> If none of them is a table then I think a Get or GetNext suits your use >>> case better, but remember that you can put many request OID's in them as >>> well. >>> >> Are there any examples of this around? > I am not certain about what you are asking for here but... > > You start by figuring out what request you wish to send, for now I am > assuming that you wish to do > > snmpbulkget -Cn1 -Cr20 localhost sysUpTime ifOutOctets ifInErrors > > then the way to do that from C is > > pdu = snmp_pdu_create(SNMP_MSG_GETBULK); > pdu->non_repeaters = 1; > pdu->max_repetitions = 20; > { > oid o[] = { 1, 3, 6, 1, 2, 1, 1, 3 }; > snmp_add_null_var(pdu, o, OID_LENGTH(o)); > } > { > oid o[] = { 1, 3, 6, 1, 2, 1, 1, 2, 1, 16 }; > snmp_add_null_var(pdu, o, OID_LENGTH(o)); > } > { > oid o[] = { 1, 3, 6, 1, 2, 1, 1, 2, 1, 14 }; > snmp_add_null_var(pdu, o, OID_LENGTH(o)); > } > > and then you send the pdu. Looking good, except that SNMP_MSG_GET is actually more of what I need here, with the multiple exact OIDs added to the PDU, resulting in the values I need ... the modified snmpdemoapp I used as a basis is performing fine with multiple value request ...
Thanks for the help! -garry ------------------------------------------------------------------------------ WINDOWS 8 is here. Millions of people. Your app in 30 days. Visit The Windows 8 Center at Sourceforge for all your go to resources. http://windows8center.sourceforge.net/ join-generation-app-and-make-money-coding-fast/ _______________________________________________ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders