Problems with $ sign in service name

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.
tresoar
Posts: 6
Joined: Wed May 04, 2011 4:07 am
Location: The Netherlands
Contact:

Re: Problems with $ sign in service name

Post 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 ?
tonyyarusso
Posts: 1128
Joined: Wed Mar 03, 2010 12:38 pm
Location: St. Paul, MN, USA
Contact:

Re: Problems with $ sign in service name

Post by tonyyarusso »

Your error is in the service description, not the check command. Could you post what you have for that value?
Tony Yarusso
Technical Services
___
TIES
Web: http://ties.k12.mn.us/
tresoar
Posts: 6
Joined: Wed May 04, 2011 4:07 am
Location: The Netherlands
Contact:

Re: Problems with $ sign in service name

Post 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.
Attachments
srv.PNG
tonyyarusso
Posts: 1128
Joined: Wed Mar 03, 2010 12:38 pm
Location: St. Paul, MN, USA
Contact:

Re: Problems with $ sign in service name

Post 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?
Tony Yarusso
Technical Services
___
TIES
Web: http://ties.k12.mn.us/
tresoar
Posts: 6
Joined: Wed May 04, 2011 4:07 am
Location: The Netherlands
Contact:

Re: Problems with $ sign in service name

Post 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.
Attachments
sql.PNG
tonyyarusso
Posts: 1128
Joined: Wed Mar 03, 2010 12:38 pm
Location: St. Paul, MN, USA
Contact:

Re: Problems with $ sign in service name

Post 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.
Tony Yarusso
Technical Services
___
TIES
Web: http://ties.k12.mn.us/
tresoar
Posts: 6
Joined: Wed May 04, 2011 4:07 am
Location: The Netherlands
Contact:

Re: Problems with $ sign in service name

Post 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.
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Problems with $ sign in service name

Post 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.
Inaba
Posts: 1
Joined: Wed Jul 06, 2011 3:21 pm

Re: Problems with $ sign in service name

Post 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.
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Problems with $ sign in service name

Post by mguthrie »

Locked