...
SNMP
...
Component
...
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:
Code Block | ||||
---|---|---|---|---|
| ||||
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-snmp</artifactId>
<version>x.x.x</version>
<!-- use the same version as your Camel core version -->
</dependency>
|
URI format
Code Block |
---|
capable devices or receiving traps. h3. URI format {code} snmp://hostname[:port][?Options] {code} |
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,
...
?option=value&option=value&...
Options
Div | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||||||||||
|
The result of a poll
Given the situation, that I poll for the following OIDs:
Code Block | ||||
---|---|---|---|---|
| ||||
| {div} h3. The result of a poll Given the situation, that I poll for the following OIDs: {code:lang=java|title=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 {code} |
The
...
result
...
will
...
be
...
the
...
following:
Code Block | ||||
---|---|---|---|---|
| ||||
{code:lang=xml|title=Result of toString conversion} <?xml version="1.0" encoding="UTF-8"?> <snmp> <entry> <oid>1.3.6.1.2.1.1.3.0</oid> <value>6 days, 21:14:28.00</value> </entry> <entry> <oid>1.3.6.1.2.1.25.3.2.1.5.1</oid> <value>2</value> </entry> <entry> <oid>1.3.6.1.2.1.25.3.5.1.1.1</oid> <value>3</value> </entry> <entry> <oid>1.3.6.1.2.1.43.5.1.1.11.1</oid> <value>6</value> </entry> <entry> <oid>1.3.6.1.2.1.1.1.0</oid> <value>My Very Special Printer Of Brand Unknown</value> </entry> </snmp> {code} |
As
...
you
...
maybe
...
recognized
...
there
...
is
...
one
...
more
...
result
...
than
...
requested....1.3.6.1.2.1.1.1.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.
Examples
Polling a remote device:
Code Block |
---|
h3. Examples Polling a remote device: {code} snmp:192.168.178.23:161?protocol=udp&type=pollPOLL&oids=1.3.6.1.2.1.1.5.0 {code} |
Setting
...
up
...
a
...
trap
...
receiver
...
(
...
Note
...
that
...
no
...
OID
...
info
...
is
...
needed
...
here!
...
):
Code Block |
---|
} snmp:127.0.0.1:162?protocol=udp&type=TRAP |
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)
Code Block |
---|
trap {code} Routing example in Java: (converts the SNMP PDU to XML String) {code} from("snmp:192.168.178.23:161?protocol=udp&type=pollPOLL&oids=1.3.6.1.2.1.1.5.0"). convertBodyTo(String.class). to("activemq:snmp.states"); {code} {include:Endpoint See Also} |
Include Page | ||||
---|---|---|---|---|
|