Page 1 of 1

3.4.0 Quotes in command_line are behaving incorrectly

Posted: Thu May 10, 2012 11:08 am
by mschroeder
In checkcommands.cfg we have a command_line with double quotes like below:

define command {
command_name check_selmon
command_line $USER1$/schedule_service --directive "check_selmon_for_mh_$HOSTNAME$"
}

I have printed out the arguments that the script receives, and in 3.1.2 they were correct,
but in 3.4.0 the quotes cause both a blank (empty) argument and a third argument
has the ending quote not removed:

ARGV:(--directive,,check_selmon_for_mh_nh")

The above shows that 3 arguments passed are (--directive, an empty string, check_selmon_for_mh_nh" (note double quote still at the end)).
Before, the args were just --directive and check_selmon_for_mh_nh as intended.

Tried the same with single (vs. double) quotes, and the result is similar (and wrong).

Turning on all nagios core debug (-1) produces this output for macro expansion, which appears correct:

[1336660023.909969] [2048.1] [pid=22475] **** BEGIN MACRO PROCESSING ***********
[1336660023.909973] [2048.1] [pid=22475] Processing: '$USER1$/schedule_service --directive "check_selmon_for_mh_$HOSTNAME$"'
[1336660023.909988] [2048.1] [pid=22475] Done. Final output: '/opt/hptc/nagios/libexec/schedule_service --directive "check_selmon_for_mh_nh"'
[1336660023.909992] [2048.1] [pid=22475] **** END MACRO PROCESSING *************

The final output of macro processing looks ok. I don't know when this issue was introduced.
It appears to be after macro processing, and is definitely bad by the time the args reach the script.
Worked in 3.1.2. Fails in 3.4.0.
I notice this in the Changelog for 3.4.0, which might be related:
* Use execv() to execute active check commands (#86 - Ton Voon, dnsmichi)

Re: 3.4.0 Quotes in command_line are behaving incorrectly

Posted: Thu May 10, 2012 11:19 am
by mguthrie
Yeah, this bug was confirmed yesterday on the nagios-users mailing list. There should be a 3.4.1 release coming out shortly to correct the issue:
http://nagios.org/news/77-news-announce ... se-shortly