Configuring NRPE custom parameters
Posted: Thu Oct 04, 2012 11:43 am
Linux Distribution and version:
Linux nagiosxi.colo 2.6.32-279.5.1.el6.x86_64 #1 SMP Tue Aug 14 23:54:45 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
VMware Image: CentOS release 6.3 (Final)
Kernel 2.6.32-279.5.1.el6.x86_64 on an x86_64
We have a relatively large infrastructure setup in Nagios Core 3.4.1 and would like to move into the Nagios XI but with the issue we are describing here, we would like to know if our approach to resolve (what we see as an issue now) is correct or we are missing something that would make us later on have to re-do everything else back to what it was initially.
We have no problem with anything setup and configuration but rather an issue with interfacing with NRPE.
Following steps are made:
1-) Add new system with the wizard (great stuff).
2-) Enabling service: '/ Disk Usage' (fails miserably)
If we look at the monitoring settings we can see the following:
> check_nrpe!check_disk!-a '-w 20% -c 10% -p /'
Interestingly, it makes no difference what we want to put here since the NREP client has all remote-commands hardcoded at the /etc/nagios/nrpe.cfg.
Note: First main issue but not a big deal since we have control to change that.
e.g.: command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10
Instead of this one (which works almost perfect):
e.g.: command[check_users]=/usr/lib/nagios/plugins/check_users -w $ARG1$ -c $ARG2$
Our approach is not perfectly good either since it also limits us to only have these parameters accepted in each remote-client.
It would be great to do what you seem (at least we understand it like it) to do by passing a single set of parameters which are then to be 'exploded' somehow into multiple ones.
It only works (great) if we do the following at the web-interface:
[web-interface remote-command] > check_nrpe!check_disk!-a 2 10 /
or at the shell level:
[nagios-shell remote-command ]> check_nrpe -H <target-server> -c check_disk -a 20% 10% /
DISK OK - free space: / 10602 MB (58% inode=96%);| /=7453MB;15207;17108;0;19009
or
[nagios-shell remote-command ]> check_nrpe -H <target-server> -c check_disk -a '-w20% -c10% -p/'
DISK OK - free space: / 10602 MB (58% inode=96%);| /=7453MB;19009;17108;0;19009
Note: Works with and without passing the percentage as part of the parameters but for sure, it does not work if we place spaces between the switches and the parameters.
check_nrpe -H <target-server> -c check_disk -a '-w 20% -c 10% -p /'
DISK CRITICAL - 20% is not accessible: No such file or directory
We are wondering if the commands-templates should be modified to eliminate the anything but the parameters we need (without command switches and just parameters).
It's highly probable, since we are new to this system we might not be setting up the clients properly.
[remote client] > cat /etc/nagios/nrpe.cfg
log_facility=daemon
pid_file=/var/run/nagios/nrpe.pid
server_port=5666
nrpe_user=nagios
nrpe_group=nagios
allowed_hosts=127.0.0.1
dont_blame_nrpe=1
command_prefix=/usr/bin/sudo
debug=0
command_timeout=60
connection_timeout=300
include=/etc/nagios/nrpe_local.cfg
include_dir=/etc/nagios/nrpe.d/
## These commands are enabled by default (we have commented them out):
#command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10
#command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
#command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/hda1
#command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 5 -c 10 -s Z
#command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 150 -c 200
[remote-client] > cat /etc/nagios/nrpe_local.cfg
allowed_hosts=127.0.0.1,10.220.39.211
## These plugins do exist at /usr/lib/nagios/plugins/*:
command[check_apt]=/usr/lib/nagios/plugins/check_apt
command[check_all_disks]=/usr/lib/nagios/plugins/check_disk -w $ARG1$ -c $ARG2$ -e
command[check_cron]=echo "Service: `initctl list|grep cron`"
command[check_disk]=/usr/lib/nagios/plugins/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
command[check_load]=/usr/lib/nagios/plugins/check_load -w $ARG1$ -c $ARG2$
command[check_procs]=/usr/lib/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
command[check_rsyslog]=echo "Service: `initctl list|grep rsyslog`"
command[check_swap]=/usr/lib/nagios/plugins/check_swap -w $ARG1$ -c $ARG2$
command[check_ssh]=/usr/lib/nagios/plugins/check_ssh $ARG1$
command[check_users]=/usr/lib/nagios/plugins/check_users -w $ARG1$ -c $ARG2$
command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$ -s Z
## These plugins do not exist (we had to create them but are part of the setup features):
command[check_cpu_stats]=/usr/lib/nagios/plugins/check_cpu_stats -w $ARG1$ -c $ARG2$
command[check_mem]=/usr/lib/nagios/plugins/check_mem -w $ARG1$ -c $ARG2$ -f -C
command[check_open_files]=/usr/lib/nagios/plugins/check_open_files -w $ARG1$ -c $ARG2$
Linux nagiosxi.colo 2.6.32-279.5.1.el6.x86_64 #1 SMP Tue Aug 14 23:54:45 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
VMware Image: CentOS release 6.3 (Final)
Kernel 2.6.32-279.5.1.el6.x86_64 on an x86_64
We have a relatively large infrastructure setup in Nagios Core 3.4.1 and would like to move into the Nagios XI but with the issue we are describing here, we would like to know if our approach to resolve (what we see as an issue now) is correct or we are missing something that would make us later on have to re-do everything else back to what it was initially.
We have no problem with anything setup and configuration but rather an issue with interfacing with NRPE.
Following steps are made:
1-) Add new system with the wizard (great stuff).
2-) Enabling service: '/ Disk Usage' (fails miserably)
If we look at the monitoring settings we can see the following:
> check_nrpe!check_disk!-a '-w 20% -c 10% -p /'
Interestingly, it makes no difference what we want to put here since the NREP client has all remote-commands hardcoded at the /etc/nagios/nrpe.cfg.
Note: First main issue but not a big deal since we have control to change that.
e.g.: command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10
Instead of this one (which works almost perfect):
e.g.: command[check_users]=/usr/lib/nagios/plugins/check_users -w $ARG1$ -c $ARG2$
Our approach is not perfectly good either since it also limits us to only have these parameters accepted in each remote-client.
It would be great to do what you seem (at least we understand it like it) to do by passing a single set of parameters which are then to be 'exploded' somehow into multiple ones.
It only works (great) if we do the following at the web-interface:
[web-interface remote-command] > check_nrpe!check_disk!-a 2 10 /
or at the shell level:
[nagios-shell remote-command ]> check_nrpe -H <target-server> -c check_disk -a 20% 10% /
DISK OK - free space: / 10602 MB (58% inode=96%);| /=7453MB;15207;17108;0;19009
or
[nagios-shell remote-command ]> check_nrpe -H <target-server> -c check_disk -a '-w20% -c10% -p/'
DISK OK - free space: / 10602 MB (58% inode=96%);| /=7453MB;19009;17108;0;19009
Note: Works with and without passing the percentage as part of the parameters but for sure, it does not work if we place spaces between the switches and the parameters.
check_nrpe -H <target-server> -c check_disk -a '-w 20% -c 10% -p /'
DISK CRITICAL - 20% is not accessible: No such file or directory
We are wondering if the commands-templates should be modified to eliminate the anything but the parameters we need (without command switches and just parameters).
It's highly probable, since we are new to this system we might not be setting up the clients properly.
[remote client] > cat /etc/nagios/nrpe.cfg
log_facility=daemon
pid_file=/var/run/nagios/nrpe.pid
server_port=5666
nrpe_user=nagios
nrpe_group=nagios
allowed_hosts=127.0.0.1
dont_blame_nrpe=1
command_prefix=/usr/bin/sudo
debug=0
command_timeout=60
connection_timeout=300
include=/etc/nagios/nrpe_local.cfg
include_dir=/etc/nagios/nrpe.d/
## These commands are enabled by default (we have commented them out):
#command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10
#command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
#command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/hda1
#command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 5 -c 10 -s Z
#command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 150 -c 200
[remote-client] > cat /etc/nagios/nrpe_local.cfg
allowed_hosts=127.0.0.1,10.220.39.211
## These plugins do exist at /usr/lib/nagios/plugins/*:
command[check_apt]=/usr/lib/nagios/plugins/check_apt
command[check_all_disks]=/usr/lib/nagios/plugins/check_disk -w $ARG1$ -c $ARG2$ -e
command[check_cron]=echo "Service: `initctl list|grep cron`"
command[check_disk]=/usr/lib/nagios/plugins/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
command[check_load]=/usr/lib/nagios/plugins/check_load -w $ARG1$ -c $ARG2$
command[check_procs]=/usr/lib/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
command[check_rsyslog]=echo "Service: `initctl list|grep rsyslog`"
command[check_swap]=/usr/lib/nagios/plugins/check_swap -w $ARG1$ -c $ARG2$
command[check_ssh]=/usr/lib/nagios/plugins/check_ssh $ARG1$
command[check_users]=/usr/lib/nagios/plugins/check_users -w $ARG1$ -c $ARG2$
command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$ -s Z
## These plugins do not exist (we had to create them but are part of the setup features):
command[check_cpu_stats]=/usr/lib/nagios/plugins/check_cpu_stats -w $ARG1$ -c $ARG2$
command[check_mem]=/usr/lib/nagios/plugins/check_mem -w $ARG1$ -c $ARG2$ -f -C
command[check_open_files]=/usr/lib/nagios/plugins/check_open_files -w $ARG1$ -c $ARG2$