Page 2 of 2

Re: Problems with $ sign in service name

Posted: Wed May 18, 2011 4:22 am
by tresoar
I have the same problem with a MSSQL service on a server.
I cannot confirm this sollution.

I added service monitoring by using the wizard:
Changed the line to the double $$
check_xi_service_nsclient
$USER1$/check_nt -H $HOSTADDRESS$ -s "$ARG1$" -p 12489 -v $ARG2$ $ARG3$ $ARG4$
$ARG1$
$ARG2$ SERVICESTATE
$ARG3$ -l MSSQL$$SQLEXP_VIM -d SHOWALL

Command submitted for processing...
Waiting for configuration verification.......
Configuration verification failed. :cry:
Success! Nagios Core was restarted with an updated configuration.
View configuration snapshots

An error occurred while attempting to apply your configuration to Nagios Core. Monitoring engine configuration files have been rolled back to their last known good checkpoint.


In the log file:
.....
Warning: Service 'SQL Server (SQLEXP_VIM)' on host 'SERVER.FQDN.dns' has no check time period defined!
Error: The description string for service 'SQL Server (SQLEXP_VIM)' on host 'SERVER.FQDN.dns' contains one or more illegal characters.

Total Errors: 1

***> One or more problems was encountered while running the pre-flight check...

Check your configuration file(s) to ensure that they contain valid
directives and data defintions. If you are upgrading from a previous
version of Nagios, you should be aware that some variables/definitions
may have been removed or modified in this version. Make sure to read
the HTML documentation regarding the config files, as well as the
'Whats New' section to find out what has changed.

Nagios is capable to check the service if the correct commands are executed:
ssh login to console of server as root,
cd /usr/local/nagios/libexec
[root@nagiosxi libexec]# ./check_nrpe -H 10.10.10.30 -p 5666 -c CheckServiceState -a MSSQL\$SQLEXP_VIM
OK: All services are in their appropriate state.
[root@nagiosxi libexec]# ./check_nt -H 10.10.10.30 -p 12489 -v SERVICESTATE -l MSSQL\$SQLEXP_VIM -d ShowALL
OK: All services are in their appropriate state.

If I replace the $$ with \$ in the web interface of Nagios core config, I receive also an error.

As an user, I entered the correct service name in the wizard. If there is any escaping code(s) needed, the web interface should translate this to correct commands. What to change to make this work ?

Re: Problems with $ sign in service name

Posted: Wed May 18, 2011 2:39 pm
by tonyyarusso
Your error is in the service description, not the check command. Could you post what you have for that value?

Re: Problems with $ sign in service name

Posted: Thu May 19, 2011 1:52 am
by tresoar
I added service monitoring by using the wizard.
Go to Nagios core config, services, choose the server,edit service monitor:

check_xi_service_nsclient
$USER1$/check_nt -H $HOSTADDRESS$ -s "$ARG1$" -p 12489 -v $ARG2$ $ARG3$ $ARG4$
$ARG1$
$ARG2$ SERVICESTATE
$ARG3$ -l MSSQL$$SQLEXP_VIM -d SHOWALL
If I change it to double $$, Nagios won't accept this. So I can't find the service description in /usr/local/nagios/etc/services.

If you want to reproduce this, you could use instrv from the windows 2003 Resource kit. Just install some service with a "$" sign in the name.
e.g. instsrv "Micro$oft" c:\somewhere\srvany.exe
See http://support.microsoft.com/kb/137890 for futher configuration.

Re: Problems with $ sign in service name

Posted: Thu May 19, 2011 9:14 am
by tonyyarusso
You are still cropping out the service description from your screenshot and information. Could you please include all of the fields so I can see that?

Re: Problems with $ sign in service name

Posted: Thu May 19, 2011 9:44 am
by tresoar
Sorry I did not understood you request. I have now included the full screen.
I know I have disabled this service. In the picture I jus have one $. According the previous messages, I should have changed it to $$.
If I enable the service and change $ into $$, nagios won't accept the config.

The real windows service has just one $ in the name.

I hope it will help you to find the cause of this problem.

Re: Problems with $ sign in service name

Posted: Thu May 19, 2011 9:56 am
by tonyyarusso
Okay, I believe this has nothing to do with $ and everything to do with ( and ). If you rename your service to SQL Server SQLEXP_VIM it should be fine. You may also be able to get around it with quotes, by making the service descriptions field "SQL Server (SQLEXP_VIM)".

This is the key phrase from your previous posts:
Error: The description string for service 'SQL Server (SQLEXP_VIM)' on host 'SERVER.FQDN.dns' contains one or more illegal characters.

Re: Problems with $ sign in service name

Posted: Wed May 25, 2011 3:35 am
by tresoar
I removed the () around the description. Now Nagios accepts the service definition.

The service monitoring doesn't work yet.
It reports back:
SQL Server SQLEXP_VIM Critical 23m 0s 5/5 2011-05-25 09:31:26 MSSQL: Not found
By configure,re configure this host,monitoring. I see the following line:
check_xi_service_nsclient!!SERVICESTATE!-l MSSQL$$SQLEXP_VIM -d SHOWALL!!!!!

If I change this line to:
check_xi_service_nsclient!!SERVICESTATE!-l MSSQL\$SQLEXP_VIM -d SHOWALL!!!!!
It gives me the same error: MSSQL: Not found

If I change this line to:
check_xi_service_nsclient!!SERVICESTATE!-l MSSQL$$$$SQLEXP_VIM -d SHOWALL!!!!!
It gives me the error: MSSQL1296SQLEXP_VIM: Not found

If I change this line to:
check_xi_service_nsclient!!SERVICESTATE!-l MSSQL$$$SQLEXP_VIM -d SHOWALL!!!!!
It gives me the error: MSSQL3524SQLEXP_VIM: Not found

check_xi_service_nsclient!!SERVICESTATE!-l "MSSQL$$SQLEXP_VIM" -d SHOWALL!!!!!
It gives me the same error: MSSQL: Not found

I can't tink of more permutations.

Re: Problems with $ sign in service name

Posted: Wed May 25, 2011 9:19 am
by mguthrie
I think this issue here wasn't with Nagios, but with NagiosQL. The "()" characters are not allowed for names, descriptions, etc in NagiosQL. Nagios itself does have a list of disallowed characters, but those are specified in the main nagios.cfg file.

Re: Problems with $ sign in service name

Posted: Wed Jan 11, 2012 4:01 pm
by Inaba
This apparently does not work when the $ is followed by a macro.

For example, i want to search for this: 'SQLAGENT$<HOSTNAME>' so my command line looks like 'SQLAGENT$$$HOSTNAME$' ... well, it's not interpreting the $$$ properly. Since the first $ is intended to escape the 2nd, and the 3rd is the start of the macro, it apparently confuses Nagios and makes it impossible to create a check with a variable following a $. As all services in Windows are separated by the $ on a cluster, it makes checking instances of a cluster with a generic command line impossible.

Re: Problems with $ sign in service name

Posted: Fri Jan 13, 2012 10:38 am
by mguthrie