Top/Nagios/NRPE

NRPE の変更点はてなブックマーク


Nagios Remote Plugin Executor.~
デーモンプログラムとその設定ファイル、そして1つのプラグインによって構成される。~
リモートホストでNagiosプラグインを実行し、あたかもローカルで実行したように結果を返すもの。~
~
[[ダウンロード>http://www.nagios.org/download/extras.php]]~
~
処理の流れは次のような感じです。
|監視サーバー|監視対象|監視サーバー|h
|SIZE(10):|SIZE(10):|SIZE(10):|c
|Nagiosがcheck_nrpeを実行しリクエストを送信→|NRPEが受信→プラグインを実行→応答を送信→|Nagiosが応答を受信|

*リモートホスト側のインストール
下記の前にプラグインのみをインストールしておく([[Nagios/プラグイン]])&br;
以下では
|~データを受け取るNagiosのIP|192.168.0.1|
と仮定。

ユーザー
 mkdir /usr/local/nagios
 groupadd nagios
 useradd nagios -g nagios -d /usr/local/nagios -s /bin/false

インストール
 tar zxvf nrpe-2.0.tar.gz
 cd nrpe-2.0
 ./configure
 make all

 cp src/nrpe /usr/local/nagios/bin/
 cp nrpe.cfg /usr/local/nagios/etc/
 chown nagios.nagios /usr/local/nagios/etc/nrpe.cfg

nrpe.cfgにコマンドの設定をする~
 vi /usr/local/nagios/etc/nrpe.cfg
任意のコマンドを定義
 command[check_load]=/usr/local/nagios/libexec/check_load -w 1.5,1.5,1.5 -c 2,2,2
~

サービスポート一覧に登録
 vi +534 /etc/services
>
 nrpe            5666/tcp                        # NRPE

xinetdに登録
 vi /etc/xinetd.d/nrpe
>
 # default: on
 # description: NRPE
 service nrpe
 {
   flags           = REUSE
   socket_type     = stream
   wait            = no
   user            = nagios
   server          = /usr/local/nagios/bin/nrpe
   server_args     = -c /usr/local/nagios/etc/nrpe.cfg --inetd
   log_on_failure  += USERID
   disable         = no
   only_from       = 192.168.0.1
 }

TCP Wrappersをかける
 vi /etc/hosts.deny
>
 nrpe:      ALL  EXCEPT 192.168.0.1

動作確認
 /etc/rc.d/init.d/xinetd restart
 tail /var/log/messages

*クライアント側のインストール [#client]
インストール
 tar zxvf nrpe-1.9.tar.gz
 cd nrpe-1.9
 ./configure
 make all

 cp src/check_nrpe /usr/local/nagios/libexec/

コマンドの設定
 vi /usr/local/nagios/etc/checkcommands.cfg
>
 define command{
         command_name    check_nrpe
         command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
         }

//"Could not complete SSL handshake."というエラーが出るときはアプリケーションの所有権をチェックする。(以前nrpeの所有権がrootになっていてハマりました。)

"Could not complete SSL handshake."というエラーが出るときは
 tail /var/log/secure
として、原因を調査。~
接続元にユーザーnagiosを追加してないなんてこともあるので、手順を再確認して下さい。

*クライアントからパラメーターを指定できるようにする
-リモートホスト~
リモートホスト側をmakeする際にオプションを指定
 ./configure --enable-command-args
設定も下記のように書き換える
 vi nrpe.cfg
>
 dont_blame_nrpe=1

>
 command[check_load]=/usr/local/nagios/libexec/check_load -w $ARG1$ -c $ARG2$

-クライアント~
 vi checkcommands.cfg
>
 define command{
         command_name    check_nrpe
         command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$
         }

>各監視対象サービスの定義は
 define service{
     use                             generic-service
     host_name                       hoge
     service_description             LOAD
     is_volatile                     0
     check_period                    24x7
     max_check_attempts              3
     normal_check_interval           5
     retry_check_interval            1
     check_command                   check_nrpe!check_load!1,1,1 2,2,2
     }


*ポート
TCP 5666

*参考
-[[リモートホスト管理(NRPE・NRPEP・NSClient)>http://www.e-ryoichi.net/admin/netsaint_advanced/remote_plugin_executor.html]]

*気になる
-[[Stunnel.org>http://www.stunnel.org/]]

*Amazon
#amazon(4774145823,left)
#amazon(3897218801,left)
#amazon(4774135666,left)
#amazon(4797820217,left)
#amazon(4774165433,left)
#amazon(4774178659,left)
差分 一覧