check_nt (server port must be an integer) error

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
tejanagios
Posts: 24
Joined: Wed Feb 03, 2016 6:45 am

check_nt (server port must be an integer) error

Post by tejanagios »

HI,

check_nt in nagios xi, when trying to configure it via ccm, throws an error, saying server port must be an integer when trying to pull info from nsclient++, the client is running fine and gives output
from the command line.

Also, what does check_Xi_service use as its transport mechanism in the background?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: check_nt (server port must be an integer) error

Post by lmiltchev »

check_nt in nagios xi, when trying to configure it via ccm, throws an error, saying server port must be an integer...
This usually happens when the port is defined twice - in the command, and in the service. Can you show us the command, and service confgs? Also, show us the actual command that you run from the command line along with the output of it.
Also, what does check_Xi_service use as its transport mechanism in the background?
Are you talking about the "check_xi_service_nsclient" command? It is simply calling the "check_nt" command:

Code: Select all

define command {
       command_name                  		check_xi_service_nsclient
       command_line                  		$USER1$/check_nt -H $HOSTADDRESS$ -s "$ARG1$" -p 12489 -v $ARG2$ $ARG3$ $ARG4$
}
Be sure to check out our Knowledgebase for helpful articles and solutions!
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: check_nt (server port must be an integer) error

Post by rkennedy »

Can you post a screenshot of the check_nt issue so we can see what you're referring to?
Former Nagios Employee
tejanagios
Posts: 24
Joined: Wed Feb 03, 2016 6:45 am

Re: check_nt (server port must be an integer) error

Post by tejanagios »

## I have used the wizard to create a service for the host ending with .18 ip address, but now iam trying to check the service for host with ip ending .13 from nagios xi:

The reason basically is because, after adding hosts through the config wizard, the service names have the names of the hosts in the services menu filtering under CCM, instead of the service name itself.

so, instead of using the wizard, if i add services that i like and make them into a service group and apply the service group to a host group, ( or can i pick all the services that i like and make a template?) please throw me a good documentation on how to create and or use service templates please) I think it is more linear approach, please correct me if i am wrong in thinking how things work in
nagios xi?

here is the output yo've requested.



[root@nagios-server services]# vi 172.24.48.18.cfg
###############################################################################
#
# Service configuration file
#
# Created by: Nagios Core Config Manager 2.5.2
# Date: 2016-02-16 16:55:30
# Version: Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND ---
# Nagios CCM will overwrite all manual settings during the next update if you
# would like to edit files manually, place them in the 'static' directory or
# import your configs into the CCM by placing them in the 'import' directory.
#
###############################################################################

define service {
host_name 172.24.48.18
service_description Drive C: Disk Usage
use xiwizard_windowsdesktop_nsclient_service
check_command check_xi_service_nsclient!2willpass!USEDDISKSPACE!-l C -w 80 -c 95
max_check_attempts 5
check_interval 5
retry_interval 1
check_period xi_timeperiod_24x7
notification_interval 60
notification_period xi_timeperiod_24x7
notifications_enabled 0
contacts nagiosadmin
_xiwizard windowsdesktop
register 1
}

define service {
host_name 172.24.48.18
service_description Memory Usage
use xiwizard_windowsdesktop_nsclient_service
check_command check_xi_service_nsclient!2willpass!MEMUSE!-w 80 -c 90
max_check_attempts 5
check_interval 5
retry_interval 1
check_period xi_timeperiod_24x7
notification_interval 60
notification_period xi_timeperiod_24x7
notifications_enabled 0
contacts nagiosadmin
_xiwizard windowsdesktop
register 1
}

########################################### NAGIOS XI SERVICES COMMAND LINE OUTPUT HERE: screen shot attached to a file pls check.


COMMAND: /usr/local/nagios/libexec/check_nt -H 172.24.48.13 -p $USER7$ -s $USER8$ -v MEMUSE
OUTPUT: Server port must be an integer
You do not have the required permissions to view the files attached to this post.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: check_nt (server port must be an integer) error

Post by rkennedy »

I think you're confusing $ARG$ values, with $USER$ macros.

Can you please post the contents of this file?

Code: Select all

cat /usr/local/nagios/etc/resource.cfg
Former Nagios Employee
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: check_nt (server port must be an integer) error

Post by lmiltchev »

