check_nt service state check not working

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

Re: check_nt service state check not working

Postby tgriep » Wed Nov 20, 2019 5:18 pm

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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
tgriep
Madmin
 
Posts: 8411
Joined: Thu Oct 30, 2014 9:02 am

Re: check_nt service state check not working

Postby kmartin2007 » Wed Nov 20, 2019 5:52 pm

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: 62
Joined: Thu Nov 14, 2019 3:31 pm

Re: check_nt service state check not working

Postby kmartin2007 » Wed Nov 20, 2019 5:58 pm

I changed it, and still get the same thing.
kmartin2007
 
Posts: 62
Joined: Thu Nov 14, 2019 3:31 pm

Re: check_nt service state check not working

Postby tgriep » Thu Nov 21, 2019 9:38 am

In the Nagios webinterface, is the service name still getting cut off at the dollar sign?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
tgriep
Madmin
 
Posts: 8411
Joined: Thu Oct 30, 2014 9:02 am

Re: check_nt service state check not working

Postby vho » Thu Nov 21, 2019 6:10 pm

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

Re: check_nt service state check not working

Postby tgriep » Fri Nov 22, 2019 9:34 am

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/nagios-plugins-installing-nagios-plugins-from-source-569.html

And, upgrade NSClient++ on the Windows system if you are running an older version.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
tgriep
Madmin
 
Posts: 8411
Joined: Thu Oct 30, 2014 9:02 am

Re: check_nt service state check not working

Postby kmartin2007 » Fri Nov 22, 2019 2:54 pm

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/nagios-plugins-installing-nagios-plugins-from-source-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

viewtopic.php?f=7&t=56479&start=20

Vu will work on changing the checks to see
kmartin2007
 
Posts: 62
Joined: Thu Nov 14, 2019 3:31 pm

Re: check_nt service state check not working

Postby vho » Fri Nov 22, 2019 3:38 pm

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

Re: check_nt service state check not working

Postby tgriep » Fri Nov 22, 2019 4:15 pm

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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
tgriep
Madmin
 
Posts: 8411
Joined: Thu Oct 30, 2014 9:02 am

Re: check_nt service state check not working

Postby vho » Fri Nov 22, 2019 5:20 pm

Here's the nsclient.ini file.
Attachments
nsclient.ini
(22.49 KiB) Downloaded 4 times
vho
 
Posts: 11
Joined: Thu Nov 14, 2019 4:13 pm

PreviousNext

Return to Nagios Core

Who is online

Users browsing this forum: Alan, TDBruno and 19 guests