check_nt service state check not working
-
- Posts: 66
- Joined: Thu Nov 14, 2019 3:31 pm
check_nt service state check not working
So we also have this check defined for services running on alot of the IIS servers.
define service{
use production-service
host_name DALSRVPRDIIS02, DALSRVPRDIIS07
service_description IA_Connector_NANI2.0
display_name IA_Connector_NANI2.0
check_command check_nt!SERVICESTATE!-d SHOWALL -l eSPNaniConnector\$$MN
}
it is getting the following error on nagios page
MN_Connector_NANI2.0
Perform Extra Service Actions
UNKNOWN 2019-11-19 14:35:28 3d 17h 7m 12s 2/2 Failed to open service eSPNaniConnector: 1060: The specified service does not exist as an installed service.
HOWEVER this check reverted to 1248 rather than using 12489
executing without port
root@dalsrvitmon03:/usr/local/nagios/libexec# ./check_nt -H DALSRVPRDIIS02 -v SERVICESTATE -d SHOWALL -l eSPNaniConnector\$MN
connect to address DALSRVPRDIIS02 and port 1248: Connection refused
could not fetch information from server
with port defined and not a double $
root@dalsrvitmon03:/usr/local/nagios/libexec# ./check_nt -H DALSRVPRDIIS02 -v SERVICESTATE -d SHOWALL -l eSPNaniConnector\$MN -p12489
eSPNaniConnector$MN: Started
with the double $
root@dalsrvitmon03:/usr/local/nagios/libexec# ./check_nt -H DALSRVPRDIIS02 -v SERVICESTATE -d SHOWALL -l eSPNaniConnector\$$mn -p12489
Failed to open service eSPNaniConnector$: 1060: The specified service does not exist as an installed service.
attached is my check_nt config file nt.cfg
define service{
use production-service
host_name DALSRVPRDIIS02, DALSRVPRDIIS07
service_description IA_Connector_NANI2.0
display_name IA_Connector_NANI2.0
check_command check_nt!SERVICESTATE!-d SHOWALL -l eSPNaniConnector\$$MN
}
it is getting the following error on nagios page
MN_Connector_NANI2.0
Perform Extra Service Actions
UNKNOWN 2019-11-19 14:35:28 3d 17h 7m 12s 2/2 Failed to open service eSPNaniConnector: 1060: The specified service does not exist as an installed service.
HOWEVER this check reverted to 1248 rather than using 12489
executing without port
root@dalsrvitmon03:/usr/local/nagios/libexec# ./check_nt -H DALSRVPRDIIS02 -v SERVICESTATE -d SHOWALL -l eSPNaniConnector\$MN
connect to address DALSRVPRDIIS02 and port 1248: Connection refused
could not fetch information from server
with port defined and not a double $
root@dalsrvitmon03:/usr/local/nagios/libexec# ./check_nt -H DALSRVPRDIIS02 -v SERVICESTATE -d SHOWALL -l eSPNaniConnector\$MN -p12489
eSPNaniConnector$MN: Started
with the double $
root@dalsrvitmon03:/usr/local/nagios/libexec# ./check_nt -H DALSRVPRDIIS02 -v SERVICESTATE -d SHOWALL -l eSPNaniConnector\$$mn -p12489
Failed to open service eSPNaniConnector$: 1060: The specified service does not exist as an installed service.
attached is my check_nt config file nt.cfg
- Attachments
-
- nt.cfg
- (511 Bytes) Downloaded 161 times
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: check_nt service state check not working
Ok, because your $ARG1$ is escaped with single quotes here
I believe you need to change the escaping to just
Code: Select all
define command {
command_name check_nt
command_line /usr/lib/nagios/plugins/check_nt -p 12489 -H '$HOSTADDRESS$' -v '$ARG1$' $ARG2$
}
Code: Select all
check_command check_nt!SERVICESTATE!-d SHOWALL -l eSPNaniConnector$$MN
-
- Posts: 66
- Joined: Thu Nov 14, 2019 3:31 pm
Re: check_nt service state check not working
scottwilkerson wrote:Ok, because your $ARG1$ is escaped with single quotes hereI believe you need to change the escaping to justCode: Select all
define command { command_name check_nt command_line /usr/lib/nagios/plugins/check_nt -p 12489 -H '$HOSTADDRESS$' -v '$ARG1$' $ARG2$ }
Code: Select all
check_command check_nt!SERVICESTATE!-d SHOWALL -l eSPNaniConnector$$MN
Changed the check to and still no difference.
check_command check_nt!SERVICESTATE!-d SHOWALL -l eSPNaniConnector$$MN
I then ran the command from terminal
root@dalsrvitmon03:/usr/lib/nagios/plugins# ./check_nt -H DALSRVPRDIIS02 -v SERVICESTATE -d SHOWALL -l eSPNaniConnector$$MN -p 12489
Failed to open service eSPNaniConnector845MN: 1060: The specified service does not exist as an installed service.
root@dalsrvitmon03:/usr/lib/nagios/plugins# ./check_nt -H DALSRVPRDIIS02 -v SERVICESTATE -d SHOWALL -l eSPNaniConnector$$MN
connect to address DALSRVPRDIIS02 and port 1248: Connection refused
could not fetch information from server
-
- Posts: 66
- Joined: Thu Nov 14, 2019 3:31 pm
Re: check_nt service state check not working
here is my services.cfg file
This is nagios core 3
we installed using ubuntu packages.
This is nagios core 3
we installed using ubuntu packages.
- Attachments
-
- services_nagios2.cfg
- (36.29 KiB) Downloaded 162 times
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: check_nt service state check not working
Based no how your configs are setup, I'm going to recommend changing it back to
then change the check_command to the following
Then restart nagios
You cannot run these special escaping commands the same way from the command line because Nagios is going to see the $ and try to think it is a Macro, this doesn't work the same running from the CLI
Code: Select all
check_command check_nt!SERVICESTATE!-d SHOWALL -l eSPNaniConnector\$$MN
Code: Select all
define command {
command_name check_nt
command_line /usr/lib/nagios/plugins/check_nt -p 12489 -H '$HOSTADDRESS$' -v $ARG1$ $ARG2$
}
You cannot run these special escaping commands the same way from the command line because Nagios is going to see the $ and try to think it is a Macro, this doesn't work the same running from the CLI
-
- Posts: 66
- Joined: Thu Nov 14, 2019 3:31 pm
Re: check_nt service state check not working
no change.
i modified it to be the following like above
# '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$
}
i modified it to be the following like above
# '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
Please try changing it to this:
Code: Select all
-l "eSPNaniConnector$"$"DE"
-
- Posts: 66
- Joined: Thu Nov 14, 2019 3:31 pm
Re: check_nt service state check not working
ssax wrote:Please try changing it to this:
Code: Select all
-l "eSPNaniConnector$"$"DE"
DE? do you mean MN?
Re: check_nt service state check not working
Yes, that was a typo, use MN.
-l "eSPNaniConnector$"$"MN"
-l "eSPNaniConnector$"$"MN"
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
- Posts: 66
- Joined: Thu Nov 14, 2019 3:31 pm
Re: check_nt service state check not working
tgriep wrote:Yes, I that was a typo, use MN.
-l "eSPNaniConnector$"$"MN"
lol i thought so.
I changed it, restarted nagios3 using service nagios3 restart and tested. did not work
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"
}