Date: Thu, 28 Mar 2024 20:43:54 +0000 (UTC) Message-ID: <330020097.103.1711658634202@2997b7dde346> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_102_994965074.1711658634201" ------=_Part_102_994965074.1711658634201 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
This page describes how rows with SNMP values can be added to a = SNMP4J-Agent table.
Make sure that the MOTableModel
used by the table is an=
instance of the MutableMOTableModel
.
Create the row values as an array of Variable
instances=
:
Variabl= e[] com2secValues =3D new Variable[] { new OctetString("public"), // community name new OctetString("publicSecName"), // security name getAgent().getContextEngineID(), // local engine ID new OctetString(""), // default context name new OctetString(), // transport tag new Integer32(StorageType.nonVolatile), // storage type new Integer32(RowStatus.active) // row status };
Let the SNMP4J-Agent API create a new row based on the provided valu=
es and the index sub-OID for the new row. The new will be created by the MOMutableTableModel
o=
f the snmpCommunityTable
. If the row factory is not set (for e=
xample to a DefaultMOFactory instance) then an exception will be thrown:
MOTable= Row newRow =3D snmpCommunityTable.createRow(new OctetString("public").toSub= Index(true), com2secValues);
Add the newly created row to the table:
((MOMut= ableTableModel)snmpCommunityTable.getModel()).addRow(newRow);