nrpeの設定(備忘録)

題名に統一感がでてきたところで、本題に入ります。
nagiosっていうフリーのアプリケーションがあるんです。サーバのcpuやプロセスなどの監視をしてくれてとても便利なんすよ。先にnagiosのインストール方法を説明すべきかもしれないですが、忘れないために先にnrpeを書かせてもらいます。
Nagios Core - Browse Files at SourceForge.netよりnagios-2.10.tar.gzをダウンロードしてインストールします。

tar xvzf nagios-2.10.tar.gz
cd nagios-2.10
./configure
make
make install

/etc/nagios/nrpe.cfgの下部に

command[check_users]=/usr/lib/nagios/plugins/check_users -w 10 -c 15
command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
command[check_disk]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/sda1
command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 15 -c 25 -s Z
command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 230 -c 250
command[check_mysql]=/usr/lib/nagios/plugins/check_mysql -u username -p password -d dbname -w 80 -c 100
command[check_http]=/usr/lib/nagios/plugins/check_http -H xxx.xxx.xxx.xxx -u /hoge/index.html -w 1 -c 5

てな感じで、command[hoge]に記載されたhogenagiosインストールサーバから呼ぶコマンドとなり、呼び出し元からcheck_httpをコールすると/usr/lib/nagios/plugins/check_http -H xxx.xxx.xxx.xxx -u /hoge/index.html -w 1 -c 5が呼ばれる。

後、注意点としてインストール時に気をつけないと、check_xxxなどのシェルが想定と違う場所にインストールされることがあるので、もし/usr/lib/nagios/plugins/以下になければ、以下を実行して探し出す!!

find / -name "chech_mysql"

呼び出しもとのnagiosの設定はというと、/etc/nagios/service.cfgに以下のように追加していく

define service{
use hoge-service
host_name test # hosts.cfgで設定したホスト名
service_description HTTP # nagios監視用画面に表示されるタイトル
contact_groups testcontacts # contactsで設定した連絡先
check_command check_nrpe!check_http # !の後はパラメータ。check_nrpeにcheck_httpというパラメータを投げてます。
}

走りで書いたので間違っているかもしれません。