------------------ Original ------------------ From: "Dave Shield"<d.t.shi...@liverpool.ac.uk>; Date: Mon, Feb 1, 2010 05:23 PM To: "Alexander King"<new...@foxmail.com>; Cc: "net-snmp-users"<net-snmp-users@lists.sourceforge.net>; Subject: Re: trap initializing ----what is the " /* insert index here */ " meaning?
On 1 February 2010 03:33, Alexander King <new...@foxmail.com> wrote: > int > send_fcPorttrap_trap( void ) > { > ??? netsnmp_variable_list? *var_list = NULL; > ??? oid fcPorttrap_oid[] = { 1,3,6,1,4,1,30901,2090,2092,0,1 }; > ??? oid fcPort_oid[] = { 1,3,6,1,4,1,30901,2090,7000,2,1,2,1,1,1, /* insert > index here */ }; > > //the fcPorttrap is a child of a table, what is the > " /* insert index here */" meaning here? The MIB object fcPort is a column object of the table. So when you retrieve information (e.g. using snmpwalk), you will do so about a particular "instance" of this object. I.e. relating to a particular row of the table. Different rows of the table may well have different values for this MIB object. So it doesn't make sense to say "what is the value of fcPort". You have to say "what is the value of fcPort in row 6" The same holds true when sending a trap. You need to include the value of fcPort in a particular row - being the row that corresponds to the port that triggered sending the trap in the first place. So you need to include the "index value" of this row in the fcPort_oid. Which is what the comment above is saying > how to initializ it ? The simplest is probably to include a dummy value in the original oid, and then insert the appropriate index value just before sending it. Something like: oid fcPort_oid[] = { 1,3,6,1,4,1,30901,2090,7000,2,1,2,1,1,1, 9999 }; fcPort_oid[15] = myIndex; You'll have to find a way to determine the appropriate 'myIndex' value yourself, together with the corresponding fcPort value for this row. > //the fcPorttrap is a child of a table I do hope it isn't! fcPorttrap is being used to identify a particular trap, which is distinct from the information contained *within* that trap. Have a look at existing MIB files, which define traps. You should see that these "notifications" are typically defined in a separate subtree. And they are *never* defined as children of a table. That is simply not a valid MIB structure. >>>> I am sorry, my fault,I meaning the OBJECT of the particular trap.sorry,My >>>> fault. BTW,the "snmpd daemon auto termination" problem unsolved by now yet.It make me headache for a long while.I am thinking the code file all days. :=) Dave ------------------------------------------------------------------------------ The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com _______________________________________________ Net-snmp-users mailing list Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users