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 Type
    Method
    Description
    void
    Frees any resources held by the client, such as network connections or file handles or memory space.
    get(String oid)
    Performs SNMP get action for a single OID.
    Performs SNMP getNext action for a single OID.
    default String
    Strips the leading dot from an OID string if it exists.
    table(String rootOID, String[] selectColumns)
    Reads an SNMP table.
    walk(String oid)
    Performs SNMP walk action starting from a given OID.
  • Method Details

    • get

      String get(String oid) throws Exception
      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

      String getNext(String oid) throws Exception
      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

      List<List<String>> table(String rootOID, String[] selectColumns) throws Exception
      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

      default String stripDot(String s)
      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

      String walk(String oid) throws Exception
      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.