...
The ServiceMix SNMP component provides support for receiving SNMP events via the enterprise service bus by using the SNMP4J library.
Note |
---|
|
Note that this component is only available in releases >= 3.3. |
Installation
Installing the servicemix-snmp component can be done in several ways:
- drop the installer zip in an hotdeploy directory monitored by ServiceMix
- using ant tasks
Note that when using ant tasks, the component is not started, you will have to start it manually using ant tasks or a console.
Creation
Maven Archetype
You can use Maven servicemix-snmp-service-unit archetype to create a SNMP service unit.:
Code Block |
---|
mvn archetype:create \
-DarchetypeGroupId=org.apache.servicemix.tooling \
-DarchetypeArtifactId=servicemix-snmp-service-unit \
-DarchetypeVersion=2010.01 \
-DgroupId=comyour.mycompanygroup.myproductid \
-DartifactId=your.artifact.id \
-DartifactId=mycomponent.artifact
|
Endpoints
Once you've customized the service unit, simply install the SU:
Info |
---|
Remember that to be deployable in ServiceMix, the ServiceUnit has to be embedded in a Service Assembly: only the Service Assembly zip file can be deployed in ServiceMix. To add your SU in a SA, you need to define it in the dependency sets: Code Block |
---|
<dependency>
<groupId>your.group.id</groupId>
<artifactId>your.artifact.id</artifactId>
<version>your-version</version>
</dependency>
|
|
Endpoints Configuration
Poller Endpoint (Consumer)
The SNMP Poller endpoint periodically poll a SNMP server to get event and generate messages sent to the NMR.
Note |
---|
The SNMP Poller endpoint will only generate InOnly exchanges. |
Code Block |
---|
lang | xml |
---|
title | Polling Poller (consumerConsumer) endpointEndpoint |
---|
|
<snmp:poller service="test:mySNMPService"
endpoint="pollerEndpoint"
targetService="test:myProcessor"
period="10000"
address="udp:192.168.2.122/161"
oids="classpath:myOIDList.txt" />
|
Consumer Endpoint (Polling)
Note |
---|
title | Message Exchange Pattern |
---|
|
The poller endpoint will only generate InOnly exchanges. |
The following table shows the additional configuration possibilities of the endpoint other than the configuration of the default PollingEndpoint class.
Info |
---|
title | Poller endpoint attributesEndpoint Attributes |
---|
borderStyle | solidbgColor='lighblue' |
---|
|
Name | Type | Description | Default |
---|
oids | OIDList | sets the resource containing all OIDs to poll | null (must be spec'd) | address | String | the address to use for snmp connection | null (must be spec'd) | marshaler | class | org.apache.servicemix.snmp.marshaler.SnmpMarshalerSupport | DefaultSnmpMarshaler | retries | int | the retries for requesting the values via snmp | 2 | timeout | long | the timeout in millis for a request to be answered | 1500 | snmpVersion | int | the snmp version to use (see SnmpConstants) | 0 (v1) | snmpCommunity | String | the snmp community | "public" |
|
Trap Consumer Endpoint
The SNMP Trap Consumer endpoint waits for incoming SNMP messages.
Code Block |
---|
lang | xml |
---|
title | Trap consumer endpoint |
---|
|
<snmp:trap-consumer service="test:mySNMPService"
endpoint="trapConsumerEndpoint"
targetService="test:myProcessor"
address=" |
...
udp:192.168.2.122/162" />
|
Info |
---|
title | Poller endpoint attributes |
---|
borderStyle | solidbgColor='lighblue' |
---|
|
Name | Type | Description | Default |
---|
address | String | the address to use for snmp connection | null (must be spec'd) | marshaler | class | org.apache.servicemix.snmp.marshaler.SnmpMarshalerSupport | DefaultSnmpMarshaler |
|
The "oids" list
You can specify here a comma separated list of OIDs or just reference to a resource containing a list of OIDs separated by line feeds.
...
No Format |
---|
Template: <protocol>:<ip-address>/<port>
Example: udp:192.168.2.122/161
|
Info |
---|
title | Poller endpoint attributes |
---|
borderStyle | solidbgColor='lighblue' |
---|
|
Name | Description |
---|
protocol | the protocol to use (udp / tcp) | ip-address | the ip address of the device to poll from | port | the port number |
|
Provider Endpoint (Sending)
Note |
---|
|
There is no sender endpoint yet. |
...
Marshalers
You can write your own marshalers for conversion between snmp and normalized message.
To do this you simply need to implement the org.apache.servicemix.snmp.marshaler.SnmpMarshalerSupport interface or by creating a subclass of the DefaultSnmpMarshaler if you do not want to start from scratch.
...