Page 1 of 1

Command Definition with Spaces?

Posted: Mon Apr 07, 2014 5:16 am
by peakyblinder
Hi,

Tried searching but couldn't find anything.

I'm using the 'check_mostrecentfile.vbs' plugin and it works a treat! However when specifying a path to the directory with spaces in, it complains about not passing in the required 4 arguments (directory, warning, critical, size)

This fails:
[root@svlvpoc001 plugins]# ./check_nrpe -H IP -p 5666 -c check_mostrecentfile -a c:/test log/ 50 60 1
enter a valid Warning age (minutes): i.e. 1440

This works:
[root@svlvpoc001 plugins]# ./check_nrpe -H IP -p 5666 -c check_mostrecentfile -a c:/temp/ 50 60 1
CRITICAL: test.txt is 2355 minutes old.

I know the unix shell has some oddities with / and the like but have tried so many different iterations without any success.

Anyone got any ideas?

Thanks,

Re: Command Definition with Spaces?

Posted: Mon Apr 07, 2014 9:20 am
by prandal
Have you tried

./check_nrpe -H IP -p 5666 -c check_mostrecentfile -a "c:/test log/" 50 60 1

Re: Command Definition with Spaces?

Posted: Mon Apr 07, 2014 9:25 am
by peakyblinder
prandal wrote:Have you tried

./check_nrpe -H IP -p 5666 -c check_mostrecentfile -a "c:/test log/" 50 60 1
Finally figured this out in the meantime but thanks for your input.

I put "" around the first "$ARG1$" like this;
define command{
command_name check_mostrecentfile
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666 -c check_mostrecentfile -a "$ARG1$" $ARG2$ $ARG3$ $ARG4$
}

The Service looks like this;
define service{
use generic-service
host_name BCC009413
service_description Check File Age
check_command check_mostrecentfile!C:/Benefits/DWPDataXfer/TEST Log/!26!30!1
check_interval 2
retry_interval 2
max_check_attempts 3
}

Post can be closed.