>     I set the maximum valid index number to 1. When I run snmpget for
> a table item the instance number has to be 1 and cannot be 0. Otherwise
> it returned "No Such Instance currently exists at this OID".  Why?

Look at the definition of a "simple table":

  1)  It is indexed by a single integer value;
  2)  Such indices run from 1 to a determinable maximum; 

(from http://www.net-snmp.org/tutorial/agent/06-table1.html
 or AGENT.txt)

> It seems the maximum valid index number has to greater than 0. 

Yes.
If the index values run from 1..N, then it doesn't make sense for N to be 0



>  I still don't understand the purpose of setting the maximum valid
> index parameter in the header_simple_table API. 

The idea of a "simple table" is that the routine 'header_simple_table'
can take care of most of the work of deciding whether a particular
request is valid.   In order to do this, it needs to know what the
size of the table is.

   If you got a request for "myColumn.25", is this valid?

The answer is that it depends on the table.   If this table is a list
of all the students in the department, then it probably is.
If this table is a list of what I'm doing each hour in the day,
then it definitely isn't.

So the code would call
        "header_simple_table( .....,   MAX_NUM_STUDENTS)"
or
        "header_simple_table( .....,   24 )"

respectively.

>   The AGENT.txt file said "the maximum index value parameter does not
> have to be a permanently fixed constant. It specifies the maximum valid
> index at the time the request is processed, and a subsequent request may
> have a different maximum."
> 
>   I haven't encountered any application which needs to alter the maximum
> valid index. If you could please give some explanation. I'd appreciate.


Let's take the example of the list of all students in the department.
Last year we had about 400 students, so MAX_NUM_STUDENTS=400
We're currently a growing department, so this year we might have 450

Now I *could* edit the code to change the MAX_NUM_STUDENTS defined constant,
and recompile.  But it seems more useful to have a separate variable
"current_number_students", and use that as the final parameter:

        "header_simple_table( .....,   max_num_students)"

Most of the time, this value will be constant throughout the year.
It's only in September when I process the new intake, that I'd need
to adjust this value  (perhaps by "snmpset .... numStudents i 450"
or by signalling the agent to load the new data file)

OK?

Dave



-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
_______________________________________________
Net-snmp-users mailing list
[EMAIL PROTECTED]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to