Package org.metricshub.snmp.client
Class OfflineSnmpClient
java.lang.Object
org.metricshub.snmp.client.OfflineSnmpClient
- All Implemented Interfaces:
ISnmpClient
An offline SNMP client that reads OID values from a snmp WALK dump file and executes
SNMP operations (GET, GET_NEXT, TABLE, WALK) against those OIDs.
-
Constructor Summary
ConstructorsConstructorDescriptionOfflineSnmpClient(Path directory) Reads oid values from all .walk files in the specified directory. -
Method Summary
Modifier and TypeMethodDescriptionvoidFrees any resources held by the client, such as network connections or file handles or memory space.Performs SNMP get action for a single OID.Performs SNMP getNext action for a single OID.Reads an SNMP table.Performs SNMP walk action starting from a given OID.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.metricshub.snmp.client.ISnmpClient
stripDot
-
Constructor Details
-
OfflineSnmpClient
Reads oid values from all .walk files in the specified directory.- Parameters:
directory- A given directory containing .walk files- Throws:
IOException- If an I/O error occurs reading from the directory or a file
-
-
Method Details
-
get
Description copied from interface:ISnmpClientPerforms SNMP get action for a single OID.- Specified by:
getin interfaceISnmpClient- Parameters:
oid- A given OID.- Returns:
- The corresponding object as a string.
- Throws:
Exception- on error (e.g. no such OID).
-
getNext
Description copied from interface:ISnmpClientPerforms SNMP getNext action for a single OID.- Specified by:
getNextin interfaceISnmpClient- Parameters:
oid- A given OID.- Returns:
- The corresponding object as a string.
-
table
Description copied from interface:ISnmpClientReads an SNMP table.- Specified by:
tablein interfaceISnmpClient- Parameters:
rootOID- Root OID of the table (e.g. …7.1)selectColumns- Numeric column indexes or "ID" for the row index- Returns:
- Rows serialized with semicolons (one row per line)
-
walk
Description copied from interface:ISnmpClientPerforms SNMP walk action starting from a given OID.- Specified by:
walkin interfaceISnmpClient- Parameters:
oid- A given OID.- Returns:
- The corresponding object as a string.
-
freeResources
public void freeResources()Description copied from interface:ISnmpClientFrees any resources held by the client, such as network connections or file handles or memory space.- Specified by:
freeResourcesin interfaceISnmpClient
-