Package org.metricshub.snmp.client
Interface ISnmpClient
- All Known Implementing Classes:
OfflineSnmpClient,SnmpClient
public interface ISnmpClient
Unified abstraction that both
SnmpClient (live network) and
OfflineSnmpClient (file‑backed) can implement.-
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.default StringStrips the leading dot from an OID string if it exists.Reads an SNMP table.Performs SNMP walk action starting from a given OID.
-
Method Details
-
get
Performs SNMP get action for a single OID.- Parameters:
oid- A given OID.- Returns:
- The corresponding object as a string.
- Throws:
Exception- on error (e.g. no such OID).
-
getNext
Performs SNMP getNext action for a single OID.- Parameters:
oid- A given OID.- Returns:
- The corresponding object as a string.
- Throws:
Exception- on error (e.g. no such OID).
-
table
Reads an SNMP table.- 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)
- Throws:
Exception
-
stripDot
Strips the leading dot from an OID string if it exists.- Parameters:
s- the OID string to process.- Returns:
- the OID string without a leading dot.
-
walk
Performs SNMP walk action starting from a given OID.- Parameters:
oid- A given OID.- Returns:
- The corresponding object as a string.
- Throws:
Exception- on error (e.g. no such OID).
-
freeResources
void freeResources()Frees any resources held by the client, such as network connections or file handles or memory space.
-