Package org.apache.camel.component.snmp
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
Modifier and TypeFieldDescriptionstatic 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
-
Method Summary
Modifier and TypeMethodDescriptionorg.apache.camel.Consumer
createConsumer
(org.apache.camel.Processor processor) org.apache.camel.Exchange
createExchange
(org.snmp4j.PDU pdu) creates an exchange for the given messageorg.apache.camel.Producer
protected void
doInit()
long
getDelay()
getOids()
int
int
int
int
getType()
void
initiate()
Deprecated.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, SHA1void
setDelay
(long updateEvery) Sets update rate in secondsvoid
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 treevoid
setType
(SnmpActionType type) Which operation to perform such as poll, trap, etc.toString()
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
-
DEFAULT_COMMUNITY
- See Also:
-
DEFAULT_SNMP_VERSION
public static final int DEFAULT_SNMP_VERSION- See Also:
-
DEFAULT_SNMP_RETRIES
public static final int DEFAULT_SNMP_RETRIES- See Also:
-
DEFAULT_SNMP_TIMEOUT
public static final int DEFAULT_SNMP_TIMEOUT- See Also:
-
-
Constructor Details
-
SnmpEndpoint
creates a snmp endpoint- Parameters:
uri
- the endpoint uricomponent
- the component
-
-
Method Details
-
createConsumer
public org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor) throws Exception - Specified by:
createConsumer
in interfaceorg.apache.camel.Endpoint
- Overrides:
createConsumer
in classorg.apache.camel.support.DefaultPollingEndpoint
- Throws:
Exception
-
createProducer
- 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.useBaseService.start()
insteadcreates and configures the endpoint- Throws:
Exception
- if unable to setup connection
-
getDelay
public long getDelay()- Overrides:
getDelay
in classorg.apache.camel.support.ScheduledPollEndpoint
-
setDelay
public void setDelay(long updateEvery) Sets update rate in seconds- Overrides:
setDelay
in classorg.apache.camel.support.ScheduledPollEndpoint
- Parameters:
updateEvery
- the update rate in seconds
-
getType
-
setType
Which operation to perform such as poll, trap, etc. -
getOids
-
setOids
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
-
setAddress
-
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
-
setSnmpCommunity
Sets the community octet string for the snmp request. -
getProtocol
-
setProtocol
Here you can select which protocol to use. You can use either udp or tcp. -
doInit
- Overrides:
doInit
in classorg.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
-
setSecurityName
Sets the security name to be used with this target. -
getAuthenticationProtocol
-
setAuthenticationProtocol
Authentication protocol to use if security level is set to enable authentication The possible values are: MD5, SHA1 -
getAuthenticationPassphrase
-
setAuthenticationPassphrase
The authentication passphrase. If notnull
,authenticationProtocol
must also be notnull
. RFC3414 11.2 requires passphrases to have a minimum length of 8 bytes. If the length ofauthenticationPassphrase
is less than 8 bytes anIllegalArgumentException
is thrown. -
getPrivacyProtocol
-
setPrivacyProtocol
The privacy protocol ID to be associated with this user. If set tonull
, this user only supports unencrypted messages. -
getPrivacyPassphrase
-
setPrivacyPassphrase
The privacy passphrase. If notnull
,privacyProtocol
must also be notnull
. RFC3414 11.2 requires passphrases to have a minimum length of 8 bytes. If the length ofauthenticationPassphrase
is less than 8 bytes anIllegalArgumentException
is thrown. -
getSnmpContextName
-
setSnmpContextName
Sets the context name field of this scoped PDU. -
getSnmpContextEngineId
-
setSnmpContextEngineId
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
- Overrides:
toString
in classorg.apache.camel.support.DefaultEndpoint
-
BaseService.start()
instead