nagios nrpe settings
http://nagios.sourceforge.net/docs/nrpe/NRPE.pdf
yumで入れるだけなので
サーバー側追加 plugin
nagios-plugins-nrpe.x86_64 : Provides nrpe plugin for Nagios
クライアント側( nagios と必要な pluginsも入れます。
nrpe.x86_64 : Host/service/network monitoring agent for Nagios
クライアント側設定
/etc/nagios/nrpe.cfg
# 待ち受け interface
server_address=192.168.0.26
# サーバー ipaddress
allowed_hosts=192.168.0.170
( iptablesでこれを許可します。
起動
Starting nrpe: [ OK ]
確認
tcp 0 0 192.168.0.26:25666 0.0.0.0:* LISTEN
NRPE v2.13
* allow_hostsに入っていないサーバーから行うとerror
CHECK_NRPE: Error – Could not complete SSL handshake.
clientの設定はこれだけ
後はサーバーに監視設定を追加するだけ
■ サーバー側設定
“objects/commands.cfg”にコマンド追加
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -p 25666 -c $ARG1$
}
とりあえず、こんな感じでcfg追加
use template-internet-host
host_name server_26
address 192.168.0.26
notes normal vps
name server_26
}
define hostgroup{
hostgroup_name NrpeHosts
alias Nrpe All Hosts
members server_26,server_27,server_28
}
define service{
use generic-service
hostgroup_name NrpeHosts
service_description CPU Load
check_command check_nrpe!check_load
}
define service{
use generic-service
hostgroup_name NrpeHosts
service_description Current Users
check_command check_nrpe!check_users
}
# nagios -v nagios.cfg
# /etc/init.d/nagios restart
問題なくデータ取得出来ました。
* クライアント側でオプションパラメーター設定
nrpe.cfg のコマンド設定部分に
vi /usr/local/nagios/etc/nrpe.cfg
# Add a new check_swap command definition that uses the command line from above and save the file.
command[check_swap]=/usr/local/nagios/libexec/check_swap -w 20% -c 10%
のようにオプション設定する。