camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Camel > SNMP
Date Wed, 23 Sep 2009 10:01:00 GMT
<html>
<head>
    <base href="http://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1519/1/1/_/styles/combined.css?spaceKey=CAMEL&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background-color: white" bgcolor="white">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
     <h2><a href="http://cwiki.apache.org/confluence/display/CAMEL/SNMP">SNMP</a></h2>
     <h4>Page <b>edited</b> by             <a href="http://cwiki.apache.org/confluence/display/~lhein">Lars
Heinemann</a>
    </h4>
     
          <br/>
     <div class="notificationGreySide">
         <h2><a name="SNMP-AvailableasofCamel2.1"></a><b>Available
as of Camel 2.1</b></h2>

<h2><a name="SNMP-SNMPComponent"></a>SNMP Component</h2>

<p>The <b>snmp:</b> component gives you the ability to poll SNMP capable
devices or receiving traps.</p>

<h3><a name="SNMP-URIformat"></a>URI format</h3>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
snmp:<span class="code-comment">//hostname[:port][?Options]</span>
</pre>
</div></div>
<p>The component supports polling OID values from an SNMP enabled device and receiving
traps.</p>

<p>You can append query options to the URI in the following format, <tt>?option=value&amp;option=value&amp;...</tt></p>

<h3><a name="SNMP-Options"></a>Options</h3>

<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Name </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> <tt>type</tt> </td>
<td class='confluenceTd'> The type of action you want to perform. Actually you can enter
here <tt>poll</tt> or <tt>trap</tt>. The value <tt>poll</tt>
will instruct the endpoint to poll a given host for the supplied OID keys. If you put in <tt>trap</tt>
you will setup a listener for SNMP Trap Events. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>address</tt> </td>
<td class='confluenceTd'> This is the IP address and the port of the host to poll or
where to setup the Trap Receiver. Example: <tt>127.0.0.1:162</tt></td>
</tr>
<tr>
<td class='confluenceTd'> <tt>protocol</tt> </td>
<td class='confluenceTd'> Here you can select which protocol to use. By default it will
be <tt>udp</tt> protocol but you may want to use <tt>tcp</tt> as well
</td>
</tr>
<tr>
<td class='confluenceTd'> <tt>retries</tt> </td>
<td class='confluenceTd'> Defines how often a retry is made before canceling the request.
(Default: <tt>2</tt>) </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>timeout</tt> </td>
<td class='confluenceTd'> Sets the timeout value for the request in millis. (Default:
<tt>1500</tt>) </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>snmpVersion</tt> </td>
<td class='confluenceTd'> Sets the snmp version for the request. (Default: <tt>0</tt>
which means SNMPv1) </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>snmpCommunity</tt> </td>
<td class='confluenceTd'> Sets the community octet string for the snmp request. (Default:
<tt>public</tt>) </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>delay</tt> </td>
<td class='confluenceTd'> Defines the delay in seconds between to poll cycles. (Default:
<tt>60</tt>) </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>oids</tt> </td>
<td class='confluenceTd'> Defines which values you are interested in. Please have a
look at the <a href="http://en.wikipedia.org/wiki/Object_identifier" rel="nofollow">Wikipedia
</a> 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"
</td>
</tr>
</tbody></table>

<h3><a name="SNMP-Theresultofapoll"></a>The result of a poll</h3>

<p>Given the situation, that I poll for the following OIDs:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>oids</b></div><div class="codeContent
panelContent">
<pre class="code-java">
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
</pre>
</div></div>

<p>The result will be the following:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>Result of toString conversion</b></div><div
class="codeContent panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;?xml version=<span class="code-quote">"1.0"</span>
encoding=<span class="code-quote">"UTF-8"</span>?&gt;</span>
<span class="code-tag">&lt;snmp&gt;</span>
  <span class="code-tag">&lt;entry&gt;</span>
    <span class="code-tag">&lt;oid&gt;</span>1.3.6.1.2.1.1.3.0<span
