Need help loading and traversing MIBs

2014-05-21 Thread Odiee47 .
Hi,

I am trying to build an agent that could load specified MIBs and then query
selected values. But when I try to print mib information via print_mib my
application crashes. I'm using this code to load MIB

 netsnmp_init_mib();
 read_all_mibs();
 snmp_set_mib_warnings(2);
 //struct tree *tr = netsnmp_read_module(CISCO-RHINO-MIB);
 struct tree *tr = read_mib(CISCO-RHINO-MIB.mib);

 //
 while(tr)
  {
   printf(%s\n,tr-label);
   tr = tr-next_peer;
  }

 FILE *f = fopen(test.txt,w);
 print_mib(f);
 fclose(f);

Using read_module instead of read_mib is practically the same, but
read_module  doesn't display any output, while read_mib will produce this
output
http://imgur.com/rbiieWf
When trying to print_mib to file the program then fails.

Any ideas what I did wrong here?
--
Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free.
http://p.sf.net/sfu/SauceLabs___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Need help loading and traversing MIBs

2014-05-21 Thread Niels Baggesen
Den 14-05-2014 12:05, Odiee47 . skrev:

 When trying to print_mib to file the program then fails.

 Any ideas what I did wrong here?

Please elaborate fails. How does it fail? How much did it write to 
test.txt? Did it even create the file (you should check the return value 
from fopen)

When I tried it I got almost 120.000 lines of output.

/Niels

-- 
Niels Baggesen -- @home -- Ã…rhus -- Denmark -- ni...@baggesen.net
The purpose of computing is insight, not numbers  --  R W Hamming

--
Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free.
http://p.sf.net/sfu/SauceLabs
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders