Page 1 of 2
NRPE test ok but with args get Unknown argument -Help Please
Posted: Thu Feb 13, 2014 11:17 am
by danielbcjr
Hi guys,
I´m brand new about nrpe, I followed the docs about install Nagios Core and NRPE. In the nagios server, when i test the NRPE from the cliente i get:
[root@solitude ~]# /usr/local/nagios/libexec/check_nrpe -H 145.125.99.18
NRPE v2.15
But when I use commands and agrs I had that:
[root@solitude ~]# /usr/local/nagios/libexec/check_nrpe -H 145.125.99.18 -c check_disk 85% 90% /
Unknown argument
Usage:
check_disk -w limit -c limit [-W limit] [-K limit] {-p path | -x device}
[-C] [-E] [-e] [-f] [-g group ] [-k] [-l] [-M] [-m] [-R path ] [-r path ]
[-t timeout] [-u unit] [-v] [-X type] [-N type]
All the commands that I did with NRPE have the same problem.
Docs:
Solitude = Nagios Server
Winterhold = NRPE client
[root@solitude ~]# cat /usr/local/nagios/etc/servers/winterhold.cfg
define host{
name winterhold ; Name of this template
use generic-host
check_period 24x7
check_interval 1
retry_interval 1
max_check_attempts 10
check_command check-host-alive
notification_period 24x7
notification_interval 30
notification_options d,r
contact_groups admins
register 0 ; DONT REGISTER THIS - ITS A TEMPLATE
}
define host{
use linux-server ; Default values from a template
host_name winterhold ; The name we're giving to this server
alias Winterhold ; Name for the server
address 145.125.99.18 ; IP address of the server
}
define service{
use generic-service
host_name winterhold
service_description CPU CPU/Procs
check_command check_nrpe!check_procs!!40%!60%!--metric=CPU
}
define service{
use generic-service
host_name winterhold
service_description CPU Load
check_command check_nrpe!check_load!2.0,1.8,1,3!3.5,3.1,2.8
}
define service{
use generic-service
host_name winterhold
service_description Current Users
check_command check_nrpe!check_users!5!10
}
define service{
use generic-service
host_name winterhold
service_description / Free Space
check_command check_nrpe!check_disk! 20%! 10%! /
}
NRPE command in /usr/local/nagios/etc/objests/commands.cfg:
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
NRPE cliente (Winterhold):
command[check_users]=/usr/local/nagios/libexec/check_users -w $ARG1$ -c $ARG2$
command[check_load]=/usr/local/nagios/libexec/check_load -w $ARG1$ -c $ARG2$
command[check_disk]=/usr/local/nagios/libexec/check_disk -w$ARG1$ -c$ARG2$ -p$ARG3$
command[check_procs]=/usr/local/nagios/libexec/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
Hekp =/
Re: NRPE test ok but with args get Unknown argument -Help Pl
Posted: Thu Feb 13, 2014 11:26 am
by slansing
It is telling you that you have problems with your command's syntax. You are missing your warning and critical definitions. Try running this to start with:
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H 145.125.99.18 -c check_disk
Also, you should have spaces between your $ARGn$ values, and the flags you are passing in your nrpe.cfg, this:
Code: Select all
command[check_disk]=/usr/local/nagios/libexec/check_disk -w$ARG1$ -c$ARG2$ -p$ARG3$
Should be:
Code: Select all
command[check_disk]=/usr/local/nagios/libexec/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
I would however, recommend changing it to:
Code: Select all
command[check_disk]=/usr/local/nagios/libexec/check_disk $ARG1$
Then use the following command from the nagios server:
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H 145.125.99.18 -c check_disk -a '-w 85% -c 90% -p /'
Re: NRPE test ok but with args get Unknown argument -Help Pl
Posted: Thu Feb 13, 2014 12:26 pm
by danielbcjr
Thank you for aswering that ^^
That is what happens:
slansing wrote:It is telling you that you have problems with your command's syntax. You are missing your warning and critical definitions. Try running this to start with:
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H 145.125.99.18 -c check_disk
Also, you should have spaces between your $ARGn$ values, and the flags you are passing in your nrpe.cfg, this:
Code: Select all
command[check_disk]=/usr/local/nagios/libexec/check_disk -w$ARG1$ -c$ARG2$ -p$ARG3$
Should be:
Code: Select all
command[check_disk]=/usr/local/nagios/libexec/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
Fixed until now.
I would however, recommend changing it to:
Code: Select all
command[check_disk]=/usr/local/nagios/libexec/check_disk $ARG1$
Then use the following command from the nagios server:
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H 145.125.99.18 -c check_disk -a '-w 85% -c 90% -p /'
I made this, but I get this in the command line:
Code: Select all
[root@solitude ~]# /usr/local/nagios/libexec/check_nrpe -H 145.125.99.18
NRPE v2.15
[root@solitude ~]# /usr/local/nagios/libexec/check_nrpe -H 145.125.99.18 -c check_disk -a '-w 85% -c 90% -p /'
CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.
In the Nagios page I go this in service screen:
Current Status: UNKNOWN (for 0d 1h 47m 6s)
Status Information: check_disk: Could not parse arguments
Usage:
check_disk -w limit -c limit [-W limit] [-K limit] {-p path
Performance Data: -x device} [-C] [-E] [-e] [-f] [-g group ] [-k] [-l] [-M] [-m] [-R path ] [-r path ] [-t timeout] [-u unit] [-v] [-X type] [-N type]
Re: NRPE test ok but with args get Unknown argument -Help Pl
Posted: Thu Feb 13, 2014 12:39 pm
by danielbcjr
Just to know, NRPE was configured with --enable-command-args and --enable-bash-command-substitution.
In nrpe.cfg of client:
dont_blame_nrpe=1
allow_bash_command_substitution=1
Re: NRPE test ok but with args get Unknown argument -Help Pl
Posted: Thu Feb 13, 2014 1:07 pm
by lmiltchev
CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.
Did you check the logs? Any errors?
Can you post the "check_disk" definition from the remote box?
Re: NRPE test ok but with args get Unknown argument -Help Pl
Posted: Thu Feb 13, 2014 1:52 pm
by danielbcjr
lmiltchev wrote:CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.
Did you check the logs? Any errors?
Can you post the "check_disk" definition from the remote box?
No error =/
Code: Select all
Feb 13 18:47:46 winterhold xinetd[8058]: EXIT: nrpe status=0 pid=8270 duration=0(sec)
Feb 13 18:48:09 winterhold xinetd[8058]: START: nrpe pid=8273 from=::ffff:189.125.66.7
Feb 13 18:48:09 winterhold nrpe[8273]: INFO: SSL/TLS initialized. All network traffic will be encrypted.
Feb 13 18:48:09 winterhold xinetd[8058]: EXIT: nrpe status=0 pid=8273 duration=0(sec)
Feb 13 18:48:11 winterhold xinetd[8058]: START: nrpe pid=8276 from=::ffff:189.125.66.7
Feb 13 18:48:11 winterhold nrpe[8276]: INFO: SSL/TLS initialized. All network traffic will be encrypted.
Feb 13 18:48:11 winterhold xinetd[8058]: EXIT: nrpe status=0 pid=8276 duration=0(sec)
Feb 13 18:48:17 winterhold xinetd[8058]: START: nrpe pid=8279 from=::ffff:189.125.66.7
Feb 13 18:48:17 winterhold nrpe[8279]: INFO: SSL/TLS initialized. All network traffic will be encrypted.
Feb 13 18:48:17 winterhold xinetd[8058]: EXIT: nrpe status=0 pid=8279 duration=0(sec)
This way:
Code: Select all
command[check_users]=/usr/local/nagios/libexec/check_users -w $ARG1$ -c $ARG2$
command[check_load]=/usr/local/nagios/libexec/check_load -w $ARG1$ -c $ARG2$
command[check_disk]=/usr/local/nagios/libexec/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
command[check_procs]=/usr/local/nagios/libexec/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
I tried too the slansing way:
Code: Select all
command[check_disk]=/usr/local/nagios/libexec/check_disk $ARG1$
Re: NRPE test ok but with args get Unknown argument -Help Pl
Posted: Thu Feb 13, 2014 2:25 pm
by lmiltchev
Use the command, provided by slansing:
Code: Select all
command[check_disk]=/usr/local/nagios/libexec/check_disk $ARG1$
Restart nrpe.
Code: Select all
/etc/init.d/nagios-nrpe-server restart
Note: This may vary, depending on your system...
Test the check by running the following command on the nagios server:
Code: Select all
./check_nrpe -H <client ip> -c check_disk -a '-w 20% -c 10% -p /
If this fails, try:
Code: Select all
./check_nrpe -H <client ip> -n -c check_disk -a '-w 20% -c 10% -p /
Re: NRPE test ok but with args get Unknown argument -Help Pl
Posted: Fri Feb 14, 2014 9:02 am
by danielbcjr
Hi lmiltchev
Tahnk you for helping.
lmiltchev wrote:Use the command, provided by slansing:
Code: Select all
command[check_disk]=/usr/local/nagios/libexec/check_disk $ARG1$
DONE
Restart nrpe.
Code: Select all
/etc/init.d/nagios-nrpe-server restart
Mine is:
DONE
Note: This may vary, depending on your system...
Test the check by running the following command on the nagios server:
Code: Select all
./check_nrpe -H <client ip> -c check_disk -a '-w 20% -c 10% -p /
Reply:
Code: Select all
[root@solitude etc]# /usr/local/nagios/libexec/check_nrpe -H 189.125.66.9 -c check_disk -a '-w 20% -c 10% -p /'
CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.
If this fails, try:
Code: Select all
./check_nrpe -H <client ip> -n -c check_disk -a '-w 20% -c 10% -p /
Reply:
Code: Select all
[root@solitude etc]# /usr/local/nagios/libexec/check_nrpe -H 189.125.66.9 -c -n check_disk -a '-w 20% -c 10% -p /'
CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.
=/
Re: NRPE test ok but with args get Unknown argument -Help Pl
Posted: Fri Feb 14, 2014 10:42 am
by tmcdonald
lmiltchev wrote:
Test the check by running the following command on the nagios server:
Code: Select all
./check_nrpe -H <client ip> -c check_disk -a '-w 20% -c 10% -p /
If this fails, try:
Code: Select all
./check_nrpe -H <client ip> -n -c check_disk -a '-w 20% -c 10% -p /
I think lmiltchev might have missed an ending quote. Try this:
lmiltchev wrote:
Test the check by running the following command on the nagios server:
Code: Select all
./check_nrpe -H <client ip> -c check_disk -a '-w 20% -c 10% -p /'
If this fails, try:
Code: Select all
./check_nrpe -H <client ip> -n -c check_disk -a '-w 20% -c 10% -p /'
Re: NRPE test ok but with args get Unknown argument -Help Pl
Posted: Fri Feb 14, 2014 11:48 am
by danielbcjr
That are the results:
Code: Select all
[root@solitude libexec]# ./check_nrpe -H 189.125.66.9 -c check_disk -a '-w 20% -c 10% -p /'
CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.
[root@solitude libexec]# ./check_nrpe -H <client ip> -n -c check_disk -a '-w 20% -c 10% -p /'
-bash: client: No such file or directory