リモート側でプラグインを実行して監視側へ返してくれる
仲介役のプラグ。
ちなみに、*NIXだけでなく、Windows版もあるため
Windowsサーバのリソースも見れたりしますъ(`ー゜)
最新版の ソースファイルを本家よりダウンロードします。
■リモート側
1) nagios_pluginのインストール
# mkdir /usr/local/nagios
# groupadd nagios
# useradd -g nagios -d /usr/local/nagios -s /bin/false nagios
$ wget URL
$ tar zxvf nagios-plugins-x.x.tar.gz
$ cd nagios-plugins
$ ./configure
$ make all
# make install
2) NRPEインストール
$ wget URL
$ tar zxvf nrpe-x.x.tar.gz
$ cd nrpe-x.x
$ ./configure
$ make all
# mkdir /usr/local/nagios
# cp src/nrpe /usr/local/nagios/bin/
# mkdir /usr/local/nagios/etc
# cp sample-config/nrpe.cfg /usr/local/nagios/etc/
# chown nagios:nagios /usr/local/nagios/etc/nrpe.cfg
3) コマンド定義
# 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
4) 自動起動設定
# cp NRPE Source Path/init-script.xxx /etc/init.d/nrpe
※ init-scriptはいくつかのディストリビューション用に作成されてるので
自分の環境に合ったのをコピーしてください。
# chmod 755 /etc/init.d/nrpe
# cd /etc/rc2.d
※自分のランレベルに合わせて書き換えてください。
# ln -s ../init.d/nrpe S99nrpe
■監視側
1) インストール
$ wget URL
$ tar zxvf nrpe-x.x.tar.gz
$ cd nrpe-x.x
$ ./configure
$ make all
# cd src
# cp check_nrpe /usr/local/nagios/libexec
2) 設定
プラグインも本家においてあるので最新版をダウンロードします。
define commandの書かれているファイルに下記を追加
--- ここから ---
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
--- ここまで ---
3) 監視定義
Service定義ファイルに必要な分だけ追加define service{ 内のcheck_commandをnrpe用で作成
check_command check_nrpe!check_xxxx
※リモートの監視は別途(define host等)設定しておく必要があります。
後はNagiosを再起動してリモート側のデータが取れてればOK