More help to make the Agent.

Marcelo Nobrega (mnobre@inf.puc-rio.br)
Thu, 7 Nov 96 12:40:09 EDT

Hi all,

Tanks (Buz and Damir) for your help, you gave me good tip to make
the manager, but I'm having problems to make the agent. And some basic
questions.

Supose that I have this mib:

MIB: myMib myMibtable myMibEntry myMibVarA (username)
myMibVarB (fullname)
myMibVarC (mboxsize)
myMibVarD (lastlogin)
.....

I have the user name and I want to retrieve the row. Do I have
to retrieve all users, find the one, get the instance number and send one
other get to retrieve the row ? Or I can do something like this:

(manager code) set username "marcelo"
$s get myMibVarB.$username

(agent code) bind myMibVarA get {
set username "%i"
set _myMibVarB($username) [Find_FullName($username)]
$s instance myMibVarB.$username _myMibVarB($username)
}

I know that it don't work, but is it possible to do something
like this ? How ???????? I tryed everythig, exept the right !

Do I have to load all the table with the agent and keep updating
this data everytime ?

I have some big tables and I don't want to load all in the agent
and transfer all rows to the manager.

thanks for your time and help.

Marcelo

At 20:54 29/10/96 -0500, you wrote:
>...
>> week). I have one Mib, one very simple agent and I'm using the aplication
>> mibtree and scwish shell to test this agent and learn more about scotty. The
>> scotty man page and the agents examples are very usefull for me.
>>
>> For now, I can get some instances (statics or not) of my mib and See
>> the instances of a table or all the table. But i did this loading all the
table
>> when the agent is started. There are two things I'm trying to do and i can't.
>>
>> 1) Use the index objects of the table to get one intance of some
>> object or one row of this table.
>
>> 2) Make the agent load only the requested row at execution time.
>>
>
>Suppose you have a mib table with variables myMibVarA, myMibVarB, etc. in its
>rows. Identify one variable which is guaranteed to always be in every row.
>Any one of the variables which happens to be in the index set for the table
>qualifies automatically, but it is never stictly necessary to retrieve an
>index variable (because such values can be extracted from the oids of other
>variables). If myMibVarA is such a variable, the following scotty statement:
>
> set indices {}
> set oid [ mib oid myMibVarA ]
> $sessionid walk x myMibVarA {
> set tmp [ lindex $x 0 ]
> set id [ lindex $tmp 0 ]
> regexp $oid\.(.*) $id junk idx
> lappend indices $idx
> }
>
>will put the current set of row indices into the variable `indices', each time
>it is executed. (You would execute this perioodically in a scotty script, that
>you write, in place of using mibtree.) Subsequently, or inside the same loop,
>after producing the variable `idx', these indices can be used to retrieve the
>other variables in the rows of the table which turn out to be new rows, (as for
>example "$sessionid get myMibVarB.$idx"). If several variables in a table are
>always going to be retrieved in a table, something like {myMibVarA myMibVarB
>myMibVarC myMibVarD} can be substituted for myMibVarA as the second argument
>to walk - but if you are using the walk to discover new rows, you may not want
>to retreive the variables from rows that are already in the table.
>
>Now, suppose that the index variables for this table are myMibInx1 and
>myMibInx2,
>that myMibInx1 is the first index variable, and has some specific meaning, like
>being an ip address, such that all rows in your table that pertain to some
>specific
>host have that host's address in myMibVar1 in that row. Modify the above loop
>to
>start:
>
> $sessionid walk x MyMibVarA.$host {
>
>This will restrict the walk to only rows which concern the host whose ip
>address
>is in $host - thus using the mib walk as a sort of database query.
>
>> Can somebody help me ? Maybe one example of a code can help.
>
>hope this helps.
>
>/b
>
>
>
>

+------------------------------------------------------------------------+
| |
| Marcelo G. W. da Nobrega e-mail: mnobre@inf.puc-rio.br |
| DTC-21 Embratel mgaspar@net.ebt.anrj.br |
| Av. Presidente Vargas 1012/1118 |
| Centro - Rio de Janeiro - Brasil http://inf.puc-rio.br/~mnobre |
| |
+------------------------------------------------------------------------+