Page 3 of 5

Re: check_nt service state check not working

Posted: Wed Nov 20, 2019 5:18 pm
by tgriep
The second dollar sign in the name is causing the rest of the command to get truncated so it is not adding the -p 12489 on the command to that is why it is generating the "unable to communicate on port 1248" error.

Running things from the command line is different from running them with nagios.

I do not have access to services with the same name but I do have a MSSQL service with a dollar sign in the name.

Here is now the check_nt command is defined

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$
        }

Here is how the service is setup.

Code: Select all

check_command           check_nt!SERVICESTATE!-d SHOWALL -l "MSSQL$"$"SQLEXPRESS"
And it works just fine.
MSSQL.PNG
The only other thing I can think of is if you are running an older version of NSClient++, that could cause the issue if there is a bug.

Re: check_nt service state check not working

Posted: Wed Nov 20, 2019 5:52 pm
by kmartin2007
tgriep wrote:The second dollar sign in the name is causing the rest of the command to get truncated so it is not adding the -p 12489 on the command to that is why it is generating the "unable to communicate on port 1248" error.

Running things from the command line is different from running them with nagios.

I do not have access to services with the same name but I do have a MSSQL service with a dollar sign in the name.

Here is now the check_nt command is defined

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$
        }

Here is how the service is setup.

Code: Select all

check_command           check_nt!SERVICESTATE!-d SHOWALL -l "MSSQL$"$"SQLEXPRESS"
And it works just fine.
MSSQL.PNG
The only other thing I can think of is if you are running an older version of NSClient++, that could cause the issue if there is a bug.

this is what you said in a previous post.

The nagios.cfg file looks stock so that is good.
I would edit all of the commands and remove the extra $ as it looks like it is getting truncated.

Change all of then to just \$ where needed and replace the $"$" for that one service.


You want me to change this

define service{
use production-service
host_name DALSRVPRDIIS02, DALSRVPRDIIS07
service_description MN_Connector_NANI2.0
display_name MN_Connector_NANI2.0
check_command check_nt!SERVICESTATE!-d SHOWALL -l "eSPNaniConnector$"$"MN"
}

to this

define service{
use production-service
host_name DALSRVPRDIIS02, DALSRVPRDIIS07
service_description MN_Connector_NANI2.0
display_name MN_Connector_NANI2.0
check_command check_nt!SERVICESTATE!-d SHOWALL -l eSPNaniConnector\$MN
}


Correct?

this is my nt.cfg file

This is my nt.cfg for check_nt.

# 'check_nt' command definition
define command {
command_name check_nt
command_line /usr/lib/nagios/plugins/check_nt -p 12489 -H '$HOSTADDRESS$' -v $ARG1$ $ARG2$
}

Re: check_nt service state check not working

Posted: Wed Nov 20, 2019 5:58 pm
by kmartin2007
I changed it, and still get the same thing.

Re: check_nt service state check not working

Posted: Thu Nov 21, 2019 9:38 am
by tgriep
In the Nagios webinterface, is the service name still getting cut off at the dollar sign?

Re: check_nt service state check not working

Posted: Thu Nov 21, 2019 6:10 pm
by vho
On the server, the service is names eSPNaniConnector$DC

On the Nagios Web-Interface, this is the error message.
DC_Connector_NANI2.0

Failed to open service eSPNaniConnector: 1060: The specified service does not exist as an installed service.
This is in the config file.

Code: Select all

define service{
	use				production-service
	host_name			DALSRVPRDIIS04
	service_description		DC_Connector_NANI2.0
	display_name	        	DC_Connector_NANI2.0
	check_command			check_nt!SERVICESTATE!-d SHOWALL -l eSPNaniConnector\$$DC
	}
So it looks like it's still getting cut-off on the web-interface.

Re: check_nt service state check not working

Posted: Fri Nov 22, 2019 9:34 am
by tgriep
Edit the ini file on the Windows system for NSClient++ and enable debugging for the logs.
Run the check from Nagios and hopefully is will show you the command that was sent to NSClient++ in the nsclient.log file and let us know if the $ was not sent.

Another thing to do is to run through different command definitions for the services to see if we can get one of the combinations to work.

Try modifying the command for the service until it stops cutting off at the $.
Test each one of these examples.

Code: Select all

check_command         check_nt!SERVICESTATE!-d SHOWALL -l eSPNaniConnector\$DC
check_command         check_nt!SERVICESTATE!-d SHOWALL -l 'eSPNaniConnector$DC'
check_command         check_nt!SERVICESTATE!-d SHOWALL -l "eSPNaniConnector\$DC"
Another option it to upgrade the plugin to the latest version.
My system that is functioning, the plugin version is 2.2.1 so try that.
https://support.nagios.com/kb/article/n ... e-569.html

And, upgrade NSClient++ on the Windows system if you are running an older version.

Re: check_nt service state check not working

Posted: Fri Nov 22, 2019 2:54 pm
by kmartin2007
tgriep wrote:Edit the ini file on the Windows system for NSClient++ and enable debugging for the logs.
Run the check from Nagios and hopefully is will show you the command that was sent to NSClient++ in the nsclient.log file and let us know if the $ was not sent.

Another thing to do is to run through different command definitions for the services to see if we can get one of the combinations to work.

Try modifying the command for the service until it stops cutting off at the $.
Test each one of these examples.

Code: Select all

check_command         check_nt!SERVICESTATE!-d SHOWALL -l eSPNaniConnector\$DC
check_command         check_nt!SERVICESTATE!-d SHOWALL -l 'eSPNaniConnector$DC'
check_command         check_nt!SERVICESTATE!-d SHOWALL -l "eSPNaniConnector\$DC"
Another option it to upgrade the plugin to the latest version.
My system that is functioning, the plugin version is 2.2.1 so try that.
https://support.nagios.com/kb/article/n ... e-569.html

And, upgrade NSClient++ on the Windows system if you are running an older version.

This is the forum topic where i re-installed the plugins from source

https://support.nagios.com/forum/viewto ... 9&start=20

Vu will work on changing the checks to see

Re: check_nt service state check not working

Posted: Fri Nov 22, 2019 3:38 pm
by vho
Reviewing the nsclient.log file, this is the only thing related to check_nt

2019-11-22 15:15:21: debug:c:\source\nscp\include\check_nt/server/protocol.hpp:61: Accepting connection from: 10.10.11.31

I also modified the command files for the service and no change.

The plugin is updated.

I upgraded the NSClient++ to the latest version and the error message change to

Unknown command(s): check_service

Re: check_nt service state check not working

Posted: Fri Nov 22, 2019 4:15 pm
by tgriep
Can you post the nsclient.ini file from the Windows server?
I am running the latest stable 0.5.2.xx version so try upgrading the Windows server.

Re: check_nt service state check not working

Posted: Fri Nov 22, 2019 5:20 pm
by vho
Here's the nsclient.ini file.