SNMP

Discussion to talk about software related topics only.
SeeCwriter
Posts: 635
Joined: Mon May 12, 2008 10:55 am

SNMP

Post by SeeCwriter »

In the SNMP section of the NB Lib Ref Manual, it says to convert your MIB to a cpp file using snmptranslate utility. It even gives an example command line invocation:

snmptranslate -M ./ -Tn > NBurn_Cname_Mib.cpp

But there is no -Tn option. Does anyone know what feature was desired by that option?

Also, when I run snmptranslate on my MIBs, it only generates errors about not finding other MIB files that
my MIBs reference. I put those MIBs all in the same directory and I still get the same errors. I then added the directory the MIBs are in to the command line options, and I still get the same errors. Any ideas on what snmptranslate needs?

FYI, my MIBs are known working MIBs that work with both a comercial MIB Browser and the net-snmp tools.

Steve
greengene
Posts: 164
Joined: Wed May 14, 2008 11:20 am
Location: Lakeside, CA

Re: SNMP

Post by greengene »

try running
snmptranslate -h
SeeCwriter
Posts: 635
Joined: Mon May 12, 2008 10:55 am

Re: SNMP

Post by SeeCwriter »

I did. That's how I learned that -Tn wasn't a valid option. I also tried using the -m option where you list
the MIB files to use. That got rid of the errors, but the new cpp file it created was empty.

I also tried: snmptranslate -h > help.txt

and got an empty file also. So does redirection even work with this utility?
greengene
Posts: 164
Joined: Wed May 14, 2008 11:20 am
Location: Lakeside, CA

Re: SNMP

Post by greengene »

here's a capture of what i did:

gmorgan@Dell6400 /workspace/mibs
$ snmptranslate -V
UCD-snmp version: 4.2

gmorgan@Dell6400 /workspace/mibs
$ dir ./work
RFC-1215.TXT RFC1155-SMI.txt RFC1212-MIB.txt SNMPv2-TC.txt eband-mib_v16.mib

gmorgan@Dell6400 /workspace/mibs
$ snmptranslate -M ./work -Tn > testmib.cpp

gmorgan@Dell6400 /workspace/mibs
$ head -n20 testmib.cpp
/* Autogenerated MIB source file */
#include <predef.h>
#include <stdio.h>
#include <ctype.h>
#include <startnet.h>
#include <ucos.h>
#include <udp.h>
#include <counters.h>
#include <utils.h>
#include <system.h>
#include <asn1.h>
#include <snmp.h>
#include <snmp_table.h>




//Un comment these variables if you want to use them
//snmp_typeINTEGER snmp_var_mIBVersionMajor;
//snmp_typeINTEGER snmp_var_mIBVersionMinor;

gmorgan@Dell6400 /workspace/mibs
$
SeeCwriter
Posts: 635
Joined: Mon May 12, 2008 10:55 am

Re: SNMP

Post by SeeCwriter »

I see you are using a different version of snmptranslate. I am using v5.5.

I have net-snmp tools installed so that's what I've been using. I see that NB has installed the same tools
in its development directory. But when I try to run one of those, I get an error message about cygwin1.dll
not found. I notice that NB's snmptranslate.exe file has a 2002 date, while the net-snmp files have a date
of 2009. Perhaps the older version uses cygwin1.dll and the newer versions don't. I've search my
computer and I can not find a cygwin1.dll. Shouldn't NB have installed one if its needed to run the tools?

Steve
greengene
Posts: 164
Joined: Wed May 14, 2008 11:20 am
Location: Lakeside, CA

Re: SNMP

Post by greengene »

i still use command line to compile, etc., so i have cygwin installed; it's the
linux-like os that runs on windows. i've been doing it this way since NNDK1.xx.

i don't know if NB has hooks for snmptranslate under nbeclipse.

progress is overrated ;-))
rnixon
Posts: 833
Joined: Thu Apr 24, 2008 3:59 pm

Re: SNMP

Post by rnixon »

Looking at the NET-SNMP Site:

http://www.net-snmp.org/download.html

IMPORTANT NOTE FOR WINDOWS USERS: the Net-SNMP 5.5 Windows binaries have been built with OpenSSL version 0.9. Since the OpenSSL 0.9 and 1.0 DLLs are incompatible, any attempt to run Net-SNMP on a system where OpenSSL 1.0 has been installed will make Net-SNMP crash.

If you want to use those tools, you will need to install cygwin on your windows machine, which will install the cygwin dll files.

Note sure if there is a native windows version that does not need cygwin.
SeeCwriter
Posts: 635
Joined: Mon May 12, 2008 10:55 am

Re: SNMP

Post by SeeCwriter »

Ok. But I would have thought that the new versions of the net-snmp tools would still support the same
options and functionality as the older versions.
SeeCwriter
Posts: 635
Joined: Mon May 12, 2008 10:55 am

Re: SNMP

Post by SeeCwriter »

I got a copy of cygwin1.dll off the internet. And even though I got errors trying to register it, it still
worked. So now I can run v4.2 of the net-snmp tools.

I ran snmptranslate again, got a few errors that don't make sense. But nevertheless, it did create a
cpp source file.

Correct me if I'm wrong, there is a list of SNMPWRITEFUNC and SNMPREADFUNC macros, and they
appear to be assigning an OID to a variable name and assigning a callback function to the OID. I didn't
find any docs on this.

Where I'm a bit confused is, about the R/W variables. There are functions for Read variables and functions
for Write variables. I also have Read/Write variables. The R/W variables get two callback functions, which
I don't understand why.

The Write callback has an argument of btest. Is this the same as a "commit" argument? On previous
SNMP implementations I've done, when doing a write, there was a commit variable that had to be TRUE
before the variable could be written with the new value. This was because the callback was often called
twice by the SNMP stack. Once to test for the variable and once to actually write the value. But if the
"commit" argument was FALSE, I returned with noerr. Is that what btest is?
greengene
Posts: 164
Joined: Wed May 14, 2008 11:20 am
Location: Lakeside, CA

Re: SNMP

Post by greengene »

OIDs are assigned based on your MIB. that's how the call back functions work
so put your specific info into the appropriate ones. look at the SNMP example
program(s) for um examples.

from your description, the sense of btest is reversed from what you are familiar
with.
Post Reply