Fuse 6 is no longer supported
As of February 2025, Red Hat Fuse 6 is no longer supported. If you are using Fuse 6, please upgrade to Red Hat build of Apache Camel.此内容没有您所选择的语言版本。
Chapter 115. Nagios
Nagios 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
Available as of Apache Camel 2.3
URI format 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
nagios://host[:port][?Options]
nagios://host[:port][?Options]
Apache Camel provides two abilities with the Nagios component. You can send passive check messages by sending a message to its endpoint. Apache Camel also provides a EventNotifer which allows you to send notifications to Nagios.
Options 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
Name | Default Value | Description |
---|---|---|
host
|
none | This is the address of the Nagios host where checks should be send. |
port
|
The port number of the host. | |
password
|
Password to be authenticated when sending checks to Nagios. | |
connectionTimeout
|
5000 | Connection timeout in millis. |
timeout
|
5000 | Sending timeout in millis. |
nagiosSettings
|
To use an already configured com.googlecode.jsendnsca.core.NagiosSettings object. Then any of the other options are not in use, if using this.
|
|
sendSync
|
true
|
Whether or not to use synchronous when sending a passive check. Setting it to false will allow Apache Camel to continue routing the message and the passive check message will be send asynchronously.
|
encryptionMethod
|
No
|
*Camel 2.9:* To specify an encryption method. Possible values: No , Xor , or TripleDes .
|
Headers 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
Name | Description |
---|---|
CamelNagiosHostName
|
This is the address of the Nagios host where checks should be send. This header will override any existing hostname configured on the endpoint. |
CamelNagiosLevel
|
This is the severity level. You can use values CRITICAL, WARNING, OK . Apache Camel will by default use OK .
|
CamelNagiosServiceName
|
The servie name. Will default use the CamelContext name. |
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 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:
template.sendBody("direct:start", "Hello Nagios"); from("direct:start").to("nagios:127.0.0.1:5667?password=secret").to("mock:result");
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:
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);
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);
Using NagiosEventNotifer 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
The Nagios component also provides an EventNotifer which you can use to send events to Nagios. For example we can enable this from Java as follows:
In Spring XML its just a matter of defining a Spring bean with the type
EventNotifier
and Apache Camel will pick it up as documented here: Advanced configuration of CamelContext using Spring.