$USER7$ and $USER8$ are not the same as $ARG7$ and $ARG8$... The $USER7$ and $USER8$ macros are grabbed from the "/usr/local/nagios/etc/resource.cfg" file. Clear the $USER7$ and $USER8$ fields, enter the warning & critical thresholds in the $ARG2$ fields, save and try your check again.

Here's an example of a similar service on my test box:
example01.PNG
You can set up one service the way you want it, then add it to a host group by clicking on the "Manage Hostgroups" under the "Service Management" ("Common Settings" tab).

You can also review our documentation on object inheritance here:
https://assets.nagios.com/downloads/nag ... tance.html
You do not have the required permissions to view the files attached to this post.
Be sure to check out our Knowledgebase for helpful articles and solutions!
tejanagios
Posts: 24
Joined: Wed Feb 03, 2016 6:45 am

Re: check_nt (server port must be an integer) error

Post by tejanagios »

== resources.cfg file contents

[root@nagios-server etc]# cat resource.cfg
# Path to the plugins
$USER1$=/usr/local/nagios/libexec

# Path to event handlers
#$USER2$=/usr/local/nagios/libexec/eventhandlers

# Port for NSClient++
$USER7$=12489
# Password for NSClient++
$USER8$=secret


##check_nt command definition from commands.cfg####

define command {
command_name check_nt
command_line $USER1$/check_nt -H $HOSTADDRESS$ -p $USER7$ -s $USER8$ -v $ARG1$ $ARG2$
}



service definition for that object


define service {
host_name QA-WTS1
service_description check memory
check_command check_nt!MEMUSE!-w 80 -c 90!!!!!!
max_check_attempts 5
check_period 24x7
register 1
}

the check_command check_nt hasn't got any password or port number passed on in the command output on the gui at nagios xi.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: check_nt (server port must be an integer) error

Post by lmiltchev »

Replace:

Code: Select all

$USER8$=secret
with:

Code: Select all

$USER8$=<your actual password>
in the resource.cfg file, and you should be good to go. Testing from the CCM may still fail with "Server port must be an integer" but the check should work fine.

Go to Home->Service Detail->check memory, and force an immediate check. Let us know if this worked.
Be sure to check out our Knowledgebase for helpful articles and solutions!
tejanagios
Posts: 24
Joined: Wed Feb 03, 2016 6:45 am

Re: check_nt (server port must be an integer) error

Post by tejanagios »

HI lmitchev,

thank you, that works now. what if I need to apply this service to a host group, how do I go changing the passwords for all of them ?

how does check_xi_service pick passwords for different hosts without any entries in the resources.cfg file ?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: check_nt (server port must be an integer) error

Post by lmiltchev »

thank you, that works now. what if I need to apply this service to a host group, how do I go changing the passwords for all of them ?

how does check_xi_service pick passwords for different hosts without any entries in the resources.cfg file ?
You can use the "check_xi_service_nsclient" command instead in your service, for example:

service definition

Code: Select all

define service {
	host_name				myhost
	service_description		check memory
	hostgroup_name			windows-servers
	check_command			check_xi_service_nsclient!$_HOSTPASS$!MEMUSE!-w 80 -c 90!!!!!
	max_check_attempts		5
	check_interval			5
	retry_interval			1
	check_period			xi_timeperiod_24x7
	notification_interval		60
	first_notification_delay	0
	notification_period		xi_timeperiod_24x7
	notifications_enabled		0
	contacts			nagiosadmin
	_xiwizard			windowsserver
	register			1
	}
command definition

Code: Select all

define command {
       command_name                  		check_xi_service_nsclient
       command_line                  		$USER1$/check_nt -H $HOSTADDRESS$ -s "$ARG1$" -p 12489 -v $ARG2$ $ARG3$ $ARG4$
}
As you can see, this service is added to a hostgroup (windows-servers), which means it will be added to all hosts, members of this hostgroup. The password is passed in "$ARG1$". In order to use different passwords, I set up a macro ("_PASS") on each host, member of "windows-servers".

CCM->Hosts-><your host>->Misc Settings->Manage Variable Definitions, then set:

Variable name = _PASS
Variable value = <the NSClient++ password on this Windows server>

Close, save, and apply configuration.

When the macro is used this way in the service definition:
$_HOSTPASS$
you will have the correct password for each host passed to $ARG1$.

Hope this helps.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked