このコンテンツは選択した言語では利用できません。

Chapter 222. Nagios Component


Available as of Camel version 2.3

The Nagios component allows you to send passive checks to Nagios.

Maven users will need to add the following dependency to their pom.xml for this component:

<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>
Copy to Clipboard Toggle word wrap

222.1. URI format

nagios://host[:port][?Options]
Copy to Clipboard Toggle word wrap

Camel provides two abilities with the Nagios component. You can send passive check messages by sending a message to its endpoint.
Camel also provides a EventNotifer which allows you to send notifications to Nagios.

222.2. Options

The Nagios component supports 2 options which are listed below.

Expand
NameDescriptionDefaultType

configuration (advanced)

To use a shared NagiosConfiguration

 

NagiosConfiguration

resolveProperty Placeholders (advanced)

Whether the component should resolve property placeholders on itself when starting. Only properties which are of String type can use property placeholders.

true

boolean

The Nagios endpoint is configured using URI syntax:

nagios:host:port
Copy to Clipboard Toggle word wrap

with the following path and query parameters:

222.2.1. Path Parameters (2 parameters):

Expand
NameDescriptionDefaultType

host

Required This is the address of the Nagios host where checks should be send.

 

String

port

Required The port number of the host.

 

int

222.2.2. Query Parameters (7 parameters):

Expand
NameDescriptionDefaultType

connectionTimeout (producer)

Connection timeout in millis.

5000

int

sendSync (producer)

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.

true

boolean

timeout (producer)

Sending timeout in millis.

5000

int

synchronous (advanced)

Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported).

false

boolean

encryption (security)

To specify an encryption method.

 

Encryption

encryptionMethod (security)

Deprecated To specify an encryption method.

 

NagiosEncryptionMethod

password (security)

Password to be authenticated when sending checks to Nagios.

 

String

222.3. 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");
Copy to Clipboard Toggle word wrap

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);
Copy to Clipboard Toggle word wrap

222.4. 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:

        NagiosEventNotifier notifier = new NagiosEventNotifier();
        notifier.getConfiguration().setHost("localhost");
        notifier.getConfiguration().setPort(5667);
        notifier.getConfiguration().setPassword("password");

        CamelContext context = ...
        context.getManagementStrategy().addEventNotifier(notifier);
        return context;
Copy to Clipboard Toggle word wrap

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: Advanced configuration of CamelContext using Spring.

222.5. See Also

  • Configuring Camel
  • Component
  • Endpoint
  • Getting Started
トップに戻る
Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。 最新の更新を見る.

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

Theme

© 2025 Red Hat