check_nt service state check not working

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.
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: check_nt service state check not working

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
kmartin2007
Posts: 66
Joined: Thu Nov 14, 2019 3:31 pm

Re: check_nt service state check not working

Post 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$
}
kmartin2007
Posts: 66
Joined: Thu Nov 14, 2019 3:31 pm

Re: check_nt service state check not working

Post by kmartin2007 »

I changed it, and still get the same thing.
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: check_nt service state check not working

Post by tgriep »

In the Nagios webinterface, is the service name still getting cut off at the dollar sign?
Be sure to check out our Knowledgebase for helpful articles and solutions!
vho
Posts: 11
Joined: Thu Nov 14, 2019 4:13 pm

Re: check_nt service state check not working

Post 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.
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: check_nt service state check not working

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
kmartin2007
Posts: 66
Joined: Thu Nov 14, 2019 3:31 pm

Re: check_nt service state check not working

Post 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
vho
Posts: 11
Joined: Thu Nov 14, 2019 4:13 pm

Re: check_nt service state check not working

Post 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
Last edited by vho on Fri Nov 22, 2019 5:18 pm, edited 1 time in total.
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: check_nt service state check not working

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
vho
Posts: 11
Joined: Thu Nov 14, 2019 4:13 pm

Re: check_nt service state check not working

Post by vho »

Here's the nsclient.ini file.
Attachments
nsclient.ini
(22.49 KiB) Downloaded 249 times
Locked