Class Snmp4JStrategy

    • Constructor Detail

      • Snmp4JStrategy

        public Snmp4JStrategy()
    • Method Detail

      • clearUsers

        public void clearUsers()
      • get

        public SnmpValue get​(SnmpAgentConfig agentConfig,
                             SnmpObjId oid)
        SNMP4J get helper that takes a single SnmpObjId and calls get with an array.lenght =1 and returns the first element of the returned array of SnmpValue.
        Specified by:
        get in interface SnmpStrategy
        Parameters:
        agentConfig -
        oid -
      • get

        public SnmpValue[] get​(SnmpAgentConfig agentConfig,
                               SnmpObjId[] oids)
        SnmpGet implementation.
        Specified by:
        get in interface SnmpStrategy
        Parameters:
        agentConfig -
        oids -
        Returns:
        Returns an array of Snmp4JValues. If the get was unsuccessful, then the first elment of the array will be null and lenth of 1.
      • getNext

        public SnmpValue[] getNext​(SnmpAgentConfig agentConfig,
                                   SnmpObjId[] oids)
        SNMP GetNext implementation.
        Specified by:
        getNext in interface SnmpStrategy
        Parameters:
        agentConfig -
        oids -
        Returns:
        Returns an array of Snmp4JValues. If the getNext was unsuccessful, then the first element of the array will be null and length of 1.
      • send

        protected SnmpValue[] send​(Snmp4JAgentConfig agentConfig,
                                   org.snmp4j.PDU pdu,
                                   boolean expectResponse)
        Sends and SNMP4J request PDU. The attributes in SnmpAgentConfig should have been adapted from default SnmpAgentConfig values to those compatible with the SNMP4J library.
      • buildAgentConfig

        protected SnmpAgentConfig buildAgentConfig​(java.lang.String address,
                                                   int port,
                                                   java.lang.String community,
                                                   org.snmp4j.PDU pdu)
                                            throws java.net.UnknownHostException
        Throws:
        java.net.UnknownHostException
      • buildAgentConfig

        protected SnmpAgentConfig buildAgentConfig​(java.lang.String address,
                                                   int port,
                                                   int timeout,
                                                   int retries,
                                                   java.lang.String community,
                                                   org.snmp4j.PDU pdu)
                                            throws java.net.UnknownHostException
        Throws:
        java.net.UnknownHostException
      • buildAgentConfig

        protected SnmpAgentConfig buildAgentConfig​(java.lang.String address,
                                                   int port,
                                                   int securityLevel,
                                                   java.lang.String securityName,
                                                   java.lang.String authPassPhrase,
                                                   java.lang.String authProtocol,
                                                   java.lang.String privPassPhrase,
                                                   java.lang.String privProtocol,
                                                   org.snmp4j.PDU pdu)
                                            throws java.net.UnknownHostException,
                                                   java.lang.Exception
        Throws:
        java.net.UnknownHostException
        java.lang.Exception
      • buildAgentConfig

        protected SnmpAgentConfig buildAgentConfig​(java.lang.String address,
                                                   int port,
                                                   int timeout,
                                                   int retries,
                                                   int securityLevel,
                                                   java.lang.String securityName,
                                                   java.lang.String authPassPhrase,
                                                   java.lang.String authProtocol,
                                                   java.lang.String privPassPhrase,
                                                   java.lang.String privProtocol,
                                                   org.snmp4j.PDU pdu)
                                            throws java.net.UnknownHostException,
                                                   java.lang.Exception
        Throws:
        java.net.UnknownHostException
        java.lang.Exception
      • sendTest

        public void sendTest​(java.lang.String agentAddress,
                             int port,
                             java.lang.String community,
                             org.snmp4j.PDU pdu)
      • createPersistentInstanceId

        public static org.snmp4j.smi.OctetString createPersistentInstanceId()
      • createLocalEngineId

        public static org.snmp4j.smi.OctetString createLocalEngineId()
      • trackSession

        public static void trackSession​(org.snmp4j.Snmp session)
      • reapSession

        public static void reapSession​(org.snmp4j.Snmp session)