check_nt can not find service with $ in name - MSSQL$MSFW

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
itheodoridis
Posts: 9
Joined: Fri Aug 28, 2015 8:41 am

check_nt can not find service with $ in name - MSSQL$MSFW

Post by itheodoridis »

Hello all.
I am using Nagios for a few years now and my production machine runs on ubuntu 14.04.3 LTS Server with Nagios 3.5 and Nagios Plugins 2.0.3.
I am working towards moving my production to 4.1.1 with plugins 2.1.1 but I have run into a problem.
I can not correctly check if an MSSQL service for ISA Server 2006 is started with my test installation on Nagios 4.1.1 and plugins 2.1.1

The command used is check_nt in order to check if a service is started. For example in the config you would find:
define service{
use generic-service;
hostgroup_name ProxyServers;
service_description MSSQL Service;
check_command check_nt!SERVICESTATE!-d SHOWALL -l 'MSSQL\$MSFW'
contact_groups proxyservers_admins,admins
notification_period 24x7no45amrestart
}

while the check_nt command is defined as follows:
# 'check_nt' command definition
define command{
command_name check_nt
command_line $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$
}

(I will not put in the part where the group and hosts for ProxyServers is configured for obvious reasons).

So what happens is that my 3.5/2.0.3 system checks for the MSSQL$MSFW service and responds it is started.
However the 4.1.1/2.1.1 system reports:
Failed to open service MSSQL$MSFW$: 123: The filename, directory name, or volume label syntax is incorrect.

I have also tried with various ways like this:
check_command check_nt!SERVICESTATE!-d SHOWALL -l "MSSQL\\$MSFW"
On the 3.5 system, this workds fine. On the 4.1.1 I get:
Failed to open service MSSQL: 123: The filename, directory name, or volume label syntax is incorrect.
I tried working out the problem as I had done in the past so I tried through the command line this is how it went (I replaced the actual hostname and delete the part where the hostname and path shows in the command line, all checks executed in the libexec dir and on the 4.1.1 machine):
./check_nt -H hostname -p 12489 -v SERVICESTATE -d SHOWALL -l "MSSQL\$MSFW"
MSSQL$MSFW: Started
./check_nt -H hostname -p 12489 -v SERVICESTATE -d SHOWALL -l 'MSSQL$MSFW'
MSSQL$MSFW: Started
./check_nt -H hostname -p 12489 -v SERVICESTATE -d SHOWALL -l MSSQL$MSFW
Failed to open service MSSQL: 1060: The specified service does not exist as an installed service.

./check_nt -H hostname -p 12489 -v SERVICESTATE -d SHOWALL -l MSSQL\$MSFW
MSSQL$MSFW: Started

./check_nt -H hostname -p 12489 -v SERVICESTATE -d SHOWALL -l "MSSQL\\$$MSFW"
Failed to open service MSSQL\1101MSFW: 123: The filename, directory name, or volume label syntax is incorrect.

I know I must be missing something but I have no idea what that is.
If anyone has a clue, I would be grateful.
Thank you and all the best to your admin efforts.
Ioannis Theodoridis
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: check_nt can not find service with $ in name - MSSQL$MSF

Post by hsmith »

Can you try putting $ARG2$ in single quotes in the command definition?

Code: Select all

# 'check_nt' command definition
define command{
command_name check_nt
command_line $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$ '$ARG2$'
}
Former Nagios Employee.
me.
itheodoridis
Posts: 9
Joined: Fri Aug 28, 2015 8:41 am

Re: check_nt can not find service with $ in name - MSSQL$MSF

Post by itheodoridis »

sure. How about the other cfg part though? (the service check field)
i tried with 'MSSQL$MSFW' (single quotes and actual service name). I will let you know how it goes.
Thank you for the reply.
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: check_nt can not find service with $ in name - MSSQL$MSF

Post by hsmith »

itheodoridis wrote:sure. How about the other cfg part though? (the service check field)
i tried with 'MSSQL$MSFW' (single quotes and actual service name). I will let you know how it goes.
Thank you for the reply.
I would just leave service the same for now, if that doesn't work, try to single quote it as well. Let me know what you come up with. I don't have any MSSQL test servers spun up here to test against at the moment, otherwise I'd try to replicate this one for you.
Former Nagios Employee.
me.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: check_nt can not find service with $ in name - MSSQL$MSF

Post by Box293 »

I believe you need a backslash and two dollar signs:

Code: Select all

MSSQL\$$MSFW
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
itheodoridis
Posts: 9
Joined: Fri Aug 28, 2015 8:41 am

Re: check_nt can not find service with $ in name - MSSQL$MSF

Post by itheodoridis »

I am afraid that changing the check_nt command broke every other service check I am doing for other systems.. I will try to work it out but let see if I got this clear :
I will keep the single quotes in the definition for check_nt and leave them out in the service check?
or do I remove them from both definitions and use the backslash and double dollar sign?
I would love to come to the conference but I am having trouble already for convincing the management to let some engineers go to cisco live conferences (we are mainly network engineers) so getting a chance for nagios conference is probably out of the question..
I never give up hope though, I always keep trying.
Thanks again,
Ioannis Theodoridis
itheodoridis
Posts: 9
Joined: Fri Aug 28, 2015 8:41 am

Re: check_nt can not find service with $ in name - MSSQL$MSF

Post by itheodoridis »

Well I am happy to report that your suggestion seems to have fixed things!
So here is what I did:
- for the command definition of check_nt I changed things back to default like it was before (no quotes):
command_line $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$
- for the service check definition I used only the backslash and double dollar, no quotes like you said:
check_command check_nt!SERVICESTATE!-d SHOWALL -l MSSQL\$$MSFW
It worked like a charm!! I can finally upgrade my production system to 4.1.1 now! I am very gratefull for your help and support.
I also hope more people may find this helpful.
Thanks again,
Ioannis Theodoridis.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: check_nt can not find service with $ in name - MSSQL$MSF

Post by tmcdonald »

I'll be closing this thread now, but feel free to open another if you need anything in the future!
Former Nagios employee
Locked