HI Greeting: I don't have much experience in snmp. I had learned some idea from studying the example and interface source code of how to implement the a table in agent. However I still need to fill up some gap and unclear concept. I would like to ask the clarification from the experienced snmp developers.
E.g I would like to see : snmpwalk 192.168.38.254 -c public xyzModuleID return 1.3.6.1.4.1.9926.1.21.1.2.1.1.1.100 = INTEGER: 100 (1.3.6.1.4.1.9926.1.21.1.2.1.1.1 is defined as xyzModuleID) snmpwalk 192.168.38.254 -c public 1.3.6.1.4.1.9926.1.21.1.2.1.1.1 case 1: host 192.168.15.5 Running Controller (110) case 2: hsot 192.168.15.6 Running Controller (120), Collector(121) snmpwalk 192.168.15.5 -c public xyzModuleID snmpwalk 192.168.15.5 -c public xyzModuleType.110 case 1: host 192.168.15.5 Running Controller (110) case 2: hsot 192.168.15.6 Running Controller (120), Collector(121) (both controller and collector run on one host) After I studied the interface code. I think I can initialize the data at the time of MIB registration, by reading the text file where the information of the so called controller and collector(s) are recorded. Each line has the information of the ip address, id, module type, status, etc. At the var_table() routine I can get the returned id or ip address by searching the stored data. One thing I am not sure is how do I achieve the output something like the following - snmpwalk 192.168.38.254 -c public ifIndex RFC1213-MIB::ifIndex.1 = INTEGER: 1 RFC1213-MIB::ifIndex.2 = INTEGER: 2 RFC1213-MIB::ifIndex.3 = INTEGER: 3 RFC1213-MIB::ifIndex.4 = INTEGER: 4 Or for my case - snmpwalk 192.xx.xx.xx -c public modulId My-MIB::xyzModueld.1 = INTEGER: 100 My-MIB::xyzModuleId.2 = INTEGER: 110 My-MIB::xyzModuleId.3 = INTEGER: 120 My question is for var_ifEntry there is some target to be compared with during the run time. I simply want the agent to "list" all the configured modules (whether it's controller or collector(s) (up to the system specified number) when the snmpwalk on the oid of the moduleId. Will a header_simple_table routine sufficient enough to handle the iteration? Or a customized header_xxx like header_ifEntry is needed? I am using the 4.0 api. If the header_simple_table routine is sufficient I assume the MAX_VALID_INDEX is to be set to the total possible number of moduleId? (said 5, 10, 20 ,etc.) I think what I am not clear about is how all the rows of data in the table are returned? Each time the var_table() returns one value and goes on the next oid, isn't it? How do I "list" them (the same oid but different instance) in the way such as: snmpwalk 192.xx.xx.xx -c public modulId My-MIB::xyzModueld.1 = INTEGER: 100 My-MIB::xyzModuleId.2 = INTEGER: 110 My-MIB::xyzModuleId.3 = INTEGER: 120 ................................ I'd appreciate your guidance to help me move in the right direction. Thanks, Jim