Command Definition with Spaces?

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
peakyblinder
Posts: 63
Joined: Tue Mar 25, 2014 4:39 am

Command Definition with Spaces?

Post 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,
prandal
Posts: 8
Joined: Mon Nov 19, 2012 5:23 am

Re: Command Definition with Spaces?

Post by prandal »

Have you tried

./check_nrpe -H IP -p 5666 -c check_mostrecentfile -a "c:/test log/" 50 60 1
peakyblinder
Posts: 63
Joined: Tue Mar 25, 2014 4:39 am

Re: Command Definition with Spaces?

Post 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.
Locked