Available as of Camel 2.1
The snmp: component gives you the ability to poll SNMP capable devices or receiving traps.
Maven users will need to add the following dependency to their
pom.xml for this component:
The component supports polling OID values from an SNMP enabled device and receiving traps.
You can append query options to the URI in the following format,
The type of action you want to perform. Actually you can enter here
TRAP. The value
POLL will instruct the endpoint to poll a given host for the supplied OID keys. If you put in
TRAP you will setup a listener for SNMP Trap Events.
Here you can select which protocol to use. You can use either
Defines how often a retry is made before canceling the request.
Sets the timeout value for the request in millis.
0 (which means SNMPv1)
Sets the snmp version for the request.
Sets the community octet string for the snmp request.
Defines the delay in seconds between to poll cycles. From Camel 2.15 onwards the delay is using millis as its timeunit, so configure 30000 for 30 seconds. Older releases uses the value in seconds.
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="184.108.40.206.220.127.116.11.0,18.104.22.168.22.214.171.124.126.96.36.199,188.8.131.52.184.108.40.206.220.127.116.11,18.104.22.168.22.214.171.124.126.96.36.199"
The result of a poll
Given the situation, that I poll for the following OIDs:
The result will be the following:
As you maybe recognized there is one more result than requested....188.8.131.52.184.108.40.206.0.
This one is filled in by the device automatically in this special case. So it may absolutely happen, that you receive more than you requested...be prepared.
Polling a remote device:
Setting up a trap receiver (Note that no OID info is needed here!):
From Camel 2.10.0, you can get the community of SNMP TRAP with message header 'securityName',
peer address of the SNMP TRAP with message header 'peerAddress'.
Routing example in Java: (converts the SNMP PDU to XML String)