Page 1 of 2

Problems with $ sign in service name

Posted: Fri Apr 15, 2011 4:22 am
by Aviva
I have several services configured in nagios, which looks like below

define service{
use generic-service;
host_name srv
service_description service
check_period 24x7
contact_groups one,two,three
notification_period 24x7
notification_options c,r
notification_interval 30
normal_check_interval 5
check_command check_snmp_service!^Service name.Servicedetails.$
}

at the end of "check_command" there is a dollar sign. Nagios works fine, but when this particular service is down, in nagios.log file there is

[1302818400] CURRENT SERVICE STATE: srv;Service name OK;HARD;1;1 services active (matching "^Service name.Servicedetails.$") : OK
$

first line is OK, but always after this check in nagios.log file there is a new line with dollar sign only in further line.
Of course in nagios (using web interface) there is a mess (nagios recognize this as 1st january 1970 and misinterprete it)

Could you please correct this bug? I need this dolar sign in command sometimes...
I'm using 3.2.3 version of nagios

regards,

Mariusz Preiss

Re: Problems with $ sign in service name

Posted: Fri Apr 15, 2011 10:03 am
by mguthrie
Is there any change when you put the argument string inside of single quotes?

Re: Problems with $ sign in service name

Posted: Mon Apr 18, 2011 3:45 am
by Aviva
Yes, single quotes makes monitoring of this service useless at all - all the time it is critical :-)

In my opinion, as long as nagios allows dollar sign in this field and becouse of this nagios wrongly writes to log files - that should be fixed

Re: Problems with $ sign in service name

Posted: Wed May 04, 2011 3:02 am
by Aviva
Could anyone answer my questions and correct this issue?

Re: Problems with $ sign in service name

Posted: Wed May 04, 2011 10:21 am
by mguthrie
I might suggest posting this as a bug on tracker.nagios.org. The fix for that is probably buried somewhere in the C code, and the Core development team will probably have to tackle that one.

Re: Problems with $ sign in service name

Posted: Thu May 05, 2011 9:26 am
by Aviva
I thought that this is support forum, and when I post something here - it should be resolved/corrected/whatever and this is what I'm paying for - isn't it?...
I don't have access to tracker.nagios.org...

regards

Mariusz Preiss

Re: Problems with $ sign in service name

Posted: Fri May 06, 2011 8:32 am
by mguthrie
I'll get a bug report posted to the tracker, and I'll post the link here. Yes, this is most certainly the place to come for support issues, and we appreciate the heads up on the bug. Community members are able to create accounts and post bugs to the tracker as well, however, I'll be glad to post this for you.

The $ sign in Nagios signifies a macro being called, so my guess is that it's reading everything inside of the '$' signs as a macro and maybe escaping the rest of the line.

http://tracker.nagios.org/view.php?id=217

Re: Problems with $ sign in service name

Posted: Fri May 06, 2011 8:42 am
by Aviva
thank you

Re: Problems with $ sign in service name

Posted: Mon May 09, 2011 9:31 am
by mguthrie
You bet. Sorry we're not able to do more from here, the Core development team will work on it from here.

Re: Problems with $ sign in service name

Posted: Tue May 10, 2011 1:26 pm
by mguthrie
The Core Development Team responded with the following solution for this issue. It appears there is a way to escape the $ sign.
http://nagios.sourceforge.net/docs/3_0/ ... ml#command

"command_line:

This directive is used to define what is actually executed by Nagios when the command is used for service or host checks, notifications, or event handlers. Before the command line is executed, all valid macros are replaced with their respective values. See the documentation on macros for determining when you can use different macros. Note that the command line is not surrounded in quotes. Also, if you want to pass a dollar sign ($) on the command line, you have to escape it with another dollar sign. "