Repository: camel Updated Branches: refs/heads/master 06558068e -> 178e74e79
Added camel-nagios docs to Gitbook Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/178e74e7 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/178e74e7 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/178e74e7 Branch: refs/heads/master Commit: 178e74e79c19f2dc5b1f10f80be6482566c04438 Parents: 0655806 Author: Andrea Cosentino <anco...@gmail.com> Authored: Thu May 12 10:17:59 2016 +0200 Committer: Andrea Cosentino <anco...@gmail.com> Committed: Thu May 12 10:17:59 2016 +0200 ---------------------------------------------------------------------- .../camel-nagios/src/main/docs/nagios.adoc | 138 +++++++++++++++++++ docs/user-manual/en/SUMMARY.md | 1 + 2 files changed, 139 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/178e74e7/components/camel-nagios/src/main/docs/nagios.adoc ---------------------------------------------------------------------- diff --git a/components/camel-nagios/src/main/docs/nagios.adoc b/components/camel-nagios/src/main/docs/nagios.adoc new file mode 100644 index 0000000..6df6382 --- /dev/null +++ b/components/camel-nagios/src/main/docs/nagios.adoc @@ -0,0 +1,138 @@ +[[Nagios-Nagios]] +Nagios +~~~~~~ + +*Available as of Camel 2.3* + +The link:nagios.html[Nagios] component allows you to send passive checks +to http://nagios.org[Nagios]. + +Maven users will need to add the following dependency to their `pom.xml` +for this component: + +[source,java] +------------------------------------------------------------ +<dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-nagios</artifactId> + <version>x.x.x</version> + <!-- use the same version as your Camel core version --> +</dependency> +------------------------------------------------------------ + +[[Nagios-URIformat]] +URI format +^^^^^^^^^^ + +[source,java] +------------------------------ +nagios://host[:port][?Options] +------------------------------ + +Camel provides two abilities with the link:nagios.html[Nagios] +component. You can send passive check messages by sending a message to +its endpoint. + + Camel also provides a link:camel-jmx.html[EventNotifer] which allows +you to send notifications to Nagios. + +[[Nagios-Options]] +Options +^^^^^^^ + + +// component options: START +The Nagios component supports 1 options which are listed below. + + + +[width="100%",cols="2s,1m,8",options="header"] +|======================================================================= +| Name | Java Type | Description +| configuration | NagiosConfiguration | To use a shared NagiosConfiguration +|======================================================================= +// component options: END + + + +// endpoint options: START +The Nagios component supports 9 endpoint options which are listed below: + +[width="100%",cols="2s,1,1m,1m,5",options="header"] +|======================================================================= +| Name | Group | Default | Java Type | Description +| host | producer | | String | *Required* This is the address of the Nagios host where checks should be send. +| port | producer | | int | *Required* The port number of the host. +| connectionTimeout | producer | 5000 | int | Connection timeout in millis. +| encryptionMethod | producer | | NagiosEncryptionMethod | To specify an encryption method. +| password | producer | | String | Password to be authenticated when sending checks to Nagios. +| sendSync | producer | true | boolean | 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. +| timeout | producer | 5000 | int | Sending timeout in millis. +| exchangePattern | advanced | InOnly | ExchangePattern | Sets the default exchange pattern when creating an exchange +| synchronous | advanced | false | boolean | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported). +|======================================================================= +// endpoint options: END + + +[[Nagios-Sendingmessageexamples]] +Sending message examples +^^^^^^^^^^^^^^^^^^^^^^^^ + +You can send a message to Nagios where the message payload contains the +message. By default it will be `OK` level and use the +link:camelcontext.html[CamelContext] name as the service name. You can +overrule these values using headers as shown above. + +For example we send the `Hello Nagios` message to Nagios as follows: + +[source,java] +--------------------------------------------------------------------------------------- + template.sendBody("direct:start", "Hello Nagios"); + + from("direct:start").to("nagios:127.0.0.1:5667?password=secret").to("mock:result"); +--------------------------------------------------------------------------------------- + +To send a `CRITICAL` message you can send the headers such as: + +[source,java] +----------------------------------------------------------------------------- + Map headers = new HashMap(); + headers.put(NagiosConstants.LEVEL, "CRITICAL"); + headers.put(NagiosConstants.HOST_NAME, "myHost"); + headers.put(NagiosConstants.SERVICE_NAME, "myService"); + template.sendBodyAndHeaders("direct:start", "Hello Nagios", headers); +----------------------------------------------------------------------------- + +[[Nagios-UsingNagiosEventNotifer]] +Using `NagiosEventNotifer` +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The link:nagios.html[Nagios] component also provides an +link:camel-jmx.html[EventNotifer] which you can use to send events to +Nagios. For example we can enable this from Java as follows: + +[source,java] +------------------------------------------------------------------- + NagiosEventNotifier notifier = new NagiosEventNotifier(); + notifier.getConfiguration().setHost("localhost"); + notifier.getConfiguration().setPort(5667); + notifier.getConfiguration().setPassword("password"); + + CamelContext context = ... + context.getManagementStrategy().addEventNotifier(notifier); + return context; +------------------------------------------------------------------- + +In Spring XML its just a matter of defining a Spring bean with the type +`EventNotifier` and Camel will pick it up as documented here: +link:advanced-configuration-of-camelcontext-using-spring.html[Advanced +configuration of CamelContext using Spring]. + +[[Nagios-SeeAlso]] +See Also +^^^^^^^^ + +* link:configuring-camel.html[Configuring Camel] +* link:component.html[Component] +* link:endpoint.html[Endpoint] +* link:getting-started.html[Getting Started] + http://git-wip-us.apache.org/repos/asf/camel/blob/178e74e7/docs/user-manual/en/SUMMARY.md ---------------------------------------------------------------------- diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md index c01b5ec..12c6526 100644 --- a/docs/user-manual/en/SUMMARY.md +++ b/docs/user-manual/en/SUMMARY.md @@ -203,6 +203,7 @@ * [Mvel](mvel.adoc) * [Mybatis](mybatis.adoc) * [Mock](mock.adoc) + * [Nagios](nagios.adoc) * [NATS](nats.adoc) * [Properties](properties.adoc) * [Quickfix](quickfix.adoc)