[SNMP4J] [help]newbie Q:How to update a tableRow use SET from the manager?
wei tong
thinkinrelativity at gmail.com
Sat Jun 20 03:28:48 CEST 2009
hi there,
This is the question boring me all the day.
my snmp4j version is 1.10
i use testAgent to start a V3 agent and
i've registered a table(2 columns) on the agent as blow;
---------------------------------------------------------------------
MOColumn[] columns = new MOColumn[2];
int c = 0;
columns[c++] =
new MOColumn(c, SMIConstants.SYNTAX_INTEGER,
MOAccessImpl.ACCESS_READ_CREATE);//Index
columns[c++] =
new MOColumn(c, SMIConstants.SYNTAX_OCTET_STRING,
MOAccessImpl.ACCESS_READ_CREATE);//IP
//the OID
DefaultMOTable ifTable =
new DefaultMOTable(new OID("1.3.6.1.4.1.700.1.2.9.1"), indexDef,
columns);
---------------------------------------------------------------------
Use TableUtils Class the manager can retrieve all the data;
the user is the defalut in testAgent,snmp tools can get it :
snmp4j -a SHA -A SHADESAuthPassword -x DES -P SHADESPrivPassword -u SHADES
-l '80:00:13:70:01:ac:11:1b:2f'
-p GET -Ot 172.17.27.158/161 "1.3.6.1.4.1.700.1.2.9.1"
Index = 1.1:
1.3.6.1.4.1.700.1.2.9.1.1.1 = 1
Index = 1.2:
1.3.6.1.4.1.700.1.2.9.1.1.2 = 2
Index = 1.3:
1.3.6.1.4.1.700.1.2.9.1.1.3 = 3
Index = 1.4:
1.3.6.1.4.1.700.1.2.9.1.1.4 = 4
Index = 1.5:
1.3.6.1.4.1.700.1.2.9.1.1.5 = 5
Index = 2.1:
1.3.6.1.4.1.700.1.2.9.1.2.1 = 192.168.1.201
Index = 2.2:
1.3.6.1.4.1.700.1.2.9.1.2.2 = 192.168.1.202
Index = 2.3:
1.3.6.1.4.1.700.1.2.9.1.2.3 = 192.168.1.203
Index = 2.4:
1.3.6.1.4.1.700.1.2.9.1.2.4 = 192.168.1.204
Index = 2.5:
1.3.6.1.4.1.700.1.2.9.1.2.5 = 192.168.1.205
--------------------------------------------------------------------
now i want to update the first row value;
the first row have two OIDs:
1.3.6.1.4.1.700.1.2.9.1.1.1
1.3.6.1.4.1.700.1.2.9.1.2.1
i used the snmpRequest tool to try:
snmp4j -a SHA -A SHADESAuthPassword -x DES -P SHADESPrivPassword -u
SHADES -l '80:00:13:70:01:ac:11:1b:2f'
-p SET 172.17.27.30/161 "1.3.6.1.4.1.700.1.2.9.1.1.1={i}999"
"1.3.6.1.4.1.700.1.2.9.1.2.1={a}172.172.172.172"
it said
:Response received with requestID=579438309, errorIndex=1,
errorStatus=Not writable(17)
and i use the mib-browser to SET,but still the same "not writable"
i found that means the OID not a Object,will i get a table Object?
--------------------------------------------------------------------
i dig some codes like TableUtil.createRow but dont get any idea,
which class should i use and how to use the snmp4j tool to update or
create a row in the table?or something should be changed in testAgent?
pls guide me the right way! thank you!
yours
TonyWii
More information about the SNMP4J
mailing list