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
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: check_nt service state check not working

Post by lmiltchev »

Now that we removed the single quotes around the argument, try using:

Code: Select all

check_command check_nt!SERVICESTATE!-d SHOWALL -l eSPNaniConnector\$$MN
Let us know if this worked.
Be sure to check out our Knowledgebase for helpful articles and 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 »

In addition to what @lmiltchev asked.

I see that you are running other Service checks on that same server that have $ in the name, are they also failing?

Can you login to the Windows host in question, run the following command as an administrator and post the output here so we can see the service name?

Code: Select all

sc query type= service state= all | findstr eSPNaniConnector
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:In addition to what @lmiltchev asked.

I see that you are running other Service checks on that same server that have $ in the name, are they also failing?

Can you login to the Windows host in question, run the following command as an administrator and post the output here so we can see the service name?

Code: Select all

sc query type= service state= all | findstr eSPNaniConnector

So the memory usage and what not work fine using the check_nt command, which i think is weird.

I have uploaded screenshots
Attachments
iis02 nagios host page.png
services nani MN.png
sc command.png
sc command.png (10.18 KiB) Viewed 2412 times
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 »

Did you update the check_nt command and removed the single quotes from around the Arguments and then restart Nagios?

Verify that you did do that and to be complete, restart the nagios process.

Also, post the command definition and the service definition here so we can view them.

The sc command not finding the service is puzzling, can you run this on the windows server and upload the c:\service.txt file so we can view all of the service names on that system?

Code: Select all

sc query type= service state= all >c:\service.txt
Thanks.
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:Did you update the check_nt command and removed the single quotes from around the Arguments and then restart Nagios?

Verify that you did do that and to be complete, restart the nagios process.

Also, post the command definition and the service definition here so we can view them.

The sc command not finding the service is puzzling, can you run this on the windows server and upload the c:\service.txt file so we can view all of the service names on that system?

Code: Select all

sc query type= service state= all >c:\service.txt
Thanks.

Yes i did change it.

The commands.cfg there is a command in there at the bottom that is commented out, because if i uncomment it, it breaks nagios saying there is a duplicate command. I have a previous topic open regarding this as well.
Attachments
commands.cfg
(6.98 KiB) Downloaded 148 times
services_nagios2.cfg
(36.29 KiB) Downloaded 155 times
nt.cfg
nt config file
(509 Bytes) Downloaded 151 times
kmartin2007
Posts: 66
Joined: Thu Nov 14, 2019 3:31 pm

Re: check_nt service state check not working

Post by kmartin2007 »

Here is the execution of the command you sent
Attachments
service.txt
(115.8 KiB) Downloaded 142 times
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 »

Are you running version 3.5.1 of Nagios Core?

I would guess that the nt.cfg file and the commands.cfg files are included in the nagios configurations and if you have a check_nt command in one of the files, you cannot have another one defined.

So, leaving the check_nt command in the commands.cfg file is needed.

The service name is in the txt file so that looks OK.

Can you post the nagios.cfg file here so we can view it's settings?
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:Are you running version 3.5.1 of Nagios Core?

I would guess that the nt.cfg file and the commands.cfg files are included in the nagios configurations and if you have a check_nt command in one of the files, you cannot have another one defined.

So, leaving the check_nt command in the commands.cfg file is needed.

The service name is in the txt file so that looks OK.

Can you post the nagios.cfg file here so we can view it's settings?

correct. I took the old commands.cfg file and copied them into the new one. and nagios3 -v nagios.cfg and found the errors and commented out as needed. The check_nt command is commented out in the commands.cfg file because it's a duplicate when i check the config.

Nagios Core 3.5.1
Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-30-2013
License: GPL
Attachments
nagios.cfg
(44.61 KiB) Downloaded 160 times
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 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.
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 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.

I have already done that before and it did not work, however executing it from the terminal like so(below) and it brings back data.

./check_nt -v SERVICESTATE-d SHOWALL -l eSPNaniConnector\$MNeSPConnector -p 12489

but if running it with the $$ and no port it tells me cant be found, and or unable to communicate on port 1248
Locked