I am completely new to the concept of SNMP and I do not have a strong Linux
background either, however, I have been given the task to integrate SNMP into
my work environment so we can gather information from our hardware boxes we
manufacturer.
** If this is the wrong group/forum to post general noob questions, then please
let me know where I should be posting my questions.
Here we go ....
Someone here tells me we are running in a Linux (Fedora) environment if that
matters. I believe SNMP packages already exist on our Linux systems although
no one currently uses it. Also, please keep in mind I am not trying to do
anything remarkable here to start off. I simply want to get a real "basic"
NetSNMP configured so I can test it out and play around with what it can do.
CONFIGURATION
-------------------------------------------
Anyway, here is a summary of what I have done along with some questions:
1) I downloaded NetSNMP v5.4 and extracted the contents onto my Linux machine
into the following directory:
/export/home/myname/snmp/net-snmp-5.4/
2) I downloaded the OC-STB-HOST-MIB which I need to use and placed that into
the following directory as:
/export/home/myname/snmp/net-snmp-5.4/mibs/OC-STB-HOST-MIB.txt
Note: MIB is on page 98 in
"http://www.opencable.com/downloads/specs/OC-SP-HOST2.0-CFR-I13-070323.pdf"
3) I did not want to install NetSnmp in the default location of "/usr/local"
since I wanted to play around with it first. As a result I decided to try to
install it into "/export/home/myname/snmp/usr/local" location instead. I
issued the following "configure" command (and kept all the defaults when
prompted to enter selections):
./configure --prefix=/export/home/myname/snmp/usr/local
--with-mibs=+OC-STB-HOST-MIB
--with-mibdirs="/export/home/myname/snmp/net-snmp-5.4/mibs"
4) After running the configure command, I performed a "make" and then performed
a "make install"
Note: After the "make install" was performed, I noticed that the
"/export/home/myname/snmp/usr/local" directory tree was populated with files
now.
5) Finally, I issued the "snmpconf" command to configure a "snmpd.conf" file
for my agent. I really did not understand what values I should be using here,
so I pretty much did not add anything. now, I do not think this matters since
I have general non-agent questions.
After performing the above steps, I went to the NetSNMP "tutorials" section and
clicked on "snmptranslate". I tried to issue some "snmptranslate" commands on
my OC-STB-HOST-MIB file but nothing worked. It could not find my
OC-STB-HOST-MIB file.
After trying many combinations of options for the "configure" command, I could
only get the "snmptranslate" commands working for my MIB after I placed my
"OC-STB-HOST-MIB.txt" file into the "/usr/local/share/snmp/mibs" directory and
after issuing the following basic "configure" command only:
"./configure"
Basically, if I included any sort of options for the "configure" command, then
NetSnmp would produce the following error:
"Cannot find module (+OC-STB-HOST-MIB): At line 1 in none)"
What I discovered is that NetSNMP expected my MIB file to be placed in the
default "/usr/local/share/snmp/mibs" directory even though I explicitly stated
in my "configure" command (see above) that the MIB directory should be
"/export/home/myname/snmp/net-snmp-5.4/mibs".
I also discovered that it did not like the "--with-mibs=+OC-STB-HOST-MIB"
option for the "configure" command as well. If I use this option, then it
would produce the error (see above).
** QUESTION 1):
Why does NetSNMP not find my MIB file if I place it in the
"/export/home/myname/snmp/net-snmp-5.4/mibs" only?
** QUESTION 2):
Why does "configure" not like my "--with-mibs" and "--with-mibdirs"
command-line options?
CODE GENERATION:
-----------------------------------------
I now wanted to generate some code modules (.c/h) for the
ocStbHostAVInterfaceTable listed in the OC-STB-HOST-MIB.
I picked this table for testing only since there is no need to generate code
for all tables and scalars yet.
I created the following directory to store the code files:
/export/home/myname/snmp/net-snmp-5.4/agent/mibgroup/ocStbHost-mib/ocStbhostAVInterfaceTable/
Before executing the "mib2c" command, I set the "MIBS" environment variable to
"MIBS=+OC-STB-HOST-MIB" then ran the following command:
mib2c ocStbHostAVInterfaceTable
The error below was produced once again:
"Cannot find module (+OC-STB-HOST-MIB): At line 1 in none)"
** QUESTION 3)
Am I using the MIBS environment varible incorrectly? What am I doing wrong?
Now after playing around a bit, I found that if I set the "MIBS" environment
variable to "ALL" then the error went away and I was prompted for information.
The choices I entered are listed below:
2) Net-SNMP style code
1) tables where the list of rows is external to the agent.
This is suited to MIBs which monitor or manipulate external
data (perhaps extracted from the operating system kernel
or other system interfaces), and where rows are typically
created or destroyed independently of the SNMP agent.
3) An API layer (not based on the iterator helper) that attempts
to reduce the amount of SNMP specific knowledge required to
implement a module. It provides more APIs than 2, which are
(hopefully) smaller and more specific, with less SNMP terminology.
This API is also known as "MIBs for Dummies". Numerous tables
in the Net-SNMP agent have been re-written to use this API.
The same templates can be generated using
mib2c -c mib2c.mfd.conf ocStbHostAVInterfaceTable
(See the agent/mibgroup/if-mib/ifTable/ifTable*.c files for examples)
There are no defaults for ocStbHostAVInterfaceTable.
2) Set defaults now [DEFAULT]
1) No, use netsnmp_data_list [DEFAULT]
1) No, use generated [DEFAULT]
2) yes, initilization is needed [DEFAULT]
1) All values will be stored as defined by the MIB [DEFAULT]
2) container-cached : This access method uses a netsnmp_container
to keep track of the indexes (and data, usually) for each
row. This method is best for:
- External data (maintained by another process/the kernel)
- Access speed is important
- Sufficient memory exists to contain all indexes
1) Yes. My data is TRANSIENT (e.g. a pointer to a static buffer that
my be overwritten during a request) and needs to be copied during
processing.
1) generate example code [DEFAULT]
1) No, all columns always exist for every row [DEFAULT]
2) generate makefile/AgentX code
This resulted in code being generated and placed into the following directory
as desired:
/export/home/myname/snmp/net-snmp-5.4/agent/mibgroup/ocStbHost-mib/ocStbhostAVInterfaceTable/
CODING
----------------------------------------
Before proceeding I read the "MFD: If-Table" tutorial to be able to understand
how code should be inserted to allow me to be able to perform a "GET" on the
"ocStbHostAVInterfaceTable" rows/columns.
Here is code I inserted:
In the "ocStbHostAVInterfaceTable_init_data" procedure:
- Indicated "all" columns would be supported (as recommended in the tutorial).
In the "ocStbHostAVInterfaceTable_container_init" procedure:
- Added the "cache->flags |= NETSNMP_CACHE_PRELOAD;" line (as recommended in
the tutorial)
In the "ocStbHostAVInterfaceTable_container_load" procedure:
- There are 21 different kinds of AVInterfaces defined in the MIB. I obtained
a unique index (ie: ocStbHostAVInterfaceIndex) for each row and I added 21
unique pairs by calling the "se_add_pair_to_slist" procedure as follows:
se_add_pair_to_slist("ocStbHostAVInterface",
strdup(ocStbHostAVInterfaceDesc), ocStbHostAVInterfaceIndex);
- I also set default column values as well.
** My goal is to be able to perform a "GET" on this table and see if NetSNMP
displays the data.
Now, the "MFD: If-Table" tutorial has a section called "MFD : ifTable data GET"
which I could not understand at all, and did not see how the code presented
should be incorporated into my code. Possibly this is because the tutorial
was written for an earlier NetSNMP version (5.2?) and I am using 5.4, so the
code might have changed, thus making this tutorial section no longer required?
I search the ifTable MIB code, in which the tutorial was based and could not
find any reference to the "ARPHRD_xxx" or "INTERNAL_xxx" values being
used in the code in this manner. Basically, I found no mapping be used between
the two values.
** QUESTION 4)
Does the mapping between "ARPHRD_xxx" and "INTERNAL_xxx" values still need to
be performed? If so, please explain what in the world this means, since this
section of the tutorial did not make sense to me.
TESTING (doing a GET)
------------------------------------
Ok, the last section of the agent is "MFD: ifTable testing". I tried following
this in order to do a GET, but it did not work. Here is what I did:
- I performed the following "make" command whichi resulted in no errors:
make -f ocStbHostAVInterfaceTable_Makefile
** QUESTION 5)
After this command I am suppose to have an executable created. What does this
file look like? There is a file called "ocStbHostAVInterface" with not
extension at all .... is this the executable file?
- The if-Table tutorial now indicates I could use a "AgentX Sub-agent" or a
"Standard SNMP agent".
** QUESTION 6)
I have no idea what the difference is betweena AgentX Sub-agent or a "Standard
SNMP Agent". I have read text which states that I could "extend the agent",
but I really could never figure out exactly what that means or why I would want
to do this.
Anyway, I tried to execute the following "Standard SNMP Agent" command:
./ocStbHostAVInterfaceTable -f -L -DocStbHostAVInterfaceTable -M
localhost:1161
.... and I got the following error:
"./ocStbHostAVInterfaceTable: error while loading shared libraries:
libnetsnmpmibs.so.15:
cannot open shared object file: No such file or directory"
** QUESTION 7)
What does this error mean and how can i resolve it? Is this error a result of
not configuring
my agent correctly at the start perhaps?
Now, I tried to execute the following "AgentX" command to give it a try:
ocStbHostAVInterfaceTable -f -L
.... and I get the following error:
ocStbHostAVInterfaceTable: command not found
** QUESTION 8)
This is a general question. The tutorial has a section called "Starting the
agent" and I can not figure out what it means to "Start the agent". Does
running the "ocStbHostAVInterfaceTable" executable mean that I am "starting the
Agent" for that table? If I eventually execute the mib2c command for all the
tables
and scalars listed in the OC-STB-HOST-MIB file then will I start "one" agent
which will moderate all of the tables/scalars for me, or must I start an agent
for each table and scalar individually somehow? Perhaps someone can explain
what "starting the agent" means and how to do it.
Ok, this is all I got through so far. I have been reading this stuff for
2-1/2 weeks and progress is about as fast as a snail can run, so any
information someone can provide would be greatly appreciated. Again, I am not
a Linux user (my career has been with Windows) and I have no prior knowledge of
SNMP other than my past 2-1/2 weeks of reading, so be kind :>)
Regards,
SnmpNoob
Choose the right car based on your needs. Check out Yahoo! Autos new
Car Finder
tool.http://us.rd.yahoo.com/evt=48518/*http://autos.yahoo.com/carfinder/;_ylc=X3oDMTE3NWsyMDd2BF9TAzk3MTA3MDc2BHNlYwNtYWlsdGFncwRzbGsDY2FyLWZpbmRlcg--
hot CTA = Yahoo! Autos new Car Finder tool
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders