check_nrpe nrpe.cfg

とあるサーバーで使っているnrpe.cfg。
監視元のパラメーターを変更するだけでいいように./configure --enable-command-argsとしている。dont_blame_nrpe=1も通常は0だが、--enable-command-argsと対で1に変更。


サーバーは
192.168.3.10 PHP
192.168.3.11 PHP
192.168.2.20 MySQL
といった感じでの監視例

監視パラメーターを変更したいときは監視サーバーで変更できるので便利

pid_file=/var/run/nrpe.pid
server_port=5666
#server_address=192.168.1.1
nrpe_user=nagios
nrpe_group=nagios
allowed_hosts=210.x.x.x
dont_blame_nrpe=1
# command_prefix=/usr/bin/sudo
debug=0
command_timeout=60
connection_timeout=300
#allow_weak_random_seed=1
#include=
#include_dir=
#include_dir=
# command list
command[check_users]=/usr/lib/nagios/plugins/check_users -w $ARG1$ -c $ARG2$
command[check_load]=/usr/lib/nagios/plugins/check_load -w $ARG1$ -c $ARG2$
command[check_disk]=/usr/lib/nagios/plugins/check_disk -w $ARG1$ -c $ARG2$
command[check_procs]=/usr/lib/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
command[check_mysql]=/usr/lib/nagios/plugins/check_mysql -H 192.168.3.20 -u mysqlid -p mysqlpw -w $ARG1$ -c $ARG2$
command[check_8080_10]=/usr/lib/nagios/plugins/check_http -H 192.168.3.10 -p 8080
command[check_8088_10]=/usr/lib/nagios/plugins/check_http -H 192.168.3.10 -p 8088
command[check_8080_11]=/usr/lib/nagios/plugins/check_http -H 192.168.3.11 -p 8080
command[check_8088_11]=/usr/lib/nagios/plugins/check_http -H 192.168.3.11 -p 8088
command[check_ssh10]=/usr/lib/nagios/plugins/check_ssh -H 192.168.3.10
command[check_ssh11]=/usr/lib/nagios/plugins/check_ssh -H 192.168.3.11
command[check_ssh20]=/usr/lib/nagios/plugins/check_ssh -H 192.168.3.20
command[check_ping10]=/usr/lib/nagios/plugins/check_ping -H 192.168.3.10 -w $ARG1$ -c $ARG2$ -p 5
command[check_ping11]=/usr/lib/nagios/plugins/check_ping -H 192.168.3.11 -w $ARG1$ -c $ARG2$ -p 5
command[check_ping20]=/usr/lib/nagios/plugins/check_ping -H 192.168.3.20 -w $ARG1$ -c $ARG2$ -p 5
command[check_disk10]=/usr/local/nagios/bin/check_nrpe -H 192.168.3.10 -c check_disk -a $ARG1$ $ARG2$
command[check_disk11]=/usr/local/nagios/bin/check_nrpe -H 192.168.3.11 -c check_disk -a $ARG1$ $ARG2$
command[check_disk20]=/usr/local/nagios/bin/check_nrpe -H 192.168.3.20 -c check_disk -a $ARG1$ $ARG2$
command[check_load10]=/usr/local/nagios/bin/check_nrpe -H 192.168.3.10 -c check_load -a $ARG1$ $ARG2$
command[check_load11]=/usr/local/nagios/bin/check_nrpe -H 192.168.3.11 -c check_load -a $ARG1$ $ARG2$
command[check_load20]=/usr/local/nagios/bin/check_nrpe -H 192.168.3.20 -c check_load -a $ARG1$ $ARG2$


監視元の設定services.cfgは
check_mysql check_nrpea

define service{
use generic-service
host_name example.com
service_description check_mysql
check_command check_nrpea!check_mysql!10 20
}

APACHE

define service{
use generic-service
host_name example.com
service_description check_8080_10
check_command check_nrpe!check_8080_10
}
define service{
use generic-service
host_name example.com
service_description check_8080_11
check_command check_nrpe!check_8080_11
}
define service{
use generic-service
host_name example.com
service_description check_8088_10
check_command check_nrpe!check_8088_10
}
define service{
use generic-service
host_name example.com
service_description check_8088_11
check_command check_nrpe!check_8088_11
}

ssh check_nrpe

define service{
use generic-service
host_name example.com
service_description check_ssh10
check_command check_nrpe!check_ssh10
}
define service{
use generic-service
host_name example.com
service_description check_ssh11
check_command check_nrpe!check_ssh11
}
define service{
use generic-service
host_name example.com
service_description check_ssh20
check_command check_nrpe!check_ssh20
}

ping check_nrpea

define service{
use generic-service
host_name example.com
service_description check_ping10
check_command check_nrpea!check_ping10!100.0,20% 500.0,60%
}
define service{
use generic-service
host_name example.com
service_description check_ping11
check_command check_nrpea!check_ping11!100.0,20% 500.0,60%
}
define service{
use generic-service
host_name example.com
service_description check_ping20
check_command check_nrpea!check_ping20!100.0,20% 500.0,60%
}

check_disk check_nrpea

define service{
use generic-service
host_name example.com
service_description check_disk10
check_command check_nrpea!check_disk10!10% 5%
}
define service{
use generic-service
host_name example.com
service_description check_disk11
check_command check_nrpea!check_disk11!10% 5%
}
define service{
use generic-service
host_name example.com
service_description check_disk20
check_command check_nrpea!check_disk20!10% 5%
}

check_load check_nrpea

define service{
use generic-service
host_name example.com
service_description check_load10
check_command check_nrpea!check_load10!6,4,2 8,6,4
contact_groups manager
}
define service{
use generic-service
host_name example.com
service_description check_load11
check_command check_nrpea!check_load11!6,4,2 8,6,4
contact_groups manager
}
define service{
use generic-service
host_name example.com
service_description check_load20
check_command check_nrpea!check_load20!6,4,2 8,6,4
contact_groups manager
}


commands.cfgの check_nrpeとcheck_nrpeaは下記

define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
define command{
command_name check_nrpea
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $
ARG2$
}

もっといい方法は模索中。