camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Camel > Nagios
Date Thu, 18 Aug 2011 10:05:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/2042/9/1/_/styles/combined.css?spaceKey=CAMEL&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/CAMEL/Nagios">Nagios</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~davsclaus">Claus
Ibsen</a>
    </h4>
        <br/>
                         <h4>Changes (2)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >| {{connectionTimeout}} | 5000 | Connection
timeout in millis. | <br>| {{timeout}} | 5000 | Sending timeout in millis. | <br></td></tr>
            <tr><td class="diff-changed-lines" >| {{nagiosSettings}} | | To use
an already configured {{com.googlecode.jsendnsca.core.NagiosSettings}} object. <span class="diff-added-words"style="background-color:
#dfd;">Then any of the other options are not in use, if using this.</span> | <br></td></tr>
            <tr><td class="diff-unchanged" >| {{sendSync}} | {{true}} | Whether
or not to use synchronous when sending a passive check. Setting it to {{false}} will allow
Camel to continue routing the message and the passive check message will be send asynchronously.
| <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">|
{{encryptionMode}} | {{No}} | *Camel 2.9:* To specify an encryption mode. Possible values:
{{No}}, {{Xor}}, or {{TripleDes}}. | <br></td></tr>
            <tr><td class="diff-unchanged" >{div} <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h2><a name="Nagios-Nagios"></a>Nagios</h2>
<p><b>Available as of Camel 2.3</b></p>

<p>The <a href="/confluence/display/CAMEL/Nagios" title="Nagios">Nagios</a>
component allows you to send passive checks to <a href="http://nagios.org" class="external-link"
rel="nofollow">Nagios</a>.</p>

<p>Maven users will need to add the following dependency to their <tt>pom.xml</tt>
for this component:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
&lt;dependency&gt;
    &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
    &lt;artifactId&gt;camel-nagios&lt;/artifactId&gt;
    &lt;version&gt;x.x.x&lt;/version&gt;
    &lt;!-- use the same version as your Camel core version --&gt;
&lt;/dependency&gt;
</pre>
</div></div>


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

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
nagios:<span class="code-comment">//host[:port][?Options]</span>
</pre>
</div></div>

<p>Camel provides two abilities with the <a href="/confluence/display/CAMEL/Nagios"
title="Nagios">Nagios</a> component. You can send passive check messages by sending
a message to its endpoint.<br/>
Camel also provides a <a href="/confluence/display/CAMEL/Camel+JMX" title="Camel JMX">EventNotifer</a>
which allows you to send notifications to Nagios.</p>

<h3><a name="Nagios-Options"></a>Options</h3>
<div class="confluenceTableSmall"><div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Name </th>
<th class='confluenceTh'> Default Value </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> <tt>host</tt> </td>
<td class='confluenceTd'> none </td>
<td class='confluenceTd'> This is the address of the <a href="/confluence/display/CAMEL/Nagios"
title="Nagios">Nagios</a> host where checks should be send. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>port</tt> </td>
<td class='confluenceTd'>&nbsp;</td>
<td class='confluenceTd'> The port number of the host. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>password</tt> </td>
<td class='confluenceTd'>&nbsp;</td>
<td class='confluenceTd'> Password to be authenticated when sending checks to Nagios.
</td>
</tr>
<tr>
<td class='confluenceTd'> <tt>connectionTimeout</tt> </td>
<td class='confluenceTd'> 5000 </td>
<td class='confluenceTd'> Connection timeout in millis. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>timeout</tt> </td>
<td class='confluenceTd'> 5000 </td>
<td class='confluenceTd'> Sending timeout in millis. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>nagiosSettings</tt> </td>
<td class='confluenceTd'>&nbsp;</td>
<td class='confluenceTd'> To use an already configured <tt>com.googlecode.jsendnsca.core.NagiosSettings</tt>
object. Then any of the other options are not in use, if using this. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>sendSync</tt> </td>
<td class='confluenceTd'> <tt>true</tt> </td>
<td class='confluenceTd'> Whether or not to use synchronous when sending a passive check.
Setting it to <tt>false</tt> will allow Camel to continue routing the message
and the passive check message will be send asynchronously. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>encryptionMode</tt> </td>
<td class='confluenceTd'> <tt>No</tt> </td>
<td class='confluenceTd'> <b>Camel 2.9:</b> To specify an encryption mode.
Possible values: <tt>No</tt>, <tt>Xor</tt>, or <tt>TripleDes</tt>.
</td>
</tr>
</tbody></table>
</div>
</div>