class="code-tag">&lt;/oid&gt;</span>
    <span class="code-tag">&lt;value&gt;</span>6 days, 21:14:28.00<span
class="code-tag">&lt;/value&gt;</span>
  <span class="code-tag">&lt;/entry&gt;</span>
  <span class="code-tag">&lt;entry&gt;</span>
    <span class="code-tag">&lt;oid&gt;</span>1.3.6.1.2.1.25.3.2.1.5.1<span
class="code-tag">&lt;/oid&gt;</span>
    <span class="code-tag">&lt;value&gt;</span>2<span class="code-tag">&lt;/value&gt;</span>
  <span class="code-tag">&lt;/entry&gt;</span>
  <span class="code-tag">&lt;entry&gt;</span>
    <span class="code-tag">&lt;oid&gt;</span>1.3.6.1.2.1.25.3.5.1.1.1<span
class="code-tag">&lt;/oid&gt;</span>
    <span class="code-tag">&lt;value&gt;</span>3<span class="code-tag">&lt;/value&gt;</span>
  <span class="code-tag">&lt;/entry&gt;</span>
  <span class="code-tag">&lt;entry&gt;</span>
    <span class="code-tag">&lt;oid&gt;</span>1.3.6.1.2.1.43.5.1.1.11.1<span
class="code-tag">&lt;/oid&gt;</span>
    <span class="code-tag">&lt;value&gt;</span>6<span class="code-tag">&lt;/value&gt;</span>
  <span class="code-tag">&lt;/entry&gt;</span>
  <span class="code-tag">&lt;entry&gt;</span>
    <span class="code-tag">&lt;oid&gt;</span>1.3.6.1.2.1.1.1.0<span
class="code-tag">&lt;/oid&gt;</span>
    <span class="code-tag">&lt;value&gt;</span>My Very Special Printer
Of Brand Unknown<span class="code-tag">&lt;/value&gt;</span>
  <span class="code-tag">&lt;/entry&gt;</span>
<span class="code-tag">&lt;/snmp&gt;</span>
</pre>
</div></div>

<p>As you maybe recognized there is one more result than requested....1.3.6.1.2.1.1.1.0.<br/>
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.</p>


<h3><a name="SNMP-Examples"></a>Examples</h3>

<p>Polling a remote device:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
snmp:192.168.178.23:161?protocol=udp&amp;type=poll&amp;oids=1.3.6.1.2.1.1.5.0
</pre>
</div></div>

<p>Setting up a trap receiver (<b>Note that no OID info is needed here!</b>):</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
snmp:127.0.0.1:162?protocol=udp&amp;type=trap
</pre>
</div></div>

<p>Routing example in Java: (converts the SNMP PDU to XML String)</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
from(<span class="code-quote">"snmp:192.168.178.23:161?protocol=udp&amp;type=poll&amp;oids=1.3.6.1.2.1.1.5.0"</span>).
convertBodyTo(<span class="code-object">String</span>.class).
to(<span class="code-quote">"activemq:snmp.states"</span>);
</pre>
</div></div>

<h3><a name="SNMP-SeeAlso"></a>See Also</h3>
<ul>
	<li><a href="/confluence/display/CAMEL/Configuring+Camel" title="Configuring Camel">Configuring
Camel</a></li>
	<li><a href="/confluence/display/CAMEL/Component" title="Component">Component</a></li>
	<li><a href="/confluence/display/CAMEL/Endpoint" title="Endpoint">Endpoint</a></li>
	<li><a href="/confluence/display/CAMEL/Getting+Started" title="Getting Started">Getting
Started</a></li>
</ul>

     </div>
     <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href="http://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
       </div>

       <a href="http://cwiki.apache.org/confluence/display/CAMEL/SNMP">View Online</a>
       |
       <a href="http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=3474742&revisedVersion=6&originalVersion=5">View
Change</a>
              |
       <a href="http://cwiki.apache.org/confluence/display/CAMEL/SNMP?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message