Class SnmpEndpoint

java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.support.DefaultEndpoint
org.apache.camel.support.ScheduledPollEndpoint
org.apache.camel.support.DefaultPollingEndpoint
org.apache.camel.component.snmp.SnmpEndpoint
All Implemented Interfaces:
AutoCloseable, org.apache.camel.CamelContextAware, org.apache.camel.ComponentAware, org.apache.camel.Endpoint, org.apache.camel.IsSingleton, org.apache.camel.Service, org.apache.camel.ShutdownableService, org.apache.camel.spi.HasCamelContext, org.apache.camel.spi.HasId, org.apache.camel.StatefulService, org.apache.camel.SuspendableService

@UriEndpoint(firstVersion="2.1.0", scheme="snmp", title="SNMP", syntax="snmp:host:port", category=MONITORING) public class SnmpEndpoint extends org.apache.camel.support.DefaultPollingEndpoint
Receive traps and poll SNMP (Simple Network Management Protocol) capable devices.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final int
     
    static final int
     
    static final int
     

    Fields inherited from class org.apache.camel.support.service.BaseService

    BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING
  • Constructor Summary

    Constructors
    Constructor
    Description
    creates a snmp endpoint
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.camel.Consumer
    createConsumer(org.apache.camel.Processor processor)
     
    org.apache.camel.Exchange
    createExchange(org.snmp4j.PDU pdu)
    creates an exchange for the given message
    org.apache.camel.Producer
     
    protected void
     
     
     
     
    long
     
     
     
     
     
    int
     
    int
     
     
     
     
     
    int
     
    int
     
     
    void
    Deprecated.
    use BaseService.start() instead
    boolean
     
    void
    setAddress(String address)
     
    void
    setAuthenticationPassphrase(String authenticationPassphrase)
    The authentication passphrase.
    void
    setAuthenticationProtocol(String authenticationProtocol)
    Authentication protocol to use if security level is set to enable authentication The possible values are: MD5, SHA1
    void
    setDelay(long updateEvery)
    Sets update rate in seconds
    void
    Defines which values you are interested in.
    void
    setPrivacyPassphrase(String privacyPassphrase)
    The privacy passphrase.
    void
    setPrivacyProtocol(String privacyProtocol)
    The privacy protocol ID to be associated with this user.
    void
    setProtocol(String protocol)
    Here you can select which protocol to use.
    void
    setRetries(int retries)
    Defines how often a retry is made before canceling the request.
    void
    setSecurityLevel(int securityLevel)
    Sets the security level for this target.
    void
    setSecurityName(String securityName)
    Sets the security name to be used with this target.
    void
    setSnmpCommunity(String snmpCommunity)
    Sets the community octet string for the snmp request.
    void
    setSnmpContextEngineId(String snmpContextEngineId)
    Sets the context engine ID field of the scoped PDU.
    void
    setSnmpContextName(String snmpContextName)
    Sets the context name field of this scoped PDU.
    void
    setSnmpVersion(int snmpVersion)
    Sets the snmp version for the request.
    void
    setTimeout(int timeout)
    Sets the timeout value for the request in millis.
    void
    setTreeList(boolean treeList)
    Sets the flag whether the scoped PDU will be displayed as the list if it has child elements in its tree
    void
    Which operation to perform such as poll, trap, etc.
     

    Methods inherited from class org.apache.camel.support.ScheduledPollEndpoint

    configureConsumer, configureProperties, configureScheduledPollConsumerProperties, doConfigureConsumer, getBackoffErrorThreshold, getBackoffIdleThreshold, getBackoffMultiplier, getDefaultDelay, getInitialDelay, getPollStrategy, getRepeatCount, getRunLoggingLevel, getScheduledExecutorService, getScheduler, getSchedulerProperties, getTimeUnit, isGreedy, isSendEmptyMessageWhenIdle, isStartScheduler, isUseFixedDelay, setBackoffErrorThreshold, setBackoffIdleThreshold, setBackoffMultiplier, setGreedy, setInitialDelay, setPollStrategy, setRepeatCount, setRunLoggingLevel, setScheduledExecutorService, setScheduler, setSchedulerProperties, setSendEmptyMessageWhenIdle, setStartScheduler, setTimeUnit, setUseFixedDelay

    Methods inherited from class org.apache.camel.support.DefaultEndpoint

    configureExchange, configurePollingConsumer, createAsyncProducer, createEndpointUri, createExchange, createExchange, createPollingConsumer, equals, getCamelContext, getComponent, getEndpointKey, getEndpointUri, getExceptionHandler, getExchangePattern, getId, getPollingConsumerBlockTimeout, getPollingConsumerQueueSize, hashCode, isAutowiredEnabled, isBridgeErrorHandler, isLazyStartProducer, isLenientProperties, isPollingConsumerBlockWhenFull, isPollingConsumerCopy, isSingleton, setAutowiredEnabled, setBridgeErrorHandler, setCamelContext, setComponent, setEndpointUri, setEndpointUriIfNotSpecified, setExceptionHandler, setExchangePattern, setLazyStartProducer, setPollingConsumerBlockTimeout, setPollingConsumerBlockWhenFull, setPollingConsumerCopy, setPollingConsumerQueueSize, setProperties

    Methods inherited from class org.apache.camel.support.service.BaseService

    build, doBuild, doFail, doLifecycleChange, doResume, doShutdown, doStart, doStop, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.apache.camel.ComponentAware

    getComponent

    Methods inherited from interface org.apache.camel.Endpoint

    getEndpointBaseUri, isSingletonProducer

    Methods inherited from interface org.apache.camel.Service

    build, close, init, start, stop

    Methods inherited from interface org.apache.camel.ShutdownableService

    shutdown

    Methods inherited from interface org.apache.camel.StatefulService

    getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspending

    Methods inherited from interface org.apache.camel.SuspendableService

    isSuspended, resume, suspend
  • Field Details

  • Constructor Details

    • SnmpEndpoint

      public SnmpEndpoint(String uri, SnmpComponent component)
      creates a snmp endpoint
      Parameters:
      uri - the endpoint uri
      component - the component
  • Method Details

    • createConsumer

      public org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor) throws Exception
      Specified by:
      createConsumer in interface org.apache.camel.Endpoint
      Overrides:
      createConsumer in class org.apache.camel.support.DefaultPollingEndpoint
      Throws:
      Exception
    • createProducer

      public org.apache.camel.Producer createProducer() throws Exception
      Throws:
      Exception
    • createExchange

      public org.apache.camel.Exchange createExchange(org.snmp4j.PDU pdu)
      creates an exchange for the given message
      Parameters:
      pdu - the pdu
      Returns:
      an exchange
    • initiate

      @Deprecated public void initiate() throws Exception
      Deprecated.
      use BaseService.start() instead
      creates and configures the endpoint
      Throws:
      Exception - if unable to setup connection
    • getDelay

      public long getDelay()
      Overrides:
      getDelay in class org.apache.camel.support.ScheduledPollEndpoint
    • setDelay

      public void setDelay(long updateEvery)
      Sets update rate in seconds
      Overrides:
      setDelay in class org.apache.camel.support.ScheduledPollEndpoint
      Parameters:
      updateEvery - the update rate in seconds
    • getType

      public SnmpActionType getType()
    • setType

      public void setType(SnmpActionType type)
      Which operation to perform such as poll, trap, etc.
    • getOids

      public OIDList getOids()
    • setOids

      public void setOids(OIDList oids)
      Defines which values you are interested in. Please have a look at the Wikipedia to get a better understanding. You may provide a single OID or a coma separated list of OIDs. Example: oids="1.3.6.1.2.1.1.3.0,1.3.6.1.2.1.25.3.2.1.5.1,1.3.6.1.2.1.25.3.5.1.1.1,1.3.6.1.2.1.43.5.1.1.11.1"
    • getAddress

      public String getAddress()
    • setAddress

      public void setAddress(String address)
    • getRetries

      public int getRetries()
    • setRetries

      public void setRetries(int retries)
      Defines how often a retry is made before canceling the request.
    • getTimeout

      public int getTimeout()
    • setTimeout

      public void setTimeout(int timeout)
      Sets the timeout value for the request in millis.
    • getSnmpVersion

      public int getSnmpVersion()
    • setSnmpVersion

      public void setSnmpVersion(int snmpVersion)
      Sets the snmp version for the request.

      The value 0 means SNMPv1, 1 means SNMPv2c, and the value 3 means SNMPv3

    • getSnmpCommunity

      public String getSnmpCommunity()
    • setSnmpCommunity

      public void setSnmpCommunity(String snmpCommunity)
      Sets the community octet string for the snmp request.
    • getProtocol

      public String getProtocol()
    • setProtocol

      public void setProtocol(String protocol)
      Here you can select which protocol to use. You can use either udp or tcp.
    • doInit

      protected void doInit() throws Exception
      Overrides:
      doInit in class org.apache.camel.support.DefaultEndpoint
      Throws:
      Exception
    • getSecurityLevel

      public int getSecurityLevel()
    • setSecurityLevel

      public void setSecurityLevel(int securityLevel)
      Sets the security level for this target. The supplied security level must be supported by the security model dependent information associated with the security name set for this target.

      The value 1 means: No authentication and no encryption. Anyone can create and read messages with this security level The value 2 means: Authentication and no encryption. Only the one with the right authentication key can create messages with this security level, but anyone can read the contents of the message. The value 3 means: Authentication and encryption. Only the one with the right authentication key can create messages with this security level, and only the one with the right encryption/decryption key can read the contents of the message.

    • getSecurityName

      public String getSecurityName()
    • setSecurityName

      public void setSecurityName(String securityName)
      Sets the security name to be used with this target.
    • getAuthenticationProtocol

      public String getAuthenticationProtocol()
    • setAuthenticationProtocol

      public void setAuthenticationProtocol(String authenticationProtocol)
      Authentication protocol to use if security level is set to enable authentication The possible values are: MD5, SHA1
    • getAuthenticationPassphrase

      public String getAuthenticationPassphrase()
    • setAuthenticationPassphrase

      public void setAuthenticationPassphrase(String authenticationPassphrase)
      The authentication passphrase. If not null, authenticationProtocol must also be not null. RFC3414 11.2 requires passphrases to have a minimum length of 8 bytes. If the length of authenticationPassphrase is less than 8 bytes an IllegalArgumentException is thrown.
    • getPrivacyProtocol

      public String getPrivacyProtocol()
    • setPrivacyProtocol

      public void setPrivacyProtocol(String privacyProtocol)
      The privacy protocol ID to be associated with this user. If set to null, this user only supports unencrypted messages.
    • getPrivacyPassphrase

      public String getPrivacyPassphrase()
    • setPrivacyPassphrase

      public void setPrivacyPassphrase(String privacyPassphrase)
      The privacy passphrase. If not null, privacyProtocol must also be not null. RFC3414 11.2 requires passphrases to have a minimum length of 8 bytes. If the length of authenticationPassphrase is less than 8 bytes an IllegalArgumentException is thrown.
    • getSnmpContextName

      public String getSnmpContextName()
    • setSnmpContextName

      public void setSnmpContextName(String snmpContextName)
      Sets the context name field of this scoped PDU.
    • getSnmpContextEngineId

      public String getSnmpContextEngineId()
    • setSnmpContextEngineId

      public void setSnmpContextEngineId(String snmpContextEngineId)
      Sets the context engine ID field of the scoped PDU.
    • isTreeList

      public boolean isTreeList()
    • setTreeList

      public void setTreeList(boolean treeList)
      Sets the flag whether the scoped PDU will be displayed as the list if it has child elements in its tree
    • toString

      public String toString()
      Overrides:
      toString in class org.apache.camel.support.DefaultEndpoint