<h3><a name="Nagios-Headers"></a>Headers</h3>
<div class="confluenceTableSmall"><div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Name </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> <tt>CamelNagiosHostName</tt> </td>
<td class='confluenceTd'> This is the address of the <a href="/confluence/display/CAMEL/Nagios"
title="Nagios">Nagios</a> host where checks should be send. This header will override
any existing hostname configured on the endpoint. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>CamelNagiosLevel</tt> </td>
<td class='confluenceTd'> This is the severity level. You can use values <tt>CRITICAL,
WARNING, OK</tt>. Camel will by default use <tt>OK</tt>. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>CamelNagiosServiceName</tt> </td>
<td class='confluenceTd'> The servie name. Will default use the <a href="/confluence/display/CAMEL/CamelContext"
title="CamelContext">CamelContext</a> name. </td>
</tr>
</tbody></table>
</div>
</div>


<h3><a name="Nagios-Sendingmessageexamples"></a>Sending message examples</h3>
<p>You can send a message to Nagios where the message payload contains the message.
By default it will be <tt>OK</tt> level and use the <a href="/confluence/display/CAMEL/CamelContext"
title="CamelContext">CamelContext</a> name as the service name. You can overrule
these values using headers as shown above.</p>

<p>For example we send the <tt>Hello Nagios</tt> message to Nagios as follows:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
    template.sendBody(<span class="code-quote">"direct:start"</span>, <span
class="code-quote">"Hello Nagios"</span>);

    from(<span class="code-quote">"direct:start"</span>).to(<span class="code-quote">"nagios:127.0.0.1:5667?password=secret"</span>).to(<span
class="code-quote">"mock:result"</span>);
</pre>
</div></div>

<p>To send a <tt>CRITICAL</tt> message you can send the headers such as:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
        Map headers = <span class="code-keyword">new</span> HashMap();
        headers.put(NagiosConstants.LEVEL, <span class="code-quote">"CRITICAL"</span>);
        headers.put(NagiosConstants.HOST_NAME, <span class="code-quote">"myHost"</span>);
        headers.put(NagiosConstants.SERVICE_NAME, <span class="code-quote">"myService"</span>);
        template.sendBodyAndHeaders(<span class="code-quote">"direct:start"</span>,
<span class="code-quote">"Hello Nagios"</span>, headers);
</pre>
</div></div>

<h3><a name="Nagios-Using%7B%7BNagiosEventNotifer%7D%7D"></a>Using <tt>NagiosEventNotifer</tt></h3>
<p>The <a href="/confluence/display/CAMEL/Nagios" title="Nagios">Nagios</a>
component also provides an <a href="/confluence/display/CAMEL/Camel+JMX" title="Camel JMX">EventNotifer</a>
which you can use to send events to Nagios. For example we can enable this from Java as follows:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
        NagiosEventNotifier notifier = <span class="code-keyword">new</span> NagiosEventNotifier();
        notifier.getConfiguration().setHost(<span class="code-quote">"localhost"</span>);
        notifier.getConfiguration().setPort(5667);
        notifier.getConfiguration().setPassword(<span class="code-quote">"password"</span>);

        CamelContext context = ... 
        context.getManagementStrategy().addEventNotifier(notifier);
        <span class="code-keyword">return</span> context;
</pre>
</div></div>

<p>In Spring XML its just a matter of defining a Spring bean with the type <tt>EventNotifier</tt>
and Camel will pick it up as documented here: <a href="/confluence/display/CAMEL/Advanced+configuration+of+CamelContext+using+Spring"
title="Advanced configuration of CamelContext using Spring">Advanced configuration of CamelContext
using Spring</a>.</p>

<h3><a name="Nagios-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="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/CAMEL/Nagios">View Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=12321565&revisedVersion=4&originalVersion=3">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/CAMEL/Nagios?